From 9184cf395372307df5fd4d7b2cc89f6dea698285 Mon Sep 17 00:00:00 2001 From: elianiva Date: Tue, 5 Jan 2021 19:26:08 +0700 Subject: feat: added more indent queries --- queries/c/indents.scm | 16 ++++++++++++++++ queries/cpp/indents.scm | 16 ++++++++++++++++ queries/go/indents.scm | 17 +++++++++++++++++ queries/graphql/indents.scm | 9 +++++++++ queries/html/indents.scm | 9 +++++++++ queries/javascript/indents.scm | 26 ++++++++++++++++++++++++++ queries/json/indents.scm | 9 +++++++++ queries/jsx/indents.scm | 10 ++++++++++ queries/ruby/indents.scm | 12 ++++++++++++ queries/rust/indents.scm | 26 ++++++++++++++++++++++++++ queries/teal/indents.scm | 20 ++++++++++++++++++++ queries/toml/indents.scm | 8 ++++++++ queries/tsx/indents.scm | 1 + queries/typescript/indents.scm | 6 ++++++ queries/yaml/indents.scm | 3 +++ 15 files changed, 188 insertions(+) create mode 100644 queries/c/indents.scm create mode 100644 queries/cpp/indents.scm create mode 100644 queries/go/indents.scm create mode 100644 queries/graphql/indents.scm create mode 100644 queries/html/indents.scm create mode 100644 queries/javascript/indents.scm create mode 100644 queries/json/indents.scm create mode 100644 queries/jsx/indents.scm create mode 100644 queries/ruby/indents.scm create mode 100644 queries/rust/indents.scm create mode 100644 queries/teal/indents.scm create mode 100644 queries/toml/indents.scm create mode 100644 queries/tsx/indents.scm create mode 100644 queries/typescript/indents.scm create mode 100644 queries/yaml/indents.scm diff --git a/queries/c/indents.scm b/queries/c/indents.scm new file mode 100644 index 00000000..7681478d --- /dev/null +++ b/queries/c/indents.scm @@ -0,0 +1,16 @@ +[ + (init_declarator) + (compound_statement) + (preproc_arg) + (field_declaration_list) + (case_statement) +] @indent + + +[ + "#define" + "#ifdef" + "#endif" + "{" + "}" +] @branch diff --git a/queries/cpp/indents.scm b/queries/cpp/indents.scm new file mode 100644 index 00000000..a08deaa4 --- /dev/null +++ b/queries/cpp/indents.scm @@ -0,0 +1,16 @@ +[ + (enumerator_list) + (struct_specifier) + (compound_statement) + (case_statement) + (condition_clause) + (conditional_expression) +] @indent + +[ + (statement_identifier) + "#ifdef" + "#endif" + "{" + "}" +] @branch diff --git a/queries/go/indents.scm b/queries/go/indents.scm new file mode 100644 index 00000000..07e35477 --- /dev/null +++ b/queries/go/indents.scm @@ -0,0 +1,17 @@ +[ + (import_declaration) + (function_declaration) + (const_declaration) + (var_declaration) + (type_declaration) + (composite_literal) + (func_literal) + (block) +] @indent + +[ + "(" + ")" + "{" + "}" +] @branch diff --git a/queries/graphql/indents.scm b/queries/graphql/indents.scm new file mode 100644 index 00000000..0f222b6d --- /dev/null +++ b/queries/graphql/indents.scm @@ -0,0 +1,9 @@ +[ + (definition) + (selection) +] @indent + +[ + "{" + "}" +] @branch diff --git a/queries/html/indents.scm b/queries/html/indents.scm new file mode 100644 index 00000000..b6230db3 --- /dev/null +++ b/queries/html/indents.scm @@ -0,0 +1,9 @@ +[ + (element) +] @indent + +[ + (end_tag) + ">" + "/>" +] @branch diff --git a/queries/javascript/indents.scm b/queries/javascript/indents.scm new file mode 100644 index 00000000..aa4aedb3 --- /dev/null +++ b/queries/javascript/indents.scm @@ -0,0 +1,26 @@ +; inherits: (jsx) + +[ + (object) + (array) + (arguments) + (statement_block) + (object_pattern) + (class_body) + (method_definition) + (named_imports) + (binary_expression) + (return_statement) + (template_substitution) + (expression_statement (call_expression)) + (export_clause) +] @indent + +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @branch diff --git a/queries/json/indents.scm b/queries/json/indents.scm new file mode 100644 index 00000000..0345b945 --- /dev/null +++ b/queries/json/indents.scm @@ -0,0 +1,9 @@ +[ + (object) + (array) +] @indent + +[ + "}" + "]" +] @branch diff --git a/queries/jsx/indents.scm b/queries/jsx/indents.scm new file mode 100644 index 00000000..ae591539 --- /dev/null +++ b/queries/jsx/indents.scm @@ -0,0 +1,10 @@ +[ + (jsx_fragment) + (jsx_element) + (jsx_self_closing_element) +] @indent + +[ + (jsx_closing_element) + ">" +] @branch diff --git a/queries/ruby/indents.scm b/queries/ruby/indents.scm new file mode 100644 index 00000000..7d4da485 --- /dev/null +++ b/queries/ruby/indents.scm @@ -0,0 +1,12 @@ +[ + (class) + (method) + (module) + (call) + (if) +] @indent + +[ + (elsif) + "end" +] @branch diff --git a/queries/rust/indents.scm b/queries/rust/indents.scm new file mode 100644 index 00000000..d437c387 --- /dev/null +++ b/queries/rust/indents.scm @@ -0,0 +1,26 @@ +[ + (mod_item) + (struct_item) + (enum_item) + (impl_item) + (for_expression) + (struct_expression) + (match_expression) + (match_arm) + (if_let_expression) + (call_expression) + (assignment_expression) + (arguments) + (block) + (where_clause) +] @indent + +[ + "where" + "(" + ")" + "[" + "]" + "{" + "}" +] @branch diff --git a/queries/teal/indents.scm b/queries/teal/indents.scm new file mode 100644 index 00000000..ede38818 --- /dev/null +++ b/queries/teal/indents.scm @@ -0,0 +1,20 @@ +[ + (record_declaration) + (record_entry) + (anon_function) + (function_body) + (table_constructor) + (if_statement) + (for_statement) + (return_statement) + (while_statement) +] @indent + +[ + "{" + "}" + "(" + ")" + "end" + "then" +] @branch diff --git a/queries/toml/indents.scm b/queries/toml/indents.scm new file mode 100644 index 00000000..a0da76e2 --- /dev/null +++ b/queries/toml/indents.scm @@ -0,0 +1,8 @@ +[ + (array) + (table_array_element) +] @indent + +[ + "]" +] @branch diff --git a/queries/tsx/indents.scm b/queries/tsx/indents.scm new file mode 100644 index 00000000..07391231 --- /dev/null +++ b/queries/tsx/indents.scm @@ -0,0 +1 @@ +; inherits: typescript,jsx diff --git a/queries/typescript/indents.scm b/queries/typescript/indents.scm new file mode 100644 index 00000000..9aef51c4 --- /dev/null +++ b/queries/typescript/indents.scm @@ -0,0 +1,6 @@ +; inherits: javascript + +[ + (interface_declaration) + (object_type) +] @indent diff --git a/queries/yaml/indents.scm b/queries/yaml/indents.scm new file mode 100644 index 00000000..2ed382e0 --- /dev/null +++ b/queries/yaml/indents.scm @@ -0,0 +1,3 @@ +[ + (block_mapping_pair) +] @indent -- cgit v1.2.3