diff options
| author | Pham Huy Hoang <hoangtun0810@gmail.com> | 2024-01-06 15:05:50 +0900 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2024-01-19 16:58:37 +0100 |
| commit | 57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9 (patch) | |
| tree | 70bf645539882b88e6fa129cefd30986b89bbac3 /queries/dart | |
| parent | ci: add query lint job (diff) | |
| download | nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.gz nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.bz2 nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.lz nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.xz nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.zst nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.zip | |
chore: query formatting
Diffstat (limited to 'queries/dart')
| -rw-r--r-- | queries/dart/folds.scm | 3 | ||||
| -rw-r--r-- | queries/dart/highlights.scm | 220 | ||||
| -rw-r--r-- | queries/dart/indents.scm | 17 | ||||
| -rw-r--r-- | queries/dart/injections.scm | 4 | ||||
| -rw-r--r-- | queries/dart/locals.scm | 24 |
5 files changed, 134 insertions, 134 deletions
diff --git a/queries/dart/folds.scm b/queries/dart/folds.scm index ea398a4b3..8dc4e7815 100644 --- a/queries/dart/folds.scm +++ b/queries/dart/folds.scm @@ -2,13 +2,10 @@ (class_definition) (enum_declaration) (extension_declaration) - (arguments) (function_body) - (block) (switch_block) - (list_literal) (set_or_map_literal) (string_literal) diff --git a/queries/dart/highlights.scm b/queries/dart/highlights.scm index be2824da5..de81cbc0b 100644 --- a/queries/dart/highlights.scm +++ b/queries/dart/highlights.scm @@ -1,18 +1,21 @@ (dotted_identifier_list) @string - ; Methods ; -------------------- (super) @function ; TODO: add method/call_expression to grammar and ; distinguish method call from variable access -(function_expression_body (identifier) @function) -; ((identifier)(selector (argument_part)) @function) +(function_expression_body + (identifier) @function) +; ((identifier)(selector (argument_part)) @function) ; NOTE: This query is a bit of a work around for the fact that the dart grammar doesn't ; specifically identify a node as a function call -(((identifier) @function (#lua-match? @function "^_?[%l]")) - . (selector . (argument_part))) @function +(((identifier) @function + (#lua-match? @function "^_?[%l]")). +(selector + . + (argument_part))) @function ; Annotations ; -------------------- @@ -24,38 +27,36 @@ (template_substitution "$" @punctuation.special "{" @punctuation.special - "}" @punctuation.special -) @none + "}" @punctuation.special) @none (template_substitution "$" @punctuation.special - (identifier_dollar_escaped) @variable -) @none + (identifier_dollar_escaped) @variable) @none (escape_sequence) @string.escape [ - "@" - "=>" - ".." - "??" - "==" - "?" - ":" - "&&" - "%" - "<" - ">" - "=" - ">=" - "<=" - "||" - (multiplicative_operator) - (increment_operator) - (is_operator) - (prefix_operator) - (equality_operator) - (additive_operator) + "@" + "=>" + ".." + "??" + "==" + "?" + ":" + "&&" + "%" + "<" + ">" + "=" + ">=" + "<=" + "||" + (multiplicative_operator) + (increment_operator) + (is_operator) + (prefix_operator) + (equality_operator) + (additive_operator) ] @operator [ @@ -65,7 +66,7 @@ "]" "{" "}" -] @punctuation.bracket +] @punctuation.bracket ; Delimiters ; -------------------- @@ -79,26 +80,34 @@ ; -------------------- (class_definition name: (identifier) @type) + (constructor_signature name: (identifier) @type) + (scoped_identifier scope: (identifier) @type) + (function_signature name: (identifier) @function.method) + (getter_signature (identifier) @function.method) + (setter_signature name: (identifier) @function.method) + (enum_declaration name: (identifier) @type) + (enum_constant name: (identifier) @type) + (void_type) @type ((scoped_identifier scope: (identifier) @type name: (identifier) @type) - (#lua-match? @type "^[%u%l]")) + (#lua-match? @type "^[%u%l]")) (type_identifier) @type @@ -111,7 +120,7 @@ (inferred_type) @keyword ((identifier) @type - (#lua-match? @type "^_?[%u].*[%l]")) ; catch Classes or IClasses not CLASSES + (#lua-match? @type "^_?[%u].*[%l]")) ; catch Classes or IClasses not CLASSES ("Function" @type) @@ -131,29 +140,35 @@ ; Parameters ; -------------------- (formal_parameter - name: (identifier) @variable.parameter) + name: (identifier) @variable.parameter) (named_argument - (label (identifier) @variable.parameter)) + (label + (identifier) @variable.parameter)) ; Literals ; -------------------- [ - (hex_integer_literal) - (decimal_integer_literal) - (decimal_floating_point_literal) - ; TODO: inaccessible nodes - ; (octal_integer_literal) - ; (hex_floating_point_literal) + (hex_integer_literal) + (decimal_integer_literal) + (decimal_floating_point_literal) + ; TODO: inaccessible nodes + ; (octal_integer_literal) + ; (hex_floating_point_literal) ] @number (symbol_literal) @string.special.symbol + (string_literal) @string + (true) @boolean + (false) @boolean + (null_literal) @constant.builtin (comment) @comment @spell + (documentation_comment) @comment.documentation @spell ; Keywords @@ -169,47 +184,44 @@ ; Reserved words (cannot be used as identifiers) [ - ; TODO: - ; "rethrow" cannot be targeted at all and seems to be an invisible node - ; TODO: - ; the assert keyword cannot be specifically targeted - ; because the grammar selects the whole node or the content - ; of the assertion not just the keyword - ; assert - (case_builtin) - "late" - "required" - "extension" - "on" - "class" - "enum" - "extends" - "in" - "is" - "new" - "super" - "with" + ; TODO: + ; "rethrow" cannot be targeted at all and seems to be an invisible node + ; TODO: + ; the assert keyword cannot be specifically targeted + ; because the grammar selects the whole node or the content + ; of the assertion not just the keyword + ; assert + (case_builtin) + "late" + "required" + "extension" + "on" + "class" + "enum" + "extends" + "in" + "is" + "new" + "super" + "with" ] @keyword -[ - "return" -] @keyword.return - +"return" @keyword.return ; Built in identifiers: ; alone these are marked as keywords [ - "deferred" - "factory" - "get" - "implements" - "interface" - "library" - "operator" - "mixin" - "part" - "set" - "typedef" + "deferred" + "factory" + "get" + "implements" + "interface" + "library" + "operator" + "mixin" + "part" + "set" + "typedef" ] @keyword [ @@ -221,43 +233,28 @@ ] @keyword.coroutine [ - (const_builtin) - (final_builtin) - "abstract" - "covariant" - "dynamic" - "external" - "static" - "final" - "base" - "sealed" + (const_builtin) + (final_builtin) + "abstract" + "covariant" + "dynamic" + "external" + "static" + "final" + "base" + "sealed" ] @type.qualifier ; when used as an identifier: ((identifier) @variable.builtin - (#any-of? @variable.builtin - "abstract" - "as" - "covariant" - "deferred" - "dynamic" - "export" - "external" - "factory" - "Function" - "get" - "implements" - "import" - "interface" - "library" - "operator" - "mixin" - "part" - "set" - "static" - "typedef")) + (#any-of? @variable.builtin "abstract" "as" "covariant" "deferred" "dynamic" "export" "external" "factory" "Function" "get" "implements" "import" "interface" "library" "operator" "mixin" "part" "set" "static" "typedef")) -["if" "else" "switch" "default"] @keyword.conditional +[ + "if" + "else" + "switch" + "default" +] @keyword.conditional [ "try" @@ -267,4 +264,9 @@ (break_statement) ] @keyword.exception -["do" "while" "continue" "for"] @keyword.repeat +[ + "do" + "while" + "continue" + "for" +] @keyword.repeat diff --git a/queries/dart/indents.scm b/queries/dart/indents.scm index 87befcf6c..8da3ebb14 100644 --- a/queries/dart/indents.scm +++ b/queries/dart/indents.scm @@ -2,7 +2,8 @@ (class_body) (function_body) (function_expression_body) - (declaration (initializers)) + (declaration + (initializers)) (switch_block) (if_statement) (formal_parameter_list) @@ -32,14 +33,16 @@ "]" ] @indent.branch -[ - "}" -] @indent.end +"}" @indent.end + +(return_statement + ";" @indent.end) -(return_statement ";" @indent.end) -(break_statement ";" @indent.end) +(break_statement + ";" @indent.end) ; this one is for dedenting the else block -(if_statement (block) @indent.branch) +(if_statement + (block) @indent.branch) (comment) @indent.ignore diff --git a/queries/dart/injections.scm b/queries/dart/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/dart/injections.scm +++ b/queries/dart/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/dart/locals.scm b/queries/dart/locals.scm index f7faa26ac..3e3beb58e 100644 --- a/queries/dart/locals.scm +++ b/queries/dart/locals.scm @@ -1,5 +1,4 @@ -;; Definitions - +; Definitions (function_signature name: (identifier) @local.definition.function) @@ -15,20 +14,19 @@ (static_final_declaration (identifier) @local.definition.var) -;; References - +; References (identifier) @local.reference -;; Scopes - +; Scopes (class_definition body: (_) @local.scope) + [ - (block) - (if_statement) - (for_statement) - (while_statement) - (try_statement) - (catch_clause) - (finally_clause) + (block) + (if_statement) + (for_statement) + (while_statement) + (try_statement) + (catch_clause) + (finally_clause) ] @local.scope |
