Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(queries): Implementation using queries #5

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.


## 0.2.0
> Released N/A

* Use queries instead (#5)

## 0.1.0
> Released Oct 18, 2021

Expand Down
1 change: 0 additions & 1 deletion Cask
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

(files
"ts-fold.el"
"ts-fold-parsers.el"
"ts-fold-summary.el"
"ts-fold-indicators.el"
"ts-fold-util.el")
Expand Down
8 changes: 8 additions & 0 deletions queries/bash/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
(function_definition)
(if_statement)
(case_statement)
(for_statement)
(while_statement)
(c_style_for_statement)
] @fold
4 changes: 4 additions & 0 deletions queries/beancount/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[
(transaction)
(heading)
] @fold
3 changes: 3 additions & 0 deletions queries/bibtex/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
(entry)
] @fold
17 changes: 17 additions & 0 deletions queries/c-sharp/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
body: [
(declaration_list)
(switch_body)
(enum_member_declaration_list)
] @fold

accessors: [
(accessor_list)
] @fold

initializer: [
(initializer_expression)
] @fold

(block) @fold

(comment) @comment
19 changes: 19 additions & 0 deletions queries/c/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[
(for_statement)
(if_statement)
(while_statement)
(switch_statement)
(case_statement)
(function_definition)
(struct_specifier)
(enum_specifier)
(comment)
(preproc_if)
(preproc_elif)
(preproc_else)
(preproc_ifdef)
(initializer_list)
] @fold

(compound_statement
(compound_statement) @fold)
1 change: 1 addition & 0 deletions queries/clojure/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(source (list_lit) @fold)
7 changes: 7 additions & 0 deletions queries/cmake/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
(if_condition)
(foreach_loop)
(while_loop)
(function_def)
(macro_def)
] @fold
1 change: 1 addition & 0 deletions queries/commonlisp/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(source (list_lit) @fold)
14 changes: 14 additions & 0 deletions queries/cpp/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
; inherits: c

[
(for_range_loop)
(class_specifier)
(field_declaration
type: (enum_specifier)
default_value: (initializer_list))
(template_declaration)
(namespace_definition)
(try_statement)
(catch_clause)
(lambda_expression)
] @fold
3 changes: 3 additions & 0 deletions queries/css/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
(rule_set)
] @fold
1 change: 1 addition & 0 deletions queries/cuda/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: cpp
1 change: 1 addition & 0 deletions queries/d/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(block_statement) @fold
1 change: 1 addition & 0 deletions queries/devicetree/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(node) @fold
21 changes: 21 additions & 0 deletions queries/ecma/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[
(for_in_statement)
(for_statement)
(while_statement)
(arrow_function)
(function)
(function_declaration)
(class_declaration)
(method_definition)
(do_statement)
(with_statement)
(switch_statement)
(switch_case)
(import_statement)
(if_statement)
(try_statement)
(catch_clause)
(object)
(generator_function)
(generator_function_declaration)
] @fold
9 changes: 9 additions & 0 deletions queries/elixir/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
(anonymous_function)
(arguments)
(block)
(do_block)
(list)
(map)
(tuple)
] @fold
8 changes: 8 additions & 0 deletions queries/fish/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
(function_definition)
(if_statement)
(switch_statement)
(for_statement)
(while_statement)
(begin_statement)
] @fold
7 changes: 7 additions & 0 deletions queries/foam/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
(comment)
(list)
(dict_core)
] @fold

(code (code_body)* @fold)
11 changes: 11 additions & 0 deletions queries/fortran/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
;; by @oponkork
[
(if_statement)
(where_statement)
(enum_statement)
(do_loop_statement)
(derived_type_definition)
(function)
(subroutine)
(interface)
] @fold
6 changes: 6 additions & 0 deletions queries/fusion/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
(comment)
(block)
(afx_comment)
(afx_element)
] @fold
11 changes: 11 additions & 0 deletions queries/gleam/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
; Folds
[
(case)
(expression_group)
(function)
(public_function)
(anonymous_function)
(type_definition)
(public_type_definition)
(public_opaque_type_definition)
] @fold
1 change: 1 addition & 0 deletions queries/glsl/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: c
13 changes: 13 additions & 0 deletions queries/go/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
(const_declaration)
(expression_switch_statement)
(for_statement)
(func_literal)
(function_declaration)
(if_statement)
(import_declaration)
(method_declaration)
(type_declaration)
(var_declaration)
] @fold

3 changes: 3 additions & 0 deletions queries/godot_resource/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
(section)
] @fold
6 changes: 6 additions & 0 deletions queries/hcl/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
(comment)
(block)
(heredoc_template)
(object)
] @fold
6 changes: 6 additions & 0 deletions queries/heex/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
; HEEx tags, components, and slots fold similar to HTML
[
(component)
(tag)
(slot)
] @fold
1 change: 1 addition & 0 deletions queries/hjson/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: json
5 changes: 5 additions & 0 deletions queries/html/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
(element)
(style_element)
(script_element)
] @fold
1 change: 1 addition & 0 deletions queries/javascript/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: ecma,jsx
5 changes: 5 additions & 0 deletions queries/json/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
(pair)
(object)
(array)
] @fold
1 change: 1 addition & 0 deletions queries/jsonc/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: json
1 change: 1 addition & 0 deletions queries/jsx/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(jsx_element) @fold
17 changes: 17 additions & 0 deletions queries/julia/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
(module_definition)
(struct_definition)
(macro_definition)
(function_definition)

(if_statement)
(try_statement)
(for_statement)
(while_statement)
(let_statement)
(quote_statement)

(do_clause)
(compound_expression)
] @fold

17 changes: 17 additions & 0 deletions queries/kotlin/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
(import_list)

(when_expression)
(control_structure_body)

(lambda_literal)
(function_body)
(primary_constructor)
(secondary_constructor)
(anonymous_initializer)

(class_body)
(enum_class_body)

(interpolated_expression)
] @fold
13 changes: 13 additions & 0 deletions queries/latex/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
(chapter)
(part)
(section)
(subsection)
(subsubsection)
(paragraph)
(subparagraph)

(generic_environment)
(comment_environment)
(displayed_equation)
] @fold
3 changes: 3 additions & 0 deletions queries/ledger/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
(xact)
] @fold
10 changes: 10 additions & 0 deletions queries/lua/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
(do_statement)
(while_statement)
(repeat_statement)
(if_statement)
(for_statement)
(function_declaration)
(function_definition)
(table_constructor)
] @fold
5 changes: 5 additions & 0 deletions queries/markdown/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
(fenced_code_block)
(indented_code_block)
(list)
] @fold
1 change: 1 addition & 0 deletions queries/ninja/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(body) @fold
11 changes: 11 additions & 0 deletions queries/nix/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
; Nix doesn't really have blocks, so just guess what people might want folds for
[
(if)
(with)
(let)
(function)
(attrset)
(rec_attrset)
(list)
(indented_string)
] @fold
30 changes: 30 additions & 0 deletions queries/ocaml/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
(let_binding)
(external)
(type_binding)
(exception_definition)
(module_binding)
(module_type_definition)
(open_module)
(include_module)
(include_module_type)
(class_binding)
(class_type_binding)
(value_specification)
(inheritance_specification)
(instance_variable_specification)
(method_specification)
(inheritance_definition)
(instance_variable_definition)
(method_definition)
(class_initializer)
(match_case)
(attribute)
(item_attribute)
(floating_attribute)
(extension)
(item_extension)
(quoted_extension)
(quoted_item_extension)
(comment)
] @fold
1 change: 1 addition & 0 deletions queries/ocaml_interface/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: ocaml
33 changes: 33 additions & 0 deletions queries/pascal/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[
(interface)
(implementation)
(initialization)
(finalization)

(if)
(ifElse)
(while)
(repeat)
(for)
(foreach)
(try)
(case)
(caseCase)
(asm)
(with)

(declVar)
(declConst)
(declEnum)
(declProcRef)
(declExports)
(declProcRef)
(declType)
(defProc)
(declField)
(declProp)

(comment)
] @fold

(interface (declProc) @fold)
Loading