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 | |
| 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
674 files changed, 18359 insertions, 12541 deletions
diff --git a/queries/ada/folds.scm b/queries/ada/folds.scm index b8b5735bb..8e3defac4 100644 --- a/queries/ada/folds.scm +++ b/queries/ada/folds.scm @@ -1,14 +1,13 @@ -;; Support for folding in Ada -;; za toggles folding a package, subprogram, if statement or loop - +; Support for folding in Ada +; za toggles folding a package, subprogram, if statement or loop [ - (package_declaration) - (generic_package_declaration) - (package_body) - (subprogram_body) - (block_statement) - (if_statement) - (loop_statement) - (gnatprep_declarative_if_statement) - (gnatprep_if_statement) + (package_declaration) + (generic_package_declaration) + (package_body) + (subprogram_body) + (block_statement) + (if_statement) + (loop_statement) + (gnatprep_declarative_if_statement) + (gnatprep_if_statement) ] @fold diff --git a/queries/ada/highlights.scm b/queries/ada/highlights.scm index a88935b2a..c15c4d9e3 100644 --- a/queries/ada/highlights.scm +++ b/queries/ada/highlights.scm @@ -1,190 +1,288 @@ -;; highlight queries. -;; See the syntax at https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries -;; See also https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations -;; for a list of recommended @ tags, though not all of them have matching -;; highlights in neovim. - +; highlight queries. +; See the syntax at https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries +; See also https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations +; for a list of recommended @ tags, though not all of them have matching +; highlights in neovim. [ - "abort" - "abs" - "abstract" - "accept" - "access" - "all" - "array" - "at" - "begin" - "declare" - "delay" - "delta" - "digits" - "do" - "end" - "entry" - "exit" - "generic" - "interface" - "is" - "limited" - "null" - "of" - "others" - "out" - "pragma" - "private" - "range" - "synchronized" - "tagged" - "task" - "terminate" - "until" - "when" + "abort" + "abs" + "abstract" + "accept" + "access" + "all" + "array" + "at" + "begin" + "declare" + "delay" + "delta" + "digits" + "do" + "end" + "entry" + "exit" + "generic" + "interface" + "is" + "limited" + "null" + "of" + "others" + "out" + "pragma" + "private" + "range" + "synchronized" + "tagged" + "task" + "terminate" + "until" + "when" ] @keyword + [ - "aliased" - "constant" - "renames" + "aliased" + "constant" + "renames" ] @keyword.storage + [ - "mod" - "new" - "protected" - "record" - "subtype" - "type" + "mod" + "new" + "protected" + "record" + "subtype" + "type" ] @keyword.type + [ - "with" - "use" + "with" + "use" ] @keyword.import + [ - "body" - "function" - "overriding" - "procedure" - "package" - "separate" + "body" + "function" + "overriding" + "procedure" + "package" + "separate" ] @keyword.function + [ - "and" - "in" - "not" - "or" - "xor" + "and" + "in" + "not" + "or" + "xor" ] @keyword.operator + [ - "while" - "loop" - "for" - "parallel" - "reverse" - "some" + "while" + "loop" + "for" + "parallel" + "reverse" + "some" ] @keyword.repeat + +"return" @keyword.return + [ - "return" -] @keyword.return -[ - "case" - "if" - "else" - "then" - "elsif" - "select" + "case" + "if" + "else" + "then" + "elsif" + "select" ] @keyword.conditional + [ - "exception" - "raise" + "exception" + "raise" ] @keyword.exception + (comment) @comment @spell + (string_literal) @string + (character_literal) @string + (numeric_literal) @number -;; Highlight the name of subprograms -(procedure_specification name: (_) @function) -(function_specification name: (_) @function) -(package_declaration name: (_) @function) -(package_body name: (_) @function) -(generic_instantiation name: (_) @function) -(entry_declaration . (identifier) @function) +; Highlight the name of subprograms +(procedure_specification + name: (_) @function) + +(function_specification + name: (_) @function) + +(package_declaration + name: (_) @function) + +(package_body + name: (_) @function) + +(generic_instantiation + name: (_) @function) + +(entry_declaration + . + (identifier) @function) + +; Some keywords should take different categories depending on the context +(use_clause + "use" @keyword.import + "type" @keyword.import) + +(with_clause + "private" @keyword.import) + +(with_clause + "limited" @keyword.import) + +(use_clause + (_) @module) + +(with_clause + (_) @module) + +(loop_statement + "end" @keyword.repeat) -;; Some keywords should take different categories depending on the context -(use_clause "use" @keyword.import "type" @keyword.import) -(with_clause "private" @keyword.import) -(with_clause "limited" @keyword.import) -(use_clause (_) @module) -(with_clause (_) @module) +(if_statement + "end" @keyword.conditional) -(loop_statement "end" @keyword.repeat) -(if_statement "end" @keyword.conditional) -(loop_parameter_specification "in" @keyword.repeat) -(loop_parameter_specification "in" @keyword.repeat) -(iterator_specification ["in" "of"] @keyword.repeat) -(range_attribute_designator "range" @keyword.repeat) +(loop_parameter_specification + "in" @keyword.repeat) -(raise_statement "with" @keyword.exception) +(loop_parameter_specification + "in" @keyword.repeat) -(gnatprep_declarative_if_statement) @keyword.directive -(gnatprep_if_statement) @keyword.directive -(gnatprep_identifier) @keyword.directive +(iterator_specification + [ + "in" + "of" + ] @keyword.repeat) -(subprogram_declaration "is" @keyword.function "abstract" @keyword.function) -(aspect_specification "with" @keyword.function) +(range_attribute_designator + "range" @keyword.repeat) -(full_type_declaration "is" @keyword.type) -(subtype_declaration "is" @keyword.type) -(record_definition "end" @keyword.type) -(full_type_declaration (_ "access" @keyword.type)) -(array_type_definition "array" @keyword.type "of" @keyword.type) -(access_to_object_definition "access" @keyword.type) -(access_to_object_definition "access" @keyword.type - [ - (general_access_modifier "constant" @keyword.type) - (general_access_modifier "all" @keyword.type) - ] -) -(range_constraint "range" @keyword.type) -(signed_integer_type_definition "range" @keyword.type) -(index_subtype_definition "range" @keyword.type) -(record_type_definition "abstract" @keyword.type) -(record_type_definition "tagged" @keyword.type) -(record_type_definition "limited" @keyword.type) -(record_type_definition (record_definition "null" @keyword.type)) -(private_type_declaration "is" @keyword.type "private" @keyword.type) -(private_type_declaration "tagged" @keyword.type) -(private_type_declaration "limited" @keyword.type) -(task_type_declaration "task" @keyword.type "is" @keyword.type) +(raise_statement + "with" @keyword.exception) -;; Gray the body of expression functions +(gnatprep_declarative_if_statement) @keyword.directive + +(gnatprep_if_statement) @keyword.directive + +(gnatprep_identifier) @keyword.directive + +(subprogram_declaration + "is" @keyword.function + "abstract" @keyword.function) + +(aspect_specification + "with" @keyword.function) + +(full_type_declaration + "is" @keyword.type) + +(subtype_declaration + "is" @keyword.type) + +(record_definition + "end" @keyword.type) + +(full_type_declaration + (_ + "access" @keyword.type)) + +(array_type_definition + "array" @keyword.type + "of" @keyword.type) + +(access_to_object_definition + "access" @keyword.type) + +(access_to_object_definition + "access" @keyword.type + [ + (general_access_modifier + "constant" @keyword.type) + (general_access_modifier + "all" @keyword.type) + ]) + +(range_constraint + "range" @keyword.type) + +(signed_integer_type_definition + "range" @keyword.type) + +(index_subtype_definition + "range" @keyword.type) + +(record_type_definition + "abstract" @keyword.type) + +(record_type_definition + "tagged" @keyword.type) + +(record_type_definition + "limited" @keyword.type) + +(record_type_definition + (record_definition + "null" @keyword.type)) + +(private_type_declaration + "is" @keyword.type + "private" @keyword.type) + +(private_type_declaration + "tagged" @keyword.type) + +(private_type_declaration + "limited" @keyword.type) + +(task_type_declaration + "task" @keyword.type + "is" @keyword.type) + +; Gray the body of expression functions (expression_function_declaration - (function_specification) - "is" - (_) @attribute -) -(subprogram_declaration (aspect_specification) @attribute) + (function_specification) + "is" + (_) @attribute) + +(subprogram_declaration + (aspect_specification) @attribute) -;; Highlight full subprogram specifications +; Highlight full subprogram specifications ;(subprogram_body ; [ ; (procedure_specification) ; (function_specification) ; ] @function.spec ;) - ((comment) @comment.documentation - . [ - (entry_declaration) - (subprogram_declaration) - (parameter_specification) - ]) + . + [ + (entry_declaration) + (subprogram_declaration) + (parameter_specification) + ]) -(compilation_unit - . (comment) @comment.documentation) +(compilation_unit + . + (comment) @comment.documentation) (component_list (component_declaration) - . (comment) @comment.documentation) + . + (comment) @comment.documentation) -(enumeration_type_definition +(enumeration_type_definition (identifier) - . (comment) @comment.documentation) + . + (comment) @comment.documentation) diff --git a/queries/ada/locals.scm b/queries/ada/locals.scm index 2d61b3123..bdfc38be8 100644 --- a/queries/ada/locals.scm +++ b/queries/ada/locals.scm @@ -1,33 +1,91 @@ -;; Better highlighting by referencing to the definition, for variable -;; references. However, this is not yet supported by neovim -;; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables - +; Better highlighting by referencing to the definition, for variable +; references. However, this is not yet supported by neovim +; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables (compilation) @local.scope + (package_declaration) @local.scope + (package_body) @local.scope + (subprogram_declaration) @local.scope + (subprogram_body) @local.scope + (block_statement) @local.scope -(with_clause (identifier) @local.definition.import) -(procedure_specification name: (_) @local.definition.function) -(function_specification name: (_) @local.definition.function) -(package_declaration name: (_) @local.definition.var) -(package_body name: (_) @local.definition.var) -(generic_instantiation . name: (_) @local.definition.var) -(component_declaration . (identifier) @local.definition.var) -(exception_declaration . (identifier) @local.definition.var) -(formal_object_declaration . (identifier) @local.definition.var) -(object_declaration . (identifier) @local.definition.var) -(parameter_specification . (identifier) @local.definition.var) -(full_type_declaration . (identifier) @local.definition.type) -(private_type_declaration . (identifier) @local.definition.type) -(private_extension_declaration . (identifier) @local.definition.type) -(incomplete_type_declaration . (identifier) @local.definition.type) -(protected_type_declaration . (identifier) @local.definition.type) -(formal_complete_type_declaration . (identifier) @local.definition.type) -(formal_incomplete_type_declaration . (identifier) @local.definition.type) -(task_type_declaration . (identifier) @local.definition.type) -(subtype_declaration . (identifier) @local.definition.type) +(with_clause + (identifier) @local.definition.import) + +(procedure_specification + name: (_) @local.definition.function) + +(function_specification + name: (_) @local.definition.function) + +(package_declaration + name: (_) @local.definition.var) + +(package_body + name: (_) @local.definition.var) + +(generic_instantiation + . + name: (_) @local.definition.var) + +(component_declaration + . + (identifier) @local.definition.var) + +(exception_declaration + . + (identifier) @local.definition.var) + +(formal_object_declaration + . + (identifier) @local.definition.var) + +(object_declaration + . + (identifier) @local.definition.var) + +(parameter_specification + . + (identifier) @local.definition.var) + +(full_type_declaration + . + (identifier) @local.definition.type) + +(private_type_declaration + . + (identifier) @local.definition.type) + +(private_extension_declaration + . + (identifier) @local.definition.type) + +(incomplete_type_declaration + . + (identifier) @local.definition.type) + +(protected_type_declaration + . + (identifier) @local.definition.type) + +(formal_complete_type_declaration + . + (identifier) @local.definition.type) + +(formal_incomplete_type_declaration + . + (identifier) @local.definition.type) + +(task_type_declaration + . + (identifier) @local.definition.type) + +(subtype_declaration + . + (identifier) @local.definition.type) (identifier) @local.reference diff --git a/queries/agda/folds.scm b/queries/agda/folds.scm index e3258efb9..5e1051f8f 100644 --- a/queries/agda/folds.scm +++ b/queries/agda/folds.scm @@ -1,4 +1,4 @@ [ - (record) - (module) + (record) + (module) ] @fold diff --git a/queries/agda/highlights.scm b/queries/agda/highlights.scm index 6ff55d2fc..657e657f9 100644 --- a/queries/agda/highlights.scm +++ b/queries/agda/highlights.scm @@ -1,43 +1,52 @@ - -;; Constants +; Constants (integer) @number -;; Variables and Symbols +; Variables and Symbols +(typed_binding + (atom + (qid) @variable)) -(typed_binding (atom (qid) @variable)) (untyped_binding) @variable -(typed_binding (expr) @type) + +(typed_binding + (expr) @type) (id) @function + (bid) @function -(function_name (atom (qid) @function)) -(field_name) @function +(function_name + (atom + (qid) @function)) +(field_name) @function -[(data_name) (record_name)] @constructor +[ + (data_name) + (record_name) +] @constructor ; Set (SetN) @type.builtin -(expr . (atom) @function) +(expr + . + (atom) @function) ((atom) @boolean (#any-of? @boolean "true" "false" "True" "False")) -;; Imports and Module Declarations - -"import" @keyword.import +; Imports and Module Declarations +"import" @keyword.import (module_name) @module -;; Pragmas and comments - +; Pragmas and comments (pragma) @keyword.directive (comment) @comment @spell -;; Keywords +; Keywords [ "where" "data" @@ -62,20 +71,16 @@ "infixl" "infixr" "record" -] -@keyword - -;;;(expr -;;; f_name: (atom) @function) -;; Brackets +] @keyword +;(expr +; f_name: (atom) @function) +; Brackets [ "(" ")" "{" - "}"] -@punctuation.bracket + "}" +] @punctuation.bracket -[ - "=" -] @operator +"=" @operator diff --git a/queries/angular/highlights.scm b/queries/angular/highlights.scm index 42d69c28a..a109dc179 100644 --- a/queries/angular/highlights.scm +++ b/queries/angular/highlights.scm @@ -1,12 +1,19 @@ (identifier) @variable -(pipe_sequence "|" @operator) + +(pipe_sequence + "|" @operator) + (string) @string + (number) @number + (pipe_call name: (identifier) @function) + (pipe_call - arguments: (pipe_arguments - (identifier) @variable.parameter)) + arguments: + (pipe_arguments + (identifier) @variable.parameter)) (structural_assignment operator: (identifier) @keyword) @@ -18,32 +25,34 @@ function: (identifier) @function) (call_expression - function: ((identifier) @function.builtin - (#eq? @function.builtin "$any"))) + function: + ((identifier) @function.builtin + (#eq? @function.builtin "$any"))) [ -"let" -"as" + "let" + "as" ] @keyword [ -"(" -")" -"[" -"]" -"{" -"}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket [ -";" -"." -"," -"?." + ";" + "." + "," + "?." ] @punctuation.delimiter ((identifier) @boolean (#any-of? @boolean "true" "false")) + ((identifier) @variable.builtin (#any-of? @variable.builtin "this" "\$event" "null")) diff --git a/queries/apex/folds.scm b/queries/apex/folds.scm index 0ffc550e9..fdfc2a1ed 100644 --- a/queries/apex/folds.scm +++ b/queries/apex/folds.scm @@ -1,6 +1,6 @@ [ - (class_body) - (constructor_declaration) - (argument_list) - (annotation_argument_list) + (class_body) + (constructor_declaration) + (argument_list) + (annotation_argument_list) ] @fold diff --git a/queries/apex/highlights.scm b/queries/apex/highlights.scm index 692fccb1b..64ff9168c 100644 --- a/queries/apex/highlights.scm +++ b/queries/apex/highlights.scm @@ -1,7 +1,5 @@ ; inherits: soql - -;;; Apex + SOQL - +; Apex + SOQL [ "[" "]" @@ -17,16 +15,14 @@ ":" "?" ";" - ] @punctuation.delimiter - -;; Default general color defination +] @punctuation.delimiter +; Default general color defination (identifier) @variable (type_identifier) @type -;; Methods - +; Methods (method_declaration name: (identifier) @function.method) @@ -35,13 +31,11 @@ (super) @function.builtin -;; Annotations - +; Annotations (annotation name: (identifier) @attribute) -;; Types - +; Types (interface_declaration name: (identifier) @type) @@ -49,7 +43,7 @@ name: (identifier) @type) (class_declaration - (superclass) @type) + (superclass) @type) (enum_declaration name: (identifier) @type) @@ -57,8 +51,11 @@ (enum_constant name: (identifier) @constant) -(type_arguments "<" @punctuation.delimiter) -(type_arguments ">" @punctuation.delimiter) +(type_arguments + "<" @punctuation.delimiter) + +(type_arguments + ">" @punctuation.delimiter) ((field_access object: (identifier) @type)) @@ -68,11 +65,11 @@ ((scoped_identifier scope: (identifier) @type) - (#match? @type "^[A-Z]")) + (#match? @type "^[A-Z]")) ((method_invocation object: (identifier) @type) - (#match? @type "^[A-Z]")) + (#match? @type "^[A-Z]")) (method_declaration (formal_parameters @@ -86,16 +83,21 @@ (assignment_operator) @operator -(update_expression ["++" "--"] @operator) +(update_expression + [ + "++" + "--" + ] @operator) (trigger_declaration name: (identifier) @type object: (identifier) @type (trigger_event) @keyword - ("," (trigger_event) @keyword)*) + ("," + (trigger_event) @keyword)*) [ - "@" + "@" "=" "!=" "<=" @@ -103,35 +105,39 @@ ] @operator (binary_expression - operator: [ - ">" - "<" - "==" - "===" - "!==" - "&&" - "||" - "+" - "-" - "*" - "/" - "&" - "|" - "^" - "%" - "<<" - ">>" - ">>>"] @operator) + operator: + [ + ">" + "<" + "==" + "===" + "!==" + "&&" + "||" + "+" + "-" + "*" + "/" + "&" + "|" + "^" + "%" + "<<" + ">>" + ">>>" + ] @operator) (unary_expression - operator: [ - "+" - "-" - "!" - "~" - ]) @operator + operator: + [ + "+" + "-" + "!" + "~" + ]) @operator -(map_initializer "=>" @operator) +(map_initializer + "=>" @operator) [ (boolean_type) @@ -139,18 +145,27 @@ ] @type.builtin ; Fields - (field_declaration - declarator: (variable_declarator - name: (identifier) @variable.member)) + declarator: + (variable_declarator + name: (identifier) @variable.member)) (field_access field: (identifier) @variable.member) ; Variables - (field_declaration - (modifiers (modifier ["final" "static"])(modifier ["final" "static"])) + (modifiers + (modifier + [ + "final" + "static" + ]) + (modifier + [ + "final" + "static" + ])) (variable_declarator name: (identifier) @constant)) @@ -163,7 +178,6 @@ (this) @variable.builtin ; Literals - [ (int) (decimal) @@ -179,16 +193,15 @@ (null_literal) @constant.builtin -;; ;; Keywords - +; ;; Keywords [ - "abstract" - "final" - "private" - "protected" - "public" - "static" - ] @type.qualifier + "abstract" + "final" + "private" + "protected" + "public" + "static" +] @type.qualifier [ "if" @@ -203,16 +216,14 @@ "break" ] @keyword.repeat -[ - "return" -] @keyword.return +"return" @keyword.return [ - "throw" - "finally" - "try" - "catch" - ] @keyword.exception + "throw" + "finally" + "try" + "catch" +] @keyword.exception "new" @keyword.operator diff --git a/queries/apex/locals.scm b/queries/apex/locals.scm index 5661b911d..d3cbfa73b 100644 --- a/queries/apex/locals.scm +++ b/queries/apex/locals.scm @@ -1,41 +1,46 @@ ; declarations - (class_declaration) @local.scope + (method_declaration) @local.scope + (constructor_declaration) @local.scope + (enum_declaration) @local.scope + (enhanced_for_statement) @local.scope ; if/else - (if_statement) @local.scope + (if_statement consequence: (_) @local.scope) ; if body in case there are no braces + (if_statement alternative: (_) @local.scope) ; else body in case there are no braces ; try/catch - (try_statement) @local.scope ; covers try+catch, individual try and catch are covered by (block) + (catch_clause) @local.scope ; needed because `Exception` variable ; loops - (for_statement) @local.scope -(for_statement ; "for" body in case there are no braces + +(for_statement ; "for" body in case there are no braces body: (_) @local.scope) + (do_statement body: (_) @local.scope) + (while_statement body: (_) @local.scope) ; Functions - (constructor_declaration) @local.scope -(method_declaration) @local.scope -;; definitions +(method_declaration) @local.scope +; definitions (enum_declaration name: (identifier) @local.definition.enum) @@ -43,10 +48,11 @@ name: (identifier) @local.definition.method) (local_variable_declaration - declarator: (variable_declarator - name: (identifier) @local.definition.var)) + declarator: + (variable_declarator + name: (identifier) @local.definition.var)) -(enhanced_for_statement +(enhanced_for_statement name: (identifier) @local.definition.var) (formal_parameter @@ -56,11 +62,11 @@ name: (identifier) @local.definition.parameter) (field_declaration - declarator: (variable_declarator - name: (identifier) @local.definition.field)) - -;; REFERENCES + declarator: + (variable_declarator + name: (identifier) @local.definition.field)) +; REFERENCES (identifier) @local.reference (type_identifier) @local.reference diff --git a/queries/arduino/highlights.scm b/queries/arduino/highlights.scm index a2e121a06..9620f1f73 100644 --- a/queries/arduino/highlights.scm +++ b/queries/arduino/highlights.scm @@ -1,5 +1,4 @@ ; inherits: cpp - ((identifier) @function.builtin ; format-ignore (#any-of? @function.builtin @@ -72,25 +71,10 @@ "noInterrupts")) ((identifier) @type.builtin - (#any-of? @type.builtin - "Serial" - "SPI" - "Stream" - "Wire" - "Keyboard" - "Mouse" - "String" - )) + (#any-of? @type.builtin "Serial" "SPI" "Stream" "Wire" "Keyboard" "Mouse" "String")) ((identifier) @constant.builtin - (#any-of? @constant.builtin - "HIGH" - "LOW" - "INPUT" - "OUTPUT" - "INPUT_PULLUP" - "LED_BUILTIN" - )) + (#any-of? @constant.builtin "HIGH" "LOW" "INPUT" "OUTPUT" "INPUT_PULLUP" "LED_BUILTIN")) (function_definition (function_declarator diff --git a/queries/arduino/injections.scm b/queries/arduino/injections.scm index 6ccfef83f..b637d9b2b 100644 --- a/queries/arduino/injections.scm +++ b/queries/arduino/injections.scm @@ -1,5 +1,5 @@ ((preproc_arg) @injection.content - (#set! injection.language "arduino")) + (#set! injection.language "arduino")) -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/astro/highlights.scm b/queries/astro/highlights.scm index 91ccbffb3..650a489e4 100644 --- a/queries/astro/highlights.scm +++ b/queries/astro/highlights.scm @@ -1,13 +1,20 @@ ; inherits: html +"---" @punctuation.delimiter -[ "---" ] @punctuation.delimiter - -[ "{" "}" ] @punctuation.special +[ + "{" + "}" +] @punctuation.special ; custom components get `@type` highlighting -((start_tag (tag_name) @type) - (#lua-match? @type "^[A-Z]")) -((end_tag (tag_name) @type) - (#lua-match? @type "^[A-Z]")) -((erroneous_end_tag (erroneous_end_tag_name) @type) - (#lua-match? @type "^[A-Z]")) +((start_tag + (tag_name) @type) + (#lua-match? @type "^[A-Z]")) + +((end_tag + (tag_name) @type) + (#lua-match? @type "^[A-Z]")) + +((erroneous_end_tag + (erroneous_end_tag_name) @type) + (#lua-match? @type "^[A-Z]")) diff --git a/queries/astro/injections.scm b/queries/astro/injections.scm index b8f1ccefc..9b1f285db 100644 --- a/queries/astro/injections.scm +++ b/queries/astro/injections.scm @@ -1,5 +1,4 @@ ; inherits: html_tags - (frontmatter (raw_text) @injection.content (#set! injection.language "typescript")) @@ -13,11 +12,12 @@ (#set! injection.language "typescript")) (style_element - (start_tag - (attribute - (attribute_name) @_lang_attr - (quoted_attribute_value (attribute_value) @_lang_value))) - (raw_text) @injection.content - (#eq? @_lang_attr "lang") - (#eq? @_lang_value "scss") - (#set! injection.language "scss")) + (start_tag + (attribute + (attribute_name) @_lang_attr + (quoted_attribute_value + (attribute_value) @_lang_value))) + (raw_text) @injection.content + (#eq? @_lang_attr "lang") + (#eq? @_lang_value "scss") + (#set! injection.language "scss")) diff --git a/queries/authzed/highlights.scm b/queries/authzed/highlights.scm index 7a4b85d1f..2009b78e3 100644 --- a/queries/authzed/highlights.scm +++ b/queries/authzed/highlights.scm @@ -11,7 +11,8 @@ (identifier) @type)) ; relations -(rel_expression (identifier) @property) +(rel_expression + (identifier) @property) (relation (rel_expression @@ -20,16 +21,18 @@ (identifier) @constant)) ; permissions -(perm_expression (identifier) @property) +(perm_expression + (identifier) @property) (call_expression - function: (selector_expression - operand: (identifier) @constant - field: (field_identifier) @function.method)) + function: + (selector_expression + operand: (identifier) @constant + field: (field_identifier) @function.method)) (perm_expression (stabby) @operator - . + . (identifier) @function) ; misc diff --git a/queries/authzed/injections.scm b/queries/authzed/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/authzed/injections.scm +++ b/queries/authzed/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/awk/highlights.scm b/queries/awk/highlights.scm index 6d3b7ff0b..90c9f3437 100644 --- a/queries/awk/highlights.scm +++ b/queries/awk/highlights.scm @@ -1,67 +1,54 @@ ; adapted from https://github.com/Beaglefoot/tree-sitter-awk - [ (identifier) (field_ref) ] @variable -(field_ref (_) @variable) + +(field_ref + (_) @variable) ; https://www.gnu.org/software/gawk/manual/html_node/Auto_002dset.html ((identifier) @constant.builtin - (#any-of? @constant.builtin - "ARGC" - "ARGV" - "ARGIND" - "ENVIRON" - "ERRNO" - "FILENAME" - "FNR" - "NF" - "FUNCTAB" - "NR" - "PROCINFO" - "RLENGTH" - "RSTART" - "RT" - "SYMTAB")) + (#any-of? @constant.builtin "ARGC" "ARGV" "ARGIND" "ENVIRON" "ERRNO" "FILENAME" "FNR" "NF" "FUNCTAB" "NR" "PROCINFO" "RLENGTH" "RSTART" "RT" "SYMTAB")) ; https://www.gnu.org/software/gawk/manual/html_node/User_002dmodified.html ((identifier) @variable.builtin - (#any-of? @variable.builtin - "BINMODE" - "CONVFMT" - "FIELDWIDTHS" - "FPAT" - "FS" - "IGNORECASE" - "LINT" - "OFMT" - "OFS" - "ORS" - "PREC" - "ROUNDMODE" - "RS" - "SUBSEP" - "TEXTDOMAIN")) + (#any-of? @variable.builtin "BINMODE" "CONVFMT" "FIELDWIDTHS" "FPAT" "FS" "IGNORECASE" "LINT" "OFMT" "OFS" "ORS" "PREC" "ROUNDMODE" "RS" "SUBSEP" "TEXTDOMAIN")) (number) @number (string) @string + (regex) @string.regexp + (escape_sequence) @string.escape (comment) @comment @spell -((program . (comment) @keyword.directive) +((program + . + (comment) @keyword.directive) (#lua-match? @keyword.directive "^#!/")) -(ns_qualified_name (namespace) @module) -(ns_qualified_name "::" @punctuation.delimiter) +(ns_qualified_name + (namespace) @module) + +(ns_qualified_name + "::" @punctuation.delimiter) -(func_def name: (_ (identifier) @function) @function) -(func_call name: (_ (identifier) @function) @function) +(func_def + name: + (_ + (identifier) @function) @function) -(func_def (param_list (identifier) @variable.parameter)) +(func_call + name: + (_ + (identifier) @function) @function) + +(func_def + (param_list + (identifier) @variable.parameter)) [ "print" @@ -110,80 +97,95 @@ "@namespace" @keyword.directive [ - "BEGIN" - "END" - "BEGINFILE" - "ENDFILE" + "BEGIN" + "END" + "BEGINFILE" + "ENDFILE" ] @label -(binary_exp [ - "^" - "**" - "*" - "/" - "%" - "+" - "-" - "<" - ">" - "<=" - ">=" - "==" - "!=" - "~" - "!~" - "in" - "&&" - "||" -] @operator) +(binary_exp + [ + "^" + "**" + "*" + "/" + "%" + "+" + "-" + "<" + ">" + "<=" + ">=" + "==" + "!=" + "~" + "!~" + "in" + "&&" + "||" + ] @operator) -(unary_exp [ - "!" - "+" - "-" -] @operator) +(unary_exp + [ + "!" + "+" + "-" + ] @operator) -(assignment_exp [ - "=" - "+=" - "-=" - "*=" - "/=" - "%=" - "^=" -] @operator) +(assignment_exp + [ + "=" + "+=" + "-=" + "*=" + "/=" + "%=" + "^=" + ] @operator) -(ternary_exp [ - "?" - ":" -] @keyword.conditional.ternary) +(ternary_exp + [ + "?" + ":" + ] @keyword.conditional.ternary) -(update_exp [ - "++" - "--" -] @operator) +(update_exp + [ + "++" + "--" + ] @operator) -(redirected_io_statement [ - ">" - ">>" -] @operator) +(redirected_io_statement + [ + ">" + ">>" + ] @operator) -(piped_io_statement [ - "|" - "|&" -] @operator) +(piped_io_statement + [ + "|" + "|&" + ] @operator) -(piped_io_exp [ - "|" - "|&" -] @operator) +(piped_io_exp + [ + "|" + "|&" + ] @operator) -(field_ref "$" @punctuation.delimiter) +(field_ref + "$" @punctuation.delimiter) -(regex "/" @punctuation.delimiter) -(regex_constant "@" @punctuation.delimiter) +(regex + "/" @punctuation.delimiter) -[ ";" "," ] @punctuation.delimiter +(regex_constant + "@" @punctuation.delimiter) + +[ + ";" + "," +] @punctuation.delimiter [ "(" diff --git a/queries/awk/injections.scm b/queries/awk/injections.scm index 24db57d67..3e67da245 100644 --- a/queries/awk/injections.scm +++ b/queries/awk/injections.scm @@ -1,13 +1,17 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((regex) @injection.content - (#set! injection.language "regex")) + (#set! injection.language "regex")) ((print_statement - (exp_list . (string) @injection.content)) - (#set! injection.language "printf")) + (exp_list + . + (string) @injection.content)) + (#set! injection.language "printf")) ((printf_statement - (exp_list . (string) @injection.content)) - (#set! injection.language "printf")) + (exp_list + . + (string) @injection.content)) + (#set! injection.language "printf")) diff --git a/queries/bash/highlights.scm b/queries/bash/highlights.scm index 5820680ef..21346ded8 100644 --- a/queries/bash/highlights.scm +++ b/queries/bash/highlights.scm @@ -1,84 +1,89 @@ [ - "(" ")" - "{" "}" - "[" "]" - "[[" "]]" - "((" "))" + "(" + ")" + "{" + "}" + "[" + "]" + "[[" + "]]" + "((" + "))" ] @punctuation.bracket [ - ";" - ";;" - ";&" - ";;&" - "&" + ";" + ";;" + ";&" + ";;&" + "&" ] @punctuation.delimiter [ - ">" - ">>" - "<" - "<<" - "&&" - "|" - "|&" - "||" - "=" - "+=" - "=~" - "==" - "!=" - - "&>" - "&>>" - "<&" - ">&" - ">|" - "<&-" - ">&-" - - "<<-" - "<<<" - - ".." + ">" + ">>" + "<" + "<<" + "&&" + "|" + "|&" + "||" + "=" + "+=" + "=~" + "==" + "!=" + "&>" + "&>>" + "<&" + ">&" + ">|" + "<&-" + ">&-" + "<<-" + "<<<" + ".." ] @operator ; Do *not* spell check strings since they typically have some sort of ; interpolation in them, or, are typically used for things like filenames, URLs, ; flags and file content. [ - (string) - (raw_string) - (ansi_c_string) - (heredoc_body) + (string) + (raw_string) + (ansi_c_string) + (heredoc_body) ] @string [ - (heredoc_start) - (heredoc_end) + (heredoc_start) + (heredoc_end) ] @label -(variable_assignment (word) @string) -(command argument: "$" @string) ; bare dollar +(variable_assignment + (word) @string) + +(command + argument: "$" @string) ; bare dollar [ - "if" - "then" - "else" - "elif" - "fi" - "case" - "in" - "esac" + "if" + "then" + "else" + "elif" + "fi" + "case" + "in" + "esac" ] @keyword.conditional [ - "for" - "do" - "done" - "select" - "until" - "while" + "for" + "do" + "done" + "select" + "until" + "while" ] @keyword.repeat [ @@ -97,36 +102,54 @@ ; trap -l ((word) @constant.builtin - (#match? @constant.builtin "^SIG(HUP|INT|QUIT|ILL|TRAP|ABRT|BUS|FPE|KILL|USR[12]|SEGV|PIPE|ALRM|TERM|STKFLT|CHLD|CONT|STOP|TSTP|TT(IN|OU)|URG|XCPU|XFSZ|VTALRM|PROF|WINCH|IO|PWR|SYS|RTMIN([+]([1-9]|1[0-5]))?|RTMAX(-([1-9]|1[0-4]))?)$")) + (#match? @constant.builtin "^SIG(HUP|INT|QUIT|ILL|TRAP|ABRT|BUS|FPE|KILL|USR[12]|SEGV|PIPE|ALRM|TERM|STKFLT|CHLD|CONT|STOP|TSTP|TT(IN|OU)|URG|XCPU|XFSZ|VTALRM|PROF|WINCH|IO|PWR|SYS|RTMIN([+]([1-9]|1[0-5]))?|RTMAX(-([1-9]|1[0-4]))?)$")) ((word) @boolean - (#any-of? @boolean "true" "false")) + (#any-of? @boolean "true" "false")) (comment) @comment @spell (test_operator) @operator -(command_substitution "$(" @punctuation.bracket) -(process_substitution "<(" @punctuation.bracket) +(command_substitution + "$(" @punctuation.bracket) + +(process_substitution + "<(" @punctuation.bracket) (arithmetic_expansion - [ "$((" "((" ] @punctuation.special + [ + "$((" + "((" + ] @punctuation.special "))" @punctuation.special) -(arithmetic_expansion "," @punctuation.delimiter) +(arithmetic_expansion + "," @punctuation.delimiter) + +(ternary_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) + +(binary_expression + operator: _ @operator) -(ternary_expression [ "?" ":" ] @keyword.conditional.ternary) +(unary_expression + operator: _ @operator) -(binary_expression operator: _ @operator) -(unary_expression operator: _ @operator) -(postfix_expression operator: _ @operator) +(postfix_expression + operator: _ @operator) (function_definition name: (word) @function) -(command_name (word) @function.call) +(command_name + (word) @function.call) -((command_name (word) @function.builtin) +((command_name + (word) @function.builtin) ; format-ignore (#any-of? @function.builtin "alias" "bg" "bind" "break" "builtin" "caller" "cd" @@ -140,14 +163,17 @@ "ulimit" "umask" "unalias" "wait")) (command - argument: [ - (word) @variable.parameter - (concatenation (word) @variable.parameter) - ]) + argument: + [ + (word) @variable.parameter + (concatenation + (word) @variable.parameter) + ]) (number) @number + ((word) @number - (#lua-match? @number "^[0-9]+$")) + (#lua-match? @number "^[0-9]+$")) (file_redirect destination: (word) @variable.parameter) @@ -156,24 +182,30 @@ (simple_expansion "$" @punctuation.special) @none + (expansion "${" @punctuation.special "}" @punctuation.special) @none -(expansion operator: _ @punctuation.special) -(expansion "@" . operator: _ @character.special) +(expansion + operator: _ @punctuation.special) + +(expansion + "@" + . + operator: _ @character.special) ((expansion (subscript index: (word) @character.special)) - (#any-of? @character.special "@" "*")) + (#any-of? @character.special "@" "*")) "``" @punctuation.special (variable_name) @variable ((variable_name) @constant - (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) + (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) (case_item value: (word) @variable.parameter) @@ -183,5 +215,7 @@ (extglob_pattern) ] @string.regexp -((program . (comment) @keyword.directive) - (#lua-match? @keyword.directive "^#!/")) +((program + . + (comment) @keyword.directive) + (#lua-match? @keyword.directive "^#!/")) diff --git a/queries/bash/injections.scm b/queries/bash/injections.scm index 516df3b3d..83bb6359e 100644 --- a/queries/bash/injections.scm +++ b/queries/bash/injections.scm @@ -1,35 +1,52 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) ((regex) @injection.content - (#set! injection.language "regex")) + (#set! injection.language "regex")) ((heredoc_redirect (heredoc_body) @injection.content (heredoc_end) @injection.language) - (#downcase! @injection.language)) + (#downcase! @injection.language)) ; printf 'format' ((command name: (command_name) @_command - . argument: [(string) (raw_string)] @injection.content) - (#eq? @_command "printf") - (#set! injection.language "printf")) + . + argument: + [ + (string) + (raw_string) + ] @injection.content) + (#eq? @_command "printf") + (#set! injection.language "printf")) ; printf -v var 'format' ((command name: (command_name) @_command argument: (word) @_arg - . (_) . argument: [(string) (raw_string)] @injection.content) - (#eq? @_command "printf") - (#eq? @_arg "-v") - (#set! injection.language "printf")) + . + (_) + . + argument: + [ + (string) + (raw_string) + ] @injection.content) + (#eq? @_command "printf") + (#eq? @_arg "-v") + (#set! injection.language "printf")) ; printf -- 'format' ((command name: (command_name) @_command argument: (word) @_arg - . argument: [(string) (raw_string)] @injection.content) - (#eq? @_command "printf") - (#eq? @_arg "--") - (#set! injection.language "printf")) + . + argument: + [ + (string) + (raw_string) + ] @injection.content) + (#eq? @_command "printf") + (#eq? @_arg "--") + (#set! injection.language "printf")) diff --git a/queries/bash/locals.scm b/queries/bash/locals.scm index 2b9cfec70..347f51fa2 100644 --- a/queries/bash/locals.scm +++ b/queries/bash/locals.scm @@ -2,7 +2,7 @@ (function_definition) @local.scope ; Definitions -(variable_assignment +(variable_assignment name: (variable_name) @local.definition.var) (function_definition @@ -10,4 +10,5 @@ ; References (variable_name) @local.reference + (word) @local.reference diff --git a/queries/bass/highlights.scm b/queries/bass/highlights.scm index 3a16cbb34..8a92a59e9 100644 --- a/queries/bass/highlights.scm +++ b/queries/bass/highlights.scm @@ -1,54 +1,56 @@ -;; Variables +; Variables +(list + (symbol) @variable) -(list (symbol) @variable) +(cons + (symbol) @variable) -(cons (symbol) @variable) +(scope + (symbol) @variable) -(scope (symbol) @variable) - -(symbind (symbol) @variable) - -;; Constants +(symbind + (symbol) @variable) +; Constants ((symbol) @constant (#lua-match? @constant "^_*[A-Z][A-Z0-9_]*$")) -;; Functions - -(list - . (symbol) @function) - -;; Namespaces +; Functions +(list + . + (symbol) @function) +; Namespaces (symbind (symbol) @module - . (keyword)) - -;; Includes + . + (keyword)) +; Includes ((symbol) @keyword.import (#any-of? @keyword.import "use" "import" "load")) -;; Keywords - +; Keywords ((symbol) @keyword (#any-of? @keyword "do" "doc")) -;; Special Functions - +; Special Functions ; Keywords construct a symbol - (keyword) @constructor ((list - . (symbol) @keyword.function - . (symbol) @function + . + (symbol) @keyword.function + . + (symbol) @function (symbol)? @variable.parameter) (#any-of? @keyword.function "def" "defop" "defn" "fn")) ((cons - . (symbol) @keyword.function - . (symbol) @function + . + (symbol) @keyword.function + . + (symbol) @function (symbol)? @variable.parameter) (#any-of? @keyword.function "def" "defop" "defn" "fn")) @@ -58,33 +60,38 @@ ((symbol) @function.macro (#any-of? @function.macro "op" "current-scope" "quote" "let" "provide" "module" "or" "and" "curryfn" "for" "$" "linux")) -;; Conditionals - +; Conditionals ((symbol) @keyword.conditional (#any-of? @keyword.conditional "if" "case" "cond" "when")) -;; Repeats - +; Repeats ((symbol) @keyword.repeat (#any-of? @keyword.repeat "each")) -;; Operators - -((symbol) @operator (#any-of? @operator "&" "*" "+" "-" "<" "<=" "=" ">" ">=")) - -;; Punctuation +; Operators +((symbol) @operator + (#any-of? @operator "&" "*" "+" "-" "<" "<=" "=" ">" ">=")) -[ "(" ")" ] @punctuation.bracket +; Punctuation +[ + "(" + ")" +] @punctuation.bracket -[ "{" "}" ] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket ((symbol) @punctuation.delimiter (#eq? @punctuation.delimiter "->")) -;; Literals - +; Literals (string) @string (escape_sequence) @string.escape @@ -100,10 +107,7 @@ (null) ] @constant.builtin -[ - "^" -] @character.special - -;; Comments +"^" @character.special +; Comments (comment) @comment @spell diff --git a/queries/bass/indents.scm b/queries/bass/indents.scm index 60c5df4eb..27b976f21 100644 --- a/queries/bass/indents.scm +++ b/queries/bass/indents.scm @@ -10,11 +10,20 @@ "]" ] @indent.end -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch [ (ERROR) diff --git a/queries/bass/injections.scm b/queries/bass/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/bass/injections.scm +++ b/queries/bass/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/bass/locals.scm b/queries/bass/locals.scm index c28a78dd5..daed7e5e1 100644 --- a/queries/bass/locals.scm +++ b/queries/bass/locals.scm @@ -1,5 +1,4 @@ ; Scopes - [ (list) (scope) @@ -7,19 +6,21 @@ ] @local.scope ; References - (symbol) @local.reference ; Definitions - ((list - . (symbol) @_fnkw - . (symbol) @local.definition.function + . + (symbol) @_fnkw + . + (symbol) @local.definition.function (symbol)? @local.definition.parameter) (#any-of? @_fnkw "def" "defop" "defn" "fn")) ((cons - . (symbol) @_fnkw - . (symbol) @local.definition.function + . + (symbol) @_fnkw + . + (symbol) @local.definition.function (symbol)? @local.definition.parameter) (#any-of? @_fnkw "def" "defop" "defn" "fn")) diff --git a/queries/beancount/folds.scm b/queries/beancount/folds.scm index ffe319500..9f1b6cbed 100644 --- a/queries/beancount/folds.scm +++ b/queries/beancount/folds.scm @@ -1,4 +1,4 @@ [ - (transaction) - (section) + (transaction) + (section) ] @fold diff --git a/queries/beancount/highlights.scm b/queries/beancount/highlights.scm index 191dc519e..1e23d28f4 100644 --- a/queries/beancount/highlights.scm +++ b/queries/beancount/highlights.scm @@ -1,24 +1,57 @@ (date) @variable.member + (txn) @attribute + (account) @type + (amount) @number + (incomplete_amount) @number + (compound_amount) @number + (amount_tolerance) @number + (currency) @property + (key) @label + (string) @string + (narration) @string @spell + (payee) @string @spell + (tag) @constant + (link) @constant + [ - (minus) (plus) (slash) (asterisk) + (minus) + (plus) + (slash) + (asterisk) ] @operator + (comment) @comment @spell + [ - (balance) (open) (close) (commodity) (pad) - (event) (price) (note) (document) (query) - (custom) (pushtag) (poptag) (pushmeta) - (popmeta) (option) (include) (plugin) + (balance) + (open) + (close) + (commodity) + (pad) + (event) + (price) + (note) + (document) + (query) + (custom) + (pushtag) + (poptag) + (pushmeta) + (popmeta) + (option) + (include) + (plugin) ] @keyword diff --git a/queries/bibtex/folds.scm b/queries/bibtex/folds.scm index 3b24d5fea..321a045c9 100644 --- a/queries/bibtex/folds.scm +++ b/queries/bibtex/folds.scm @@ -1,3 +1 @@ -[ - (entry) -] @fold +(entry) @fold diff --git a/queries/bibtex/highlights.scm b/queries/bibtex/highlights.scm index 602ed5d27..a82b371ae 100644 --- a/queries/bibtex/highlights.scm +++ b/queries/bibtex/highlights.scm @@ -1,5 +1,4 @@ ; CREDITS @pfoerster (adapted from https://github.com/latex-lsp/tree-sitter-bibtex) - [ (string_type) (preamble_type) diff --git a/queries/bibtex/indents.scm b/queries/bibtex/indents.scm index 1ba3e6b47..764172a76 100644 --- a/queries/bibtex/indents.scm +++ b/queries/bibtex/indents.scm @@ -1,10 +1,8 @@ -[ - (entry) -] @indent.begin +(entry) @indent.begin [ - "{" - "}" + "{" + "}" ] @indent.branch (comment) @indent.ignore diff --git a/queries/bicep/folds.scm b/queries/bicep/folds.scm index 8ec5ba200..217a86d6a 100644 --- a/queries/bicep/folds.scm +++ b/queries/bicep/folds.scm @@ -6,20 +6,14 @@ (resource_declaration) (type_declaration) (variable_declaration) - (parenthesized_expression) - (decorators) (array) (object) - (if_statement) (for_statement) - (subscript_expression) (ternary_expression) - (string) - (comment) ] @fold diff --git a/queries/bicep/highlights.scm b/queries/bicep/highlights.scm index ae691c76b..0045f8b8c 100644 --- a/queries/bicep/highlights.scm +++ b/queries/bicep/highlights.scm @@ -1,5 +1,4 @@ ; Includes - (import_statement "import" @keyword.import) @@ -8,12 +7,10 @@ "with" @keyword.import) ; Namespaces - (module_declaration (identifier) @module) ; Builtins - (primitive_type) @type.builtin ((member_expression @@ -21,12 +18,10 @@ (#eq? @type.builtin "sys")) ; Functions - (call_expression function: (identifier) @function.call) ; Properties - (object_property (identifier) @property ":" @punctuation.delimiter @@ -40,21 +35,20 @@ (property_identifier) @property ; Attributes - (decorator "@" @attribute) (decorator - (call_expression (identifier) @attribute)) + (call_expression + (identifier) @attribute)) (decorator (call_expression (member_expression - object: (identifier) @attribute - property: (property_identifier) @attribute))) + object: (identifier) @attribute + property: (property_identifier) @attribute))) ; Types - (type_declaration (identifier) @type) @@ -66,7 +60,8 @@ (type_declaration (identifier) "=" - (array_type (identifier) @type)) + (array_type + (identifier) @type)) (type (identifier) @type) @@ -78,21 +73,22 @@ (identifier) @type) ; Parameters - (parameter_declaration (identifier) @variable.parameter (_)) (call_expression - function: (_) - (arguments (identifier) @variable.parameter)) + function: (_) + (arguments + (identifier) @variable.parameter)) (call_expression - function: (_) - (arguments (member_expression object: (identifier) @variable.parameter))) + function: (_) + (arguments + (member_expression + object: (identifier) @variable.parameter))) ; Variables - (variable_declaration (identifier) @variable (_)) @@ -117,7 +113,6 @@ (loop_enumerator) @variable)) ; Conditionals - "if" @keyword.conditional (ternary_expression @@ -125,14 +120,12 @@ ":" @keyword.conditional.ternary) ; Loops - (for_statement "for" @keyword.repeat "in" ":" @punctuation.delimiter) ; Keywords - [ "module" "metadata" @@ -146,7 +139,6 @@ ] @keyword ; Operators - [ "+" "-" @@ -169,14 +161,11 @@ "!" ] @operator -[ - "in" -] @keyword.operator - +"in" @keyword.operator ; Literals - (string) @string + (import_string "'" @string (import_name) @module @@ -192,17 +181,25 @@ (null) @constant.builtin ; Misc - (compatible_identifier "?" @punctuation.special) (nullable_return_type) @punctuation.special -["{" "}"] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -["[" "]"] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -["(" ")"] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket [ "." @@ -210,9 +207,7 @@ "=>" ] @punctuation.delimiter - ; Interpolation - (interpolation) @none (interpolation @@ -223,7 +218,6 @@ (identifier) @variable) ; Comments - [ (comment) (diagnostic_comment) diff --git a/queries/bicep/indents.scm b/queries/bicep/indents.scm index cf2e6e1c2..055e51b23 100644 --- a/queries/bicep/indents.scm +++ b/queries/bicep/indents.scm @@ -5,11 +5,20 @@ "}" @indent.end -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch [ (ERROR) diff --git a/queries/bicep/injections.scm b/queries/bicep/injections.scm index d3ff30b60..5c2d4a57b 100644 --- a/queries/bicep/injections.scm +++ b/queries/bicep/injections.scm @@ -1,5 +1,5 @@ ([ (comment) (diagnostic_comment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) diff --git a/queries/bicep/locals.scm b/queries/bicep/locals.scm index c28987051..137753ae2 100644 --- a/queries/bicep/locals.scm +++ b/queries/bicep/locals.scm @@ -1,22 +1,17 @@ ; Scopes - [ (infrastructure) (call_expression) - (lambda_expression) (subscript_expression) - (if_statement) (for_statement) - (array) (object) (interpolation) ] @local.scope ; References - (property_identifier) @local.reference (call_expression @@ -31,7 +26,6 @@ (identifier) @local.reference) ; Definitions - (type) @local.definition.associated (object_property diff --git a/queries/bitbake/folds.scm b/queries/bitbake/folds.scm index 9fc865e84..85d226348 100644 --- a/queries/bitbake/folds.scm +++ b/queries/bitbake/folds.scm @@ -2,28 +2,23 @@ (function_definition) (anonymous_python_function) (python_function_definition) - (while_statement) (for_statement) (if_statement) (with_statement) (try_statement) - (import_from_statement) (parameters) (argument_list) - (parenthesized_expression) (generator_expression) (list_comprehension) (set_comprehension) (dictionary_comprehension) - (tuple) (list) (set) (dictionary) - (string) (python_string) ] @fold diff --git a/queries/bitbake/highlights.scm b/queries/bitbake/highlights.scm index eafe60b4d..e555e40d7 100644 --- a/queries/bitbake/highlights.scm +++ b/queries/bitbake/highlights.scm @@ -1,5 +1,4 @@ ; Includes - [ "inherit" "include" @@ -9,12 +8,10 @@ ] @keyword.import ; Keywords - [ "unset" "EXPORT_FUNCTIONS" "python" - "assert" "exec" "global" @@ -34,19 +31,34 @@ "return" "yield" ] @keyword.return -(yield "from" @keyword.return) + +(yield + "from" @keyword.return) (future_import_statement "from" @keyword.import "__future__" @constant.builtin) -(import_from_statement "from" @keyword.import) + +(import_from_statement + "from" @keyword.import) + "import" @keyword.import -(aliased_import "as" @keyword.import) +(aliased_import + "as" @keyword.import) -["if" "elif" "else"] @keyword.conditional +[ + "if" + "elif" + "else" +] @keyword.conditional -["for" "while" "break" "continue"] @keyword.repeat +[ + "for" + "while" + "break" + "continue" +] @keyword.repeat [ "try" @@ -56,7 +68,8 @@ "finally" ] @keyword.exception -(raise_statement "from" @keyword.exception) +(raise_statement + "from" @keyword.exception) (try_statement (else_clause @@ -82,7 +95,6 @@ ] @type.qualifier ; Variables - [ (identifier) (python_identifier) @@ -99,14 +111,18 @@ ; Reset highlighting in f-string interpolations (interpolation) @none -;; Identifier naming conventions +; Identifier naming conventions ((python_identifier) @type - (#lua-match? @type "^[A-Z].*[a-z]")) -([(identifier) (python_identifier)] @constant - (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) + (#lua-match? @type "^[A-Z].*[a-z]")) + +([ + (identifier) + (python_identifier) +] @constant + (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) ((python_identifier) @constant.builtin - (#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$")) + (#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$")) ((python_identifier) @constant.builtin ; format-ignore @@ -117,128 +133,149 @@ ((assignment left: (python_identifier) @type.definition - (type (python_identifier) @_annotation)) - (#eq? @_annotation "TypeAlias")) + (type + (python_identifier) @_annotation)) + (#eq? @_annotation "TypeAlias")) ((assignment left: (python_identifier) @type.definition - right: (call - function: (python_identifier) @_func)) - (#any-of? @_func "TypeVar" "NewType")) + right: + (call + function: (python_identifier) @_func)) + (#any-of? @_func "TypeVar" "NewType")) ; Fields - (flag) @variable.member ((attribute - attribute: (python_identifier) @variable.member) - (#lua-match? @variable.member "^[%l_].*$")) + attribute: (python_identifier) @variable.member) + (#lua-match? @variable.member "^[%l_].*$")) ; Functions - (call function: (python_identifier) @function.call) (call - function: (attribute - attribute: (python_identifier) @function.method.call)) + function: + (attribute + attribute: (python_identifier) @function.method.call)) ((call - function: (python_identifier) @constructor) - (#lua-match? @constructor "^%u")) + function: (python_identifier) @constructor) + (#lua-match? @constructor "^%u")) ((call - function: (attribute - attribute: (python_identifier) @constructor)) - (#lua-match? @constructor "^%u")) + function: + (attribute + attribute: (python_identifier) @constructor)) + (#lua-match? @constructor "^%u")) ((call function: (python_identifier) @function.builtin) - (#any-of? @function.builtin - "abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr" "classmethod" - "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec" "filter" "float" "format" - "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id" "input" "int" "isinstance" "issubclass" - "iter" "len" "list" "locals" "map" "max" "memoryview" "min" "next" "object" "oct" "open" "ord" "pow" - "print" "property" "range" "repr" "reversed" "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" - "sum" "super" "tuple" "type" "vars" "zip" "__import__")) + (#any-of? @function.builtin "abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr" "classmethod" "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec" "filter" "float" "format" "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id" "input" "int" "isinstance" "issubclass" "iter" "len" "list" "locals" "map" "max" "memoryview" "min" "next" "object" "oct" "open" "ord" "pow" "print" "property" "range" "repr" "reversed" "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type" "vars" "zip" "__import__")) (python_function_definition name: (python_identifier) @function) -(type (python_identifier) @type) +(type + (python_identifier) @type) + (type (subscript (python_identifier) @type)) ; type subscript: Tuple[int] ((call function: (python_identifier) @_isinstance - arguments: (argument_list - (_) - (python_identifier) @type)) - (#eq? @_isinstance "isinstance")) + arguments: + (argument_list + (_) + (python_identifier) @type)) + (#eq? @_isinstance "isinstance")) -(anonymous_python_function (identifier) @function) +(anonymous_python_function + (identifier) @function) -(function_definition (identifier) @function) +(function_definition + (identifier) @function) -(addtask_statement (identifier) @function) +(addtask_statement + (identifier) @function) -(deltask_statement (identifier) @function) +(deltask_statement + (identifier) @function) -(export_functions_statement (identifier) @function) +(export_functions_statement + (identifier) @function) -(addhandler_statement (identifier) @function) +(addhandler_statement + (identifier) @function) (python_function_definition body: (block - . (expression_statement (python_string) @string.documentation @spell))) + . + (expression_statement + (python_string) @string.documentation @spell))) ; Namespace - (inherit_path) @module -;; Normal parameters +; Normal parameters (parameters (python_identifier) @variable.parameter) -;; Lambda parameters + +; Lambda parameters (lambda_parameters (python_identifier) @variable.parameter) + (lambda_parameters (tuple_pattern (python_identifier) @variable.parameter)) + ; Default parameters (keyword_argument name: (python_identifier) @variable.parameter) + ; Naming parameters on call-site (default_parameter name: (python_identifier) @variable.parameter) + (typed_parameter (python_identifier) @variable.parameter) + (typed_default_parameter (python_identifier) @variable.parameter) + ; Variadic parameters *args, **kwargs (parameters - (list_splat_pattern ; *args + (list_splat_pattern + ; *args (python_identifier) @variable.parameter)) + (parameters - (dictionary_splat_pattern ; **kwargs + (dictionary_splat_pattern + ; **kwargs (python_identifier) @variable.parameter)) -;; Literals - +; Literals (none) @constant.builtin -[(true) (false)] @boolean + +[ + (true) + (false) +] @boolean + ((python_identifier) @variable.builtin - (#eq? @variable.builtin "self")) + (#eq? @variable.builtin "self")) + ((python_identifier) @variable.builtin - (#eq? @variable.builtin "cls")) + (#eq? @variable.builtin "cls")) (integer) @number + (float) @number.float ; Operators - [ "?=" "??=" @@ -293,12 +330,10 @@ "or" "is not" "not in" - "del" ] @keyword.operator ; Literals - [ (string) (python_string) @@ -313,8 +348,14 @@ ] @string.escape ; Punctuation - -[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket [ ":" @@ -325,15 +366,28 @@ (ellipsis) ] @punctuation.delimiter -(variable_expansion [ "${" "}" ] @punctuation.special) -(inline_python [ "${@" "}" ] @punctuation.special) +(variable_expansion + [ + "${" + "}" + ] @punctuation.special) + +(inline_python + [ + "${@" + "}" + ] @punctuation.special) + (interpolation "{" @punctuation.special "}" @punctuation.special) (type_conversion) @function.macro -([(identifier) (python_identifier)] @type.builtin +([ + (identifier) + (python_identifier) +] @type.builtin ; format-ignore (#any-of? @type.builtin ; https://docs.python.org/3/library/exceptions.html diff --git a/queries/bitbake/indents.scm b/queries/bitbake/indents.scm index 01d8aeb3c..ee60d0fda 100644 --- a/queries/bitbake/indents.scm +++ b/queries/bitbake/indents.scm @@ -1,76 +1,101 @@ [ (import_from_statement) - (parenthesized_expression) (generator_expression) (list_comprehension) (set_comprehension) (dictionary_comprehension) - (tuple_pattern) (list_pattern) (binary_operator) - (lambda) - (concatenated_string) ] @indent.begin ((list) @indent.align - (#set! indent.open_delimiter "[") - (#set! indent.close_delimiter "]") -) + (#set! indent.open_delimiter "[") + (#set! indent.close_delimiter "]")) + ((dictionary) @indent.align - (#set! indent.open_delimiter "{") - (#set! indent.close_delimiter "}") -) + (#set! indent.open_delimiter "{") + (#set! indent.close_delimiter "}")) + ((set) @indent.align - (#set! indent.open_delimiter "{") - (#set! indent.close_delimiter "}") -) + (#set! indent.open_delimiter "{") + (#set! indent.close_delimiter "}")) ((for_statement) @indent.begin - (#set! indent.immediate 1)) + (#set! indent.immediate 1)) + ((if_statement) @indent.begin - (#set! indent.immediate 1)) + (#set! indent.immediate 1)) + ((while_statement) @indent.begin - (#set! indent.immediate 1)) + (#set! indent.immediate 1)) + ((try_statement) @indent.begin - (#set! indent.immediate 1)) -(ERROR "try" ":" @indent.begin (#set! indent.immediate 1)) + (#set! indent.immediate 1)) + +(ERROR + "try" + ":" @indent.begin + (#set! indent.immediate 1)) + ((python_function_definition) @indent.begin - (#set! indent.immediate 1)) + (#set! indent.immediate 1)) + (function_definition) @indent.begin + (anonymous_python_function) @indent.begin + ((with_statement) @indent.begin - (#set! indent.immediate 1)) + (#set! indent.immediate 1)) (if_statement condition: (parenthesized_expression) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")") (#set! indent.avoid_last_matching_next 1)) + (while_statement condition: (parenthesized_expression) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")") (#set! indent.avoid_last_matching_next 1)) -(ERROR "(" @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")") . (_)) +(ERROR + "(" @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")") + . + (_)) + ((argument_list) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) + ((parameters) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")") - (#set! indent.avoid_last_matching_next 1)) + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")") + (#set! indent.avoid_last_matching_next 1)) + ((tuple) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) -(ERROR "[" @indent.align (#set! indent.open_delimiter "[") (#set! indent.close_delimiter "]") . (_)) +(ERROR + "[" @indent.align + (#set! indent.open_delimiter "[") + (#set! indent.close_delimiter "]") + . + (_)) -(ERROR "{" @indent.align (#set! indent.open_delimiter "{") (#set! indent.close_delimiter "}") . (_)) +(ERROR + "{" @indent.align + (#set! indent.open_delimiter "{") + (#set! indent.close_delimiter "}") + . + (_)) [ (break_statement) @@ -78,24 +103,43 @@ ] @indent.dedent (ERROR - (_) @indent.branch ":" . + (_) @indent.branch + ":" + . (#lua-match? @indent.branch "^else")) (ERROR - (_) @indent.branch @indent.dedent ":" . + (_) @indent.branch @indent.dedent + ":" + . (#lua-match? @indent.branch "^elif")) -(parenthesized_expression ")" @indent.end) -(generator_expression ")" @indent.end) -(list_comprehension "]" @indent.end) -(set_comprehension "}" @indent.end) -(dictionary_comprehension "}" @indent.end) +(parenthesized_expression + ")" @indent.end) + +(generator_expression + ")" @indent.end) + +(list_comprehension + "]" @indent.end) + +(set_comprehension + "}" @indent.end) + +(dictionary_comprehension + "}" @indent.end) + +(tuple_pattern + ")" @indent.end) + +(list_pattern + "]" @indent.end) -(tuple_pattern ")" @indent.end) -(list_pattern "]" @indent.end) +(function_definition + "}" @indent.end) -(function_definition "}" @indent.end) -(anonymous_python_function "}" @indent.end) +(anonymous_python_function + "}" @indent.end) (return_statement [ @@ -107,10 +151,12 @@ "}" "]" ] @indent.end .) - (attribute + (attribute attribute: (_) @indent.end) (call - arguments: (_ ")" @indent.end)) + arguments: + (_ + ")" @indent.end)) "return" @indent.end ] .) diff --git a/queries/bitbake/injections.scm b/queries/bitbake/injections.scm index 819487bc5..39182e838 100644 --- a/queries/bitbake/injections.scm +++ b/queries/bitbake/injections.scm @@ -1,8 +1,11 @@ (call - function: (attribute - object: (python_identifier) @_re) - arguments: (argument_list (python_string - (string_content) @injection.content) @_string) + function: + (attribute + object: (python_identifier) @_re) + arguments: + (argument_list + (python_string + (string_content) @injection.content) @_string) (#eq? @_re "re") (#lua-match? @_string "^r.*") (#set! injection.language "regex")) @@ -11,4 +14,4 @@ (#set! injection.language "bash")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/bitbake/locals.scm b/queries/bitbake/locals.scm index 27e85f02a..0f572584b 100644 --- a/queries/bitbake/locals.scm +++ b/queries/bitbake/locals.scm @@ -7,10 +7,16 @@ ; Imports (aliased_import alias: (python_identifier) @local.definition.import) + (import_statement - name: (dotted_name ((python_identifier) @local.definition.import))) + name: + (dotted_name + ((python_identifier) @local.definition.import))) + (import_from_statement - name: (dotted_name ((python_identifier) @local.definition.import))) + name: + (dotted_name + ((python_identifier) @local.definition.import))) ; Function with parameters, defines parameters (parameters @@ -38,58 +44,80 @@ ; Function defines function and scope ((python_function_definition name: (python_identifier) @local.definition.function) @local.scope - (#set! definition.function.scope "parent")) + (#set! definition.function.scope "parent")) -(function_definition (identifier) @local.definition.function) +(function_definition + (identifier) @local.definition.function) -(anonymous_python_function (identifier) @local.definition.function) +(anonymous_python_function + (identifier) @local.definition.function) -;;; Loops +; Loops ; not a scope! (for_statement - left: (pattern_list - (python_identifier) @local.definition.var)) + left: + (pattern_list + (python_identifier) @local.definition.var)) + (for_statement - left: (tuple_pattern - (python_identifier) @local.definition.var)) + left: + (tuple_pattern + (python_identifier) @local.definition.var)) + (for_statement left: (python_identifier) @local.definition.var) ; not a scope! ;(while_statement) @local.scope - ; for in list comprehension (for_in_clause left: (python_identifier) @local.definition.var) + (for_in_clause - left: (tuple_pattern - (python_identifier) @local.definition.var)) + left: + (tuple_pattern + (python_identifier) @local.definition.var)) + (for_in_clause - left: (pattern_list - (python_identifier) @local.definition.var)) + left: + (pattern_list + (python_identifier) @local.definition.var)) (dictionary_comprehension) @local.scope + (list_comprehension) @local.scope -(set_comprehension) @local.scope -;;; Assignments +(set_comprehension) @local.scope +; Assignments (assignment - left: (python_identifier) @local.definition.var) + left: (python_identifier) @local.definition.var) (assignment - left: (pattern_list - (python_identifier) @local.definition.var)) + left: + (pattern_list + (python_identifier) @local.definition.var)) + (assignment - left: (tuple_pattern - (python_identifier) @local.definition.var)) + left: + (tuple_pattern + (python_identifier) @local.definition.var)) (assignment - left: (attribute - (python_identifier) - (python_identifier) @local.definition.field)) + left: + (attribute + (python_identifier) + (python_identifier) @local.definition.field)) -(variable_assignment (identifier) operator: [ "=" "?=" "??=" ":=" ] @local.definition.var) +(variable_assignment + (identifier) + operator: + [ + "=" + "?=" + "??=" + ":=" + ] @local.definition.var) ; Walrus operator x := 1 (named_expression diff --git a/queries/blueprint/highlights.scm b/queries/blueprint/highlights.scm index 3e3a8e4a8..faefd319d 100644 --- a/queries/blueprint/highlights.scm +++ b/queries/blueprint/highlights.scm @@ -1,6 +1,7 @@ (object_id) @variable (string) @string + (escape_sequence) @string.escape (comment) @comment @spell @@ -15,30 +16,50 @@ (decorator) @attribute -(property_definition (property_name) @property) +(property_definition + (property_name) @property) (object) @type -(signal_binding (signal_name) @function.builtin) -(signal_binding (function (identifier)) @function) -(signal_binding "swapped" @keyword) +(signal_binding + (signal_name) @function.builtin) + +(signal_binding + (function + (identifier)) @function) + +(signal_binding + "swapped" @keyword) + +(styles_list + "styles" @function.macro) -(styles_list "styles" @function.macro) -(layout_definition "layout" @function.macro) +(layout_definition + "layout" @function.macro) -(gettext_string "_" @function.builtin) +(gettext_string + "_" @function.builtin) -(menu_definition "menu" @keyword) -(menu_section "section" @keyword) -(menu_item "item" @function.macro) +(menu_definition + "menu" @keyword) -(template_definition (template_name_qualifier) @type.qualifier) +(menu_section + "section" @keyword) -(import_statement (gobject_library) @module) +(menu_item + "item" @function.macro) -(import_statement (version_number) @number.float) +(template_definition + (template_name_qualifier) @type.qualifier) + +(import_statement + (gobject_library) @module) + +(import_statement + (version_number) @number.float) (float) @number.float + (number) @number [ diff --git a/queries/c/folds.scm b/queries/c/folds.scm index 42ca3fb63..2e2a6b4d0 100644 --- a/queries/c/folds.scm +++ b/queries/c/folds.scm @@ -1,21 +1,21 @@ [ - (for_statement) - (if_statement) - (while_statement) - (do_statement) - (switch_statement) - (case_statement) - (function_definition) - (struct_specifier) - (enum_specifier) - (comment) - (preproc_if) - (preproc_elif) - (preproc_else) - (preproc_ifdef) - (preproc_function_def) - (initializer_list) - (gnu_asm_expression) + (for_statement) + (if_statement) + (while_statement) + (do_statement) + (switch_statement) + (case_statement) + (function_definition) + (struct_specifier) + (enum_specifier) + (comment) + (preproc_if) + (preproc_elif) + (preproc_else) + (preproc_ifdef) + (preproc_function_def) + (initializer_list) + (gnu_asm_expression) ] @fold (compound_statement diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm index 0a6145e3e..c848f68dc 100644 --- a/queries/c/highlights.scm +++ b/queries/c/highlights.scm @@ -1,6 +1,9 @@ ; Lower priority to prefer @variable.parameter when identifier appears in parameter_declaration. -((identifier) @variable (#set! "priority" 95)) -(preproc_def (preproc_arg) @variable) +((identifier) @variable + (#set! "priority" 95)) + +(preproc_def + (preproc_arg) @variable) [ "default" @@ -17,7 +20,10 @@ "sizeof" "offsetof" ] @keyword.operator -(alignof_expression . _ @keyword.operator) + +(alignof_expression + . + _ @keyword.operator) "return" @keyword.return @@ -30,10 +36,10 @@ ] @keyword.repeat [ - "if" - "else" - "case" - "switch" + "if" + "else" + "case" + "switch" ] @keyword.conditional [ @@ -52,42 +58,48 @@ "#include" @keyword.import -[ ";" ":" "," "::" ] @punctuation.delimiter +[ + ";" + ":" + "," + "::" +] @punctuation.delimiter "..." @punctuation.special -[ "(" ")" "[" "]" "{" "}"] @punctuation.bracket +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket [ "=" - "-" "*" "/" "+" "%" - "~" "|" "&" "^" "<<" ">>" - "->" "." - "<" "<=" ">=" ">" "==" "!=" - "!" "&&" "||" - "-=" "+=" "*=" @@ -102,42 +114,54 @@ "++" ] @operator -;; Make sure the comma operator is given a highlight group after the comma -;; punctuator so the operator is highlighted properly. -(comma_expression [ "," ] @operator) +; Make sure the comma operator is given a highlight group after the comma +; punctuator so the operator is highlighted properly. +(comma_expression + "," @operator) [ (true) (false) ] @boolean -(conditional_expression [ "?" ":" ] @keyword.conditional.ternary) +(conditional_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) (string_literal) @string + (system_lib_string) @string + (escape_sequence) @string.escape (null) @constant.builtin + (number_literal) @number + (char_literal) @character -((preproc_arg) @function.macro (#set! "priority" 90)) +((preproc_arg) @function.macro + (#set! "priority" 90)) + (preproc_defined) @function.macro ((field_expression - (field_identifier) @property) @_parent - (#not-has-parent? @_parent template_method function_declarator call_expression)) + (field_identifier) @property) @_parent + (#not-has-parent? @_parent template_method function_declarator call_expression)) (field_designator) @property + ((field_identifier) @property - (#has-ancestor? @property field_declaration) - (#not-has-ancestor? @property function_declarator)) + (#has-ancestor? @property field_declaration) + (#not-has-ancestor? @property function_declarator)) (statement_identifier) @label [ - (type_identifier) - (type_descriptor) + (type_identifier) + (type_descriptor) ] @type (storage_class_specifier) @keyword.storage @@ -156,14 +180,20 @@ (primitive_type) @type.builtin -(sized_type_specifier _ @type.builtin type: _?) +(sized_type_specifier + _ @type.builtin + type: _?) ((identifier) @constant - (#lua-match? @constant "^[A-Z][A-Z0-9_]+$")) -(preproc_def (preproc_arg) @constant (#lua-match? @constant "^[A-Z][A-Z0-9_]+$")) + +(preproc_def + (preproc_arg) @constant + (#lua-match? @constant "^[A-Z][A-Z0-9_]+$")) + (enumerator name: (identifier) @constant) + (case_statement value: (identifier) @constant) @@ -181,7 +211,9 @@ "__clang_wide_literal_encoding__" "__FUNCTION__" "__func__" "__PRETTY_FUNCTION__" "__VA_ARGS__" "__VA_OPT__")) -(preproc_def (preproc_arg) @constant.builtin + +(preproc_def + (preproc_arg) @constant.builtin ; format-ignore (#any-of? @constant.builtin "stderr" "stdin" "stdout" @@ -197,21 +229,26 @@ "__VA_ARGS__" "__VA_OPT__")) (attribute_specifier - (argument_list (identifier) @variable.builtin)) + (argument_list + (identifier) @variable.builtin)) + ((attribute_specifier - (argument_list (call_expression - function: (identifier) @variable.builtin)))) + (argument_list + (call_expression + function: (identifier) @variable.builtin)))) ((call_expression function: (identifier) @function.builtin) (#lua-match? @function.builtin "^__builtin_")) + ((call_expression - function: (identifier) @function.builtin) + function: (identifier) @function.builtin) (#has-ancestor? @function.builtin attribute_specifier)) -;; Preproc def / undef +; Preproc def / undef (preproc_def name: (_) @constant) + (preproc_call directive: (preproc_directive) @_u argument: (_) @constant @@ -219,15 +256,21 @@ (call_expression function: (identifier) @function.call) + (call_expression - function: (field_expression - field: (field_identifier) @function.call)) + function: + (field_expression + field: (field_identifier) @function.call)) + (function_declarator declarator: (identifier) @function) + (function_declarator - declarator: (parenthesized_declarator - (pointer_declarator - declarator: (field_identifier) @function))) + declarator: + (parenthesized_declarator + (pointer_declarator + declarator: (field_identifier) @function))) + (preproc_function_def name: (identifier) @function.macro) @@ -236,7 +279,7 @@ ((comment) @comment.documentation (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$")) -;; Parameters +; Parameters (parameter_declaration declarator: (identifier) @variable.parameter) @@ -268,8 +311,8 @@ ; declarator: _ ; (declaration ; declarator: (pointer_declarator) @variable.parameter)) - -(preproc_params (identifier) @variable.parameter) +(preproc_params + (identifier) @variable.parameter) [ "__attribute__" diff --git a/queries/c/indents.scm b/queries/c/indents.scm index cf4c8fa62..95d25fe1d 100644 --- a/queries/c/indents.scm +++ b/queries/c/indents.scm @@ -1,5 +1,5 @@ [ - (compound_statement) + (compound_statement) (field_declaration_list) (case_statement) (enumerator_list) @@ -7,56 +7,62 @@ (initializer_list) (init_declarator) ] @indent.begin - ; With current indent logic, if we capture expression_statement with @indent.begin ; It will be affected by _parent_ node with error subnodes deep down the tree -; So narrow indent capture to check for error inside expression statement only, +; So narrow indent capture to check for error inside expression statement only, (expression_statement (_) @indent.begin ";" @indent.end) (ERROR - "for" "(" @indent.begin ";" ";" ")" @indent.end) + "for" + "(" @indent.begin + ";" + ";" + ")" @indent.end) ((for_statement - body: (_) @_body) @indent.begin + body: (_) @_body) @indent.begin (#not-has-type? @_body compound_statement)) (while_statement condition: (_) @indent.begin) ((while_statement - body: (_) @_body) @indent.begin + body: (_) @_body) @indent.begin (#not-has-type? @_body compound_statement)) -( - (if_statement) +((if_statement) . - (ERROR "else" @indent.begin)) + (ERROR + "else" @indent.begin)) (if_statement condition: (_) @indent.begin) -;; Supports if without braces (but not both if-else without braces) +; Supports if without braces (but not both if-else without braces) ((if_statement - consequence: - (_ ";" @indent.end) @_consequence - (#not-has-type? @_consequence compound_statement) + consequence: + (_ + ";" @indent.end) @_consequence + (#not-has-type? @_consequence compound_statement) alternative: - (else_clause + (else_clause "else" @indent.branch - [ - (if_statement (compound_statement) @indent.dedent)? @indent.dedent + [ + (if_statement + (compound_statement) @indent.dedent)? @indent.dedent (compound_statement)? @indent.dedent (_)? @indent.dedent - ] - )? - ) @indent.begin) - -(else_clause (_ . "{" @indent.branch)) + ])?) @indent.begin) +(else_clause + (_ + . + "{" @indent.branch)) -(compound_statement "}" @indent.end) +(compound_statement + "}" @indent.end) [ ")" @@ -79,12 +85,16 @@ (string_literal) ] @indent.ignore -((ERROR (parameter_declaration)) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) -([(argument_list) (parameter_list)] @indent.align +((ERROR + (parameter_declaration)) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")")) -(comment) @indent.auto +([ + (argument_list) + (parameter_list) +] @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) +(comment) @indent.auto diff --git a/queries/c/injections.scm b/queries/c/injections.scm index c025b0f07..6349fe2d1 100644 --- a/queries/c/injections.scm +++ b/queries/c/injections.scm @@ -1,8 +1,8 @@ ((preproc_arg) @injection.content - (#set! injection.language "c")) + (#set! injection.language "c")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((comment) @injection.content (#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c") @@ -14,8 +14,11 @@ ((call_expression function: (identifier) @_function - arguments: (argument_list - . (string_literal (string_content) @injection.content))) + arguments: + (argument_list + . + (string_literal + (string_content) @injection.content))) ; format-ignore (#any-of? @_function "printf" "printf_s" @@ -29,12 +32,16 @@ "cscanf" "_cscanf" "printw" "scanw") - (#set! injection.language "printf")) + (#set! injection.language "printf")) ((call_expression function: (identifier) @_function - arguments: (argument_list - (_) . (string_literal (string_content) @injection.content))) + arguments: + (argument_list + (_) + . + (string_literal + (string_content) @injection.content))) ; format-ignore (#any-of? @_function "fprintf" "fprintf_s" @@ -57,12 +64,18 @@ "vw_printw" "vwprintw" "wscanw" "vw_scanw" "vwscanw") - (#set! injection.language "printf")) + (#set! injection.language "printf")) ((call_expression function: (identifier) @_function - arguments: (argument_list - (_) . (_) . (string_literal (string_content) @injection.content))) + arguments: + (argument_list + (_) + . + (_) + . + (string_literal + (string_content) @injection.content))) ; format-ignore (#any-of? @_function "sprintf_s" @@ -75,15 +88,22 @@ "vsnwprintf_s" "mvprintw" "mvscanw") - (#set! injection.language "printf")) + (#set! injection.language "printf")) ((call_expression function: (identifier) @_function - arguments: (argument_list - (_) . (_) . (_) . (string_literal (string_content) @injection.content))) - (#any-of? @_function "mvwprintw" - "mvwscanw") - (#set! injection.language "printf")) + arguments: + (argument_list + (_) + . + (_) + . + (_) + . + (string_literal + (string_content) @injection.content))) + (#any-of? @_function "mvwprintw" "mvwscanw") + (#set! injection.language "printf")) ; TODO: add when asm is added ; (gnu_asm_expression assembly_code: (string_literal) @injection.content diff --git a/queries/c/locals.scm b/queries/c/locals.scm index 3756bc4a5..13a122790 100644 --- a/queries/c/locals.scm +++ b/queries/c/locals.scm @@ -1,53 +1,67 @@ -;; Functions definitions +; Functions definitions (function_declarator declarator: (identifier) @local.definition.function) + (preproc_function_def name: (identifier) @local.definition.macro) @local.scope (preproc_def name: (identifier) @local.definition.macro) + (pointer_declarator declarator: (identifier) @local.definition.var) + (parameter_declaration declarator: (identifier) @local.definition.parameter) + (init_declarator declarator: (identifier) @local.definition.var) + (array_declarator declarator: (identifier) @local.definition.var) + (declaration declarator: (identifier) @local.definition.var) + (enum_specifier name: (_) @local.definition.type (enumerator_list - (enumerator name: (identifier) @local.definition.var))) + (enumerator + name: (identifier) @local.definition.var))) -;; Type / Struct / Enum +; Type / Struct / Enum (field_declaration declarator: (field_identifier) @local.definition.field) + (type_definition declarator: (type_identifier) @local.definition.type) + (struct_specifier name: (type_identifier) @local.definition.type) -;; goto -(labeled_statement (statement_identifier) @local.definition) +; goto +(labeled_statement + (statement_identifier) @local.definition) -;; References +; References (identifier) @local.reference + ((field_identifier) @local.reference - (#set! reference.kind "field")) + (#set! reference.kind "field")) + ((type_identifier) @local.reference - (#set! reference.kind "type")) + (#set! reference.kind "type")) -(goto_statement (statement_identifier) @local.reference) +(goto_statement + (statement_identifier) @local.reference) -;; Scope +; Scope [ - (for_statement) - (if_statement) - (while_statement) - (translation_unit) - (function_definition) - (compound_statement) ; a block in curly braces - (struct_specifier) + (for_statement) + (if_statement) + (while_statement) + (translation_unit) + (function_definition) + (compound_statement) ; a block in curly braces + (struct_specifier) ] @local.scope diff --git a/queries/c_sharp/folds.scm b/queries/c_sharp/folds.scm index 4b5d94270..2b7c9773d 100644 --- a/queries/c_sharp/folds.scm +++ b/queries/c_sharp/folds.scm @@ -1,15 +1,10 @@ -body: [ - (declaration_list) - (switch_body) - (enum_member_declaration_list) -] @fold - -accessors: [ - (accessor_list) -] @fold - -initializer: [ - (initializer_expression) -] @fold +body: + [ + (declaration_list) + (switch_body) + (enum_member_declaration_list) + ] @fold +accessors: (accessor_list) @fold +initializer: (initializer_expression) @fold (block) @fold diff --git a/queries/c_sharp/highlights.scm b/queries/c_sharp/highlights.scm index 1cd566728..3671dc258 100644 --- a/queries/c_sharp/highlights.scm +++ b/queries/c_sharp/highlights.scm @@ -26,18 +26,23 @@ name: (identifier) @function.method.call)) (invocation_expression - function: (conditional_access_expression - (member_binding_expression - name: (identifier) @function.method.call))) + function: + (conditional_access_expression + (member_binding_expression + name: (identifier) @function.method.call))) (namespace_declaration - name: [(qualified_name) (identifier)] @module) + name: + [ + (qualified_name) + (identifier) + ] @module) (qualified_name (identifier) @type) (invocation_expression - (identifier) @function.method.call) + (identifier) @function.method.call) (field_declaration (variable_declaration @@ -50,29 +55,29 @@ (parameter_list (parameter - name: (identifier) @variable.parameter)) + name: (identifier) @variable.parameter)) (parameter_list (parameter - type: (identifier) @type)) + type: (identifier) @type)) (integer_literal) @number + (real_literal) @number.float (null_literal) @constant.builtin + (character_literal) @character [ - (string_literal) - (verbatim_string_literal) - (interpolated_string_expression) + (string_literal) + (verbatim_string_literal) + (interpolated_string_expression) ] @string (boolean_literal) @boolean -[ - (predefined_type) -] @type.builtin +(predefined_type) @type.builtin (implicit_type) @keyword @@ -83,6 +88,7 @@ ((comment) @comment.documentation (#lua-match? @comment.documentation "^///[^/]")) + ((comment) @comment.documentation (#lua-match? @comment.documentation "^///$")) @@ -90,7 +96,8 @@ (identifier) @type) (using_directive - (name_equals (identifier) @type.definition)) + (name_equals + (identifier) @type.definition)) (property_declaration name: (identifier) @property) @@ -106,20 +113,25 @@ (interface_declaration name: (identifier) @type) + (class_declaration name: (identifier) @type) + (record_declaration name: (identifier) @type) + (enum_declaration name: (identifier) @type) + (constructor_declaration name: (identifier) @constructor) -(constructor_initializer [ - "base" @constructor -]) + +(constructor_initializer + "base" @constructor) (variable_declaration (identifier) @type) + (object_creation_expression (identifier) @type) @@ -142,19 +154,23 @@ (object_creation_expression (generic_name - (identifier) @type)) + (identifier) @type)) (property_declaration (generic_name (identifier) @type)) (_ - type: (generic_name - (identifier) @type)) + type: + (generic_name + (identifier) @type)) + ; Generic Method invocation with generic type (invocation_expression - function: (generic_name - . (identifier) @function.method.call)) + function: + (generic_name + . + (identifier) @function.method.call)) (invocation_expression (member_access_expression @@ -165,7 +181,7 @@ (identifier) @type) (type_argument_list - (identifier) @type) + (identifier) @type) (type_parameter_list (type_parameter) @type) @@ -174,7 +190,7 @@ target: (identifier) @type) (attribute - name: (identifier) @attribute) + name: (identifier) @attribute) (for_each_statement type: (identifier) @type) @@ -197,180 +213,194 @@ (identifier) @variable.parameter) (warning_directive) @comment.warning + (error_directive) @keyword.exception (define_directive (identifier) @constant) @constant.macro + (undef_directive (identifier) @constant) @constant.macro (line_directive) @constant.macro + (line_directive (preproc_integer_literal) @constant (preproc_string_literal)? @string) (pragma_directive (identifier) @constant) @constant.macro + (pragma_directive (preproc_string_literal) @string) @constant.macro [ - (nullable_directive) - (region_directive) - (endregion_directive) + (nullable_directive) + (region_directive) + (endregion_directive) ] @constant.macro [ - "if" - "else" - "switch" - "break" - "case" - "when" - (if_directive) - (elif_directive) - (else_directive) - (endif_directive) + "if" + "else" + "switch" + "break" + "case" + "when" + (if_directive) + (elif_directive) + (else_directive) + (endif_directive) ] @keyword.conditional (if_directive (identifier) @constant) + (elif_directive (identifier) @constant) [ - "while" - "for" - "do" - "continue" - "goto" - "foreach" + "while" + "for" + "do" + "continue" + "goto" + "foreach" ] @keyword.repeat [ - "try" - "catch" - "throw" - "finally" + "try" + "catch" + "throw" + "finally" ] @keyword.exception [ - "+" - "?" - ":" - "++" - "-" - "--" - "&" - "&&" - "|" - "||" - "!" - "!=" - "==" - "*" - "/" - "%" - "<" - "<=" - ">" - ">=" - "=" - "-=" - "+=" - "*=" - "/=" - "%=" - "^" - "^=" - "&=" - "|=" - "~" - ">>" - ">>>" - "<<" - "<<=" - ">>=" - ">>>=" - "=>" - "??" - "??=" + "+" + "?" + ":" + "++" + "-" + "--" + "&" + "&&" + "|" + "||" + "!" + "!=" + "==" + "*" + "/" + "%" + "<" + "<=" + ">" + ">=" + "=" + "-=" + "+=" + "*=" + "/=" + "%=" + "^" + "^=" + "&=" + "|=" + "~" + ">>" + ">>>" + "<<" + "<<=" + ">>=" + ">>>=" + "=>" + "??" + "??=" ] @operator [ - ";" - "." - "," - ":" + ";" + "." + "," + ":" ] @punctuation.delimiter -(conditional_expression ["?" ":"] @keyword.conditional.ternary) +(conditional_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) [ - "[" - "]" - "{" - "}" - "(" - ")" + "[" + "]" + "{" + "}" + "(" + ")" ] @punctuation.bracket -(type_argument_list ["<" ">"] @punctuation.bracket) +(type_argument_list + [ + "<" + ">" + ] @punctuation.bracket) [ - (this_expression) - (base_expression) + (this_expression) + (base_expression) ] @variable.builtin [ - "using" - "as" + "using" + "as" ] @keyword.import (alias_qualified_name - (identifier "global") @keyword.import) + (identifier + "global") @keyword.import) [ - "with" - "new" - "typeof" - "sizeof" - "is" - "and" - "or" - "not" - "stackalloc" - "in" - "out" - "ref" + "with" + "new" + "typeof" + "sizeof" + "is" + "and" + "or" + "not" + "stackalloc" + "in" + "out" + "ref" ] @keyword.operator [ - "lock" - "params" - "operator" - "default" - "implicit" - "explicit" - "override" - "class" - "delegate" - "enum" - "interface" - "namespace" - "struct" - "get" - "set" - "init" - "where" - "record" - "event" - "add" - "remove" - "checked" - "unchecked" - "fixed" - "alias" + "lock" + "params" + "operator" + "default" + "implicit" + "explicit" + "override" + "class" + "delegate" + "enum" + "interface" + "namespace" + "struct" + "get" + "set" + "init" + "where" + "record" + "event" + "add" + "remove" + "checked" + "unchecked" + "fixed" + "alias" ] @keyword [ @@ -379,39 +409,40 @@ ] @keyword.coroutine [ - "const" - "extern" - "readonly" - "static" - "volatile" - "required" + "const" + "extern" + "readonly" + "static" + "volatile" + "required" ] @keyword.storage [ - "abstract" - "private" - "protected" - "internal" - "public" - "partial" - "sealed" - "virtual" + "abstract" + "private" + "protected" + "internal" + "public" + "partial" + "sealed" + "virtual" ] @type.qualifier (parameter_modifier) @operator (query_expression - (_ [ - "from" - "orderby" - "select" - "group" - "by" - "ascending" - "descending" - "equals" - "let" - ] @keyword)) + (_ + [ + "from" + "orderby" + "select" + "group" + "by" + "ascending" + "descending" + "equals" + "let" + ] @keyword)) [ "return" diff --git a/queries/c_sharp/injections.scm b/queries/c_sharp/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/c_sharp/injections.scm +++ b/queries/c_sharp/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/c_sharp/locals.scm b/queries/c_sharp/locals.scm index 1d1665d9d..0476a1695 100644 --- a/queries/c_sharp/locals.scm +++ b/queries/c_sharp/locals.scm @@ -1,6 +1,7 @@ -;; Definitions +; Definitions (variable_declarator - . (identifier) @local.definition.var) + . + (identifier) @local.definition.var) (variable_declarator (tuple_pattern @@ -13,8 +14,9 @@ left: (identifier) @local.definition.var) (for_each_statement - left: (tuple_pattern - (identifier) @local.definition.var)) + left: + (tuple_pattern + (identifier) @local.definition.var)) (parameter (identifier) @local.definition.parameter) @@ -34,8 +36,8 @@ (class_declaration name: (identifier) @local.definition) -;; References +; References (identifier) @local.reference -;; Scope +; Scope (block) @local.scope diff --git a/queries/cairo/folds.scm b/queries/cairo/folds.scm index 1c7af9fcf..9937da6f1 100644 --- a/queries/cairo/folds.scm +++ b/queries/cairo/folds.scm @@ -5,20 +5,16 @@ (enum_item) (impl_item) (type_item) - (use_declaration) (let_declaration) (namespace_definition) - (arguments) (implicit_arguments) (tuple_type) - (import_statement) (attribute_statement) (with_statement) (if_statement) - (function_definition) (struct_definition) (loop_expression) @@ -26,6 +22,5 @@ (match_expression) (call_expression) (tuple_expression) - (attribute_item) ] @fold diff --git a/queries/cairo/highlights.scm b/queries/cairo/highlights.scm index f8bacede9..aa25847c9 100644 --- a/queries/cairo/highlights.scm +++ b/queries/cairo/highlights.scm @@ -1,13 +1,18 @@ ; Preproc - [ "%builtins" "%lang" ] @keyword.directive ; Includes - -(import_statement [ "from" "import" ] @keyword.import module_name: (dotted_name (identifier) @module . )) +(import_statement + [ + "from" + "import" + ] @keyword.import + module_name: + (dotted_name + (identifier) @module .)) [ "as" @@ -16,41 +21,42 @@ ] @keyword.import ; Variables - (identifier) @variable ; Namespaces - -(namespace_definition (identifier) @module) +(namespace_definition + (identifier) @module) (mod_item name: (identifier) @module) -(use_list (self) @module) +(use_list + (self) @module) -(scoped_use_list (self) @module) +(scoped_use_list + (self) @module) (scoped_identifier path: (identifier) @module) (scoped_identifier - (scoped_identifier - name: (identifier) @module)) + (scoped_identifier + name: (identifier) @module)) (scoped_type_identifier path: (identifier) @module) ((scoped_identifier path: (identifier) @type) - (#lua-match? @type "^[A-Z]")) + (#lua-match? @type "^[A-Z]")) ((scoped_identifier - name: (identifier) @type) - (#lua-match? @type "^[A-Z]")) + name: (identifier) @type) + (#lua-match? @type "^[A-Z]")) ((scoped_identifier - name: (identifier) @constant) - (#lua-match? @constant "^[A-Z][A-Z%d_]*$")) + name: (identifier) @constant) + (#lua-match? @constant "^[A-Z][A-Z%d_]*$")) ((scoped_identifier path: (identifier) @type @@ -68,17 +74,25 @@ path: (identifier) @module) (scoped_use_list - path: (scoped_identifier - (identifier) @module)) + path: + (scoped_identifier + (identifier) @module)) -(use_list (scoped_identifier (identifier) @module . (_))) +(use_list + (scoped_identifier + (identifier) @module + . + (_))) -(use_list (identifier) @type (#lua-match? @type "^[A-Z]")) +(use_list + (identifier) @type + (#lua-match? @type "^[A-Z]")) -(use_as_clause alias: (identifier) @type (#lua-match? @type "^[A-Z]")) +(use_as_clause + alias: (identifier) @type + (#lua-match? @type "^[A-Z]")) ; Keywords - [ ; 0.x "using" @@ -96,7 +110,6 @@ "with" "call" "nondet" - ; 1.0 "type" "impl" @@ -133,9 +146,7 @@ "match" ] @keyword.conditional -[ - "loop" -] @keyword.repeat +"loop" @keyword.repeat [ "assert" @@ -144,33 +155,52 @@ ] @keyword.exception ; Fields +(implicit_arguments + (typed_identifier + (identifier) @variable.member)) -(implicit_arguments (typed_identifier (identifier) @variable.member)) +(member_expression + "." + (identifier) @variable.member) -(member_expression "." (identifier) @variable.member) - -(call_expression (assignment_expression left: (identifier) @variable.member)) +(call_expression + (assignment_expression + left: (identifier) @variable.member)) -(tuple_expression (assignment_expression left: (identifier) @variable.member)) +(tuple_expression + (assignment_expression + left: (identifier) @variable.member)) (field_identifier) @variable.member -(shorthand_field_initializer (identifier) @variable.member) +(shorthand_field_initializer + (identifier) @variable.member) ; Parameters +(arguments + (typed_identifier + (identifier) @variable.parameter)) -(arguments (typed_identifier (identifier) @variable.parameter)) - -(call_expression (tuple_expression (assignment_expression left: (identifier) @variable.parameter))) +(call_expression + (tuple_expression + (assignment_expression + left: (identifier) @variable.parameter))) -(return_type (tuple_type (named_type . (identifier) @variable.parameter))) +(return_type + (tuple_type + (named_type + . + (identifier) @variable.parameter))) -(parameter (identifier) @variable.parameter) +(parameter + (identifier) @variable.parameter) ; Builtins +(builtin_directive + (identifier) @variable.builtin) -(builtin_directive (identifier) @variable.builtin) -(lang_directive (identifier) @variable.builtin) +(lang_directive + (identifier) @variable.builtin) [ "ap" @@ -179,32 +209,45 @@ ] @variable.builtin ; Functions +(function_definition + "func" + (identifier) @function) + +(function_definition + "fn" + (identifier) @function) + +(function_signature + "fn" + (identifier) @function) -(function_definition "func" (identifier) @function) -(function_definition "fn" (identifier) @function) -(function_signature "fn" (identifier) @function) -(extern_function_statement (identifier) @function) +(extern_function_statement + (identifier) @function) (call_expression function: (identifier) @function.call) (call_expression - function: (scoped_identifier - (identifier) @function.call .)) + function: + (scoped_identifier + (identifier) @function.call .)) (call_expression - function: (field_expression - field: (field_identifier) @function.call)) + function: + (field_expression + field: (field_identifier) @function.call)) -[ - "jmp" -] @function.builtin +"jmp" @function.builtin ; Types +(struct_definition + . + (identifier) @type + (typed_identifier + (identifier) @variable.member)?) -(struct_definition . (identifier) @type (typed_identifier (identifier) @variable.member)?) - -(named_type (identifier) @type .) +(named_type + (identifier) @type .) [ (builtin_type) @@ -217,7 +260,6 @@ (type_identifier) @type ; Constants - ((identifier) @constant (#lua-match? @constant "^[A-Z_][A-Z0-9_]*$")) @@ -225,49 +267,68 @@ name: (identifier) @constant) (call_expression - function: (scoped_identifier - "::" - name: (identifier) @constant) + function: + (scoped_identifier + "::" + name: (identifier) @constant) (#lua-match? @constant "^[A-Z]")) ((match_arm - pattern: (match_pattern (identifier) @constant)) - (#lua-match? @constant "^[A-Z]")) + pattern: + (match_pattern + (identifier) @constant)) + (#lua-match? @constant "^[A-Z]")) ((match_arm - pattern: (match_pattern - (scoped_identifier - name: (identifier) @constant))) - (#lua-match? @constant "^[A-Z]")) + pattern: + (match_pattern + (scoped_identifier + name: (identifier) @constant))) + (#lua-match? @constant "^[A-Z]")) ((identifier) @constant.builtin - (#any-of? @constant.builtin "Some" "None" "Ok" "Err")) + (#any-of? @constant.builtin "Some" "None" "Ok" "Err")) ; Constructors +(unary_expression + "new" + (call_expression + . + (identifier) @constructor)) -(unary_expression "new" (call_expression . (identifier) @constructor)) - -((call_expression . (identifier) @constructor) +((call_expression + . + (identifier) @constructor) (#lua-match? @constructor "^%u")) ; Attributes +(decorator + "@" @attribute + (identifier) @attribute) -(decorator "@" @attribute (identifier) @attribute) - -(attribute_item (identifier) @function.macro) +(attribute_item + (identifier) @function.macro) -(attribute_item (scoped_identifier (identifier) @function.macro .)) +(attribute_item + (scoped_identifier + (identifier) @function.macro .)) ; Labels +(label + . + (identifier) @label) -(label . (identifier) @label) - -(inst_jmp_to_label "jmp" . (identifier) @label) +(inst_jmp_to_label + "jmp" + . + (identifier) @label) -(inst_jnz_to_label "jmp" . (identifier) @label) +(inst_jnz_to_label + "jmp" + . + (identifier) @label) ; Operators - [ "+" "-" @@ -307,7 +368,6 @@ ] @operator ; Literals - (number) @number (boolean) @boolean @@ -318,17 +378,41 @@ ] @string ; Punctuation +(attribute_item + "#" @punctuation.special) -(attribute_item "#" @punctuation.special) - -[ "." "," ":" ";" "->" "=>" "::" ] @punctuation.delimiter +[ + "." + "," + ":" + ";" + "->" + "=>" + "::" +] @punctuation.delimiter -[ "{" "}" "(" ")" "[" "]" "%{" "%}" ] @punctuation.bracket +[ + "{" + "}" + "(" + ")" + "[" + "]" + "%{" + "%}" +] @punctuation.bracket -(type_parameters [ "<" ">" ] @punctuation.bracket) +(type_parameters + [ + "<" + ">" + ] @punctuation.bracket) -(type_arguments [ "<" ">" ] @punctuation.bracket) +(type_arguments + [ + "<" + ">" + ] @punctuation.bracket) ; Comment - (comment) @comment @spell diff --git a/queries/cairo/indents.scm b/queries/cairo/indents.scm index 76a22e705..a97bd24a4 100644 --- a/queries/cairo/indents.scm +++ b/queries/cairo/indents.scm @@ -18,19 +18,36 @@ (tuple_pattern) ] @indent.begin -(import_statement "(") @indent.begin +(import_statement + "(") @indent.begin + +(block + "}" @indent.end) -(block "}" @indent.end) (enum_item - body: (enum_variant_list "}" @indent.end)) + body: + (enum_variant_list + "}" @indent.end)) + (match_expression - body: (match_block "}" @indent.end)) + body: + (match_block + "}" @indent.end)) + (mod_item - body: (declaration_list "}" @indent.end)) + body: + (declaration_list + "}" @indent.end)) + (struct_item - body: (field_declaration_list "}" @indent.end)) + body: + (field_declaration_list + "}" @indent.end)) + (trait_item - body: (declaration_list "}" @indent.end)) + body: + (declaration_list + "}" @indent.end)) [ ")" diff --git a/queries/cairo/injections.scm b/queries/cairo/injections.scm index 675a81a76..fbb66be38 100644 --- a/queries/cairo/injections.scm +++ b/queries/cairo/injections.scm @@ -1,3 +1,5 @@ -(python_code) @python +((python_code) @injection.content + (#set! injection.language "python")) -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cairo/locals.scm b/queries/cairo/locals.scm index a92991f26..27ec73542 100644 --- a/queries/cairo/locals.scm +++ b/queries/cairo/locals.scm @@ -1,13 +1,13 @@ ; References - (identifier) @local.reference + ((type_identifier) @local.reference (#set! reference.kind "type")) + ((field_identifier) @local.reference (#set! reference.kind "field")) ; Scopes - [ (program) (block) @@ -16,53 +16,52 @@ (if_expression) (match_expression) (match_arm) - (struct_item) (enum_item) (impl_item) ] @local.scope -(use_declaration - argument: (scoped_identifier - name: (identifier) @local.definition.import)) +(use_declaration + argument: + (scoped_identifier + name: (identifier) @local.definition.import)) -(use_as_clause +(use_as_clause alias: (identifier) @local.definition.import) (use_list - (identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio}; + (identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio}; ; Functions - (function_definition - (identifier) @local.definition.function) + (identifier) @local.definition.function) (function_definition (identifier) @local.definition.method - (parameter (self))) + (parameter + (self))) ; Function with parameters, defines parameters - (parameter - [ (identifier) (self) ] @local.definition.parameter) + [ + (identifier) + (self) + ] @local.definition.parameter) ; Types - (struct_item name: (type_identifier) @local.definition.type) -(constrained_type_parameter +(constrained_type_parameter left: (type_identifier) @local.definition.type) ; the P in remove_file<P: AsRef<Path>>(path: P) (enum_item name: (type_identifier) @local.definition.type) ; Module - -(mod_item +(mod_item name: (identifier) @local.definition.namespace) ; Variables - (assignment_expression - left: (identifier) @local.definition.var) + left: (identifier) @local.definition.var) diff --git a/queries/capnp/highlights.scm b/queries/capnp/highlights.scm index 80c8262e7..4ce923ce4 100644 --- a/queries/capnp/highlights.scm +++ b/queries/capnp/highlights.scm @@ -1,12 +1,10 @@ ; Preproc - [ (unique_id) (top_level_annotation_body) ] @keyword.directive ; Includes - [ "import" "$import" @@ -17,7 +15,6 @@ (import_path) @string.special.path ; Keywords - [ "annotation" "enum" @@ -30,10 +27,7 @@ ] @keyword ; Builtins - -[ - "const" -] @type.qualifier +"const" @type.qualifier [ (primitive_type) @@ -41,30 +35,24 @@ ] @type.builtin ; Typedefs - (type_definition) @type.definition ; Labels (@number, @number!) - (field_version) @label ; Methods - [ (annotation_definition_identifier) (method_identifier) ] @function.method ; Fields - (field_identifier) @variable.member ; Properties - (property) @property ; Parameters - [ (param_identifier) (return_identifier) @@ -73,7 +61,6 @@ (annotation_target) @variable.parameter.builtin ; Constants - [ (const_identifier) (local_const) @@ -83,7 +70,6 @@ (void) @constant.builtin ; Types - [ (enum_identifier) (extend_type) @@ -91,18 +77,15 @@ ] @type ; Attributes - [ (annotation_identifier) (attribute) ] @attribute ; Operators - "=" @operator ; Literals - [ (string) (concatenated_string) @@ -125,18 +108,26 @@ (data_hex) @string.special.symbol ; Punctuation - [ "*" "$" ":" ] @punctuation.special -["{" "}"] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -["(" ")"] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -["[" "]"] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket [ "." @@ -146,5 +137,4 @@ ] @punctuation.delimiter ; Comments - (comment) @comment @spell diff --git a/queries/capnp/indents.scm b/queries/capnp/indents.scm index bc7979aea..cc2f4d756 100644 --- a/queries/capnp/indents.scm +++ b/queries/capnp/indents.scm @@ -13,14 +13,17 @@ (field) ] @indent.begin -((struct_shorthand (property)) @indent.align +((struct_shorthand + (property)) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")")) -((method (field_version)) @indent.align +((method + (field_version)) @indent.align (#set! indent.open_delimiter field_version)) -((const_list (const_value)) @indent.align +((const_list + (const_value)) @indent.align (#set! indent.open_delimiter "[") (#set! indent.close_delimiter "]")) @@ -31,7 +34,6 @@ ")" ] @indent.end @indent.branch - [ (ERROR) (comment) diff --git a/queries/capnp/injections.scm b/queries/capnp/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/capnp/injections.scm +++ b/queries/capnp/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/capnp/locals.scm b/queries/capnp/locals.scm index d0025100e..d1f0ccacc 100644 --- a/queries/capnp/locals.scm +++ b/queries/capnp/locals.scm @@ -18,17 +18,21 @@ (extend_type) (field_type) ] @local.reference -(custom_type (type_identifier) @local.reference) + +(custom_type + (type_identifier) @local.reference) + (custom_type (generics - (generic_parameters + (generic_parameters (generic_identifier) @local.reference))) (annotation_definition_identifier) @local.definition (const_identifier) @local.definition.constant -(enum (enum_identifier) @local.definition.enum) +(enum + (enum_identifier) @local.definition.enum) [ (enum_member) @@ -44,16 +48,19 @@ (return_identifier) ] @local.definition.parameter -(group (type_identifier) @local.definition.type) +(group + (type_identifier) @local.definition.type) -(struct (type_identifier) @local.definition.type) +(struct + (type_identifier) @local.definition.type) -(union (type_identifier) @local.definition.type) +(union + (type_identifier) @local.definition.type) -(interface (type_identifier) @local.definition.type) +(interface + (type_identifier) @local.definition.type) ; Generics Related (don't know how to combine these) - (struct (generics (generic_parameters diff --git a/queries/chatito/folds.scm b/queries/chatito/folds.scm index 20cb51941..052dd2064 100644 --- a/queries/chatito/folds.scm +++ b/queries/chatito/folds.scm @@ -1,5 +1,5 @@ [ - (intent_def) - (slot_def) - (alias_def) + (intent_def) + (slot_def) + (alias_def) ] @fold diff --git a/queries/chatito/highlights.scm b/queries/chatito/highlights.scm index 913787012..0c2dd795a 100644 --- a/queries/chatito/highlights.scm +++ b/queries/chatito/highlights.scm @@ -1,24 +1,32 @@ -;; Punctuation - +; Punctuation [ - "%[" - "@[" - "~[" - "*[" - "]" - "(" - ")" + "%[" + "@[" + "~[" + "*[" + "]" + "(" + ")" ] @punctuation.bracket -[":" ","] @punctuation.delimiter - -(["\"" "'"] @punctuation.special - (#set! conceal "")) +[ + ":" + "," +] @punctuation.delimiter -["%" "?" "#"] @character.special +([ + "\"" + "'" +] @punctuation.special + (#set! conceal "")) -;; Entities +[ + "%" + "?" + "#" +] @character.special +; Entities (intent) @module (slot) @type @@ -35,16 +43,13 @@ (escape) @string.escape -;; Import - +; Import "import" @keyword.import (file) @string.special.path -;; Text - +; Text (word) @spell -;; Comment - +; Comment (comment) @comment @spell diff --git a/queries/chatito/indents.scm b/queries/chatito/indents.scm index 64b4674b7..dc9e13d78 100644 --- a/queries/chatito/indents.scm +++ b/queries/chatito/indents.scm @@ -1,7 +1,8 @@ [ - (intent_def) - (slot_def) - (alias_def) + (intent_def) + (slot_def) + (alias_def) ] @indent.begin -(ERROR "]") @indent.begin +(ERROR + "]") @indent.begin diff --git a/queries/chatito/injections.scm b/queries/chatito/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/chatito/injections.scm +++ b/queries/chatito/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/chatito/locals.scm b/queries/chatito/locals.scm index fd8bb9da0..827447f57 100644 --- a/queries/chatito/locals.scm +++ b/queries/chatito/locals.scm @@ -1,10 +1,16 @@ -;; Definitions +; Definitions +(intent_def + (intent) @local.definition) -(intent_def (intent) @local.definition) -(slot_def (slot) @local.definition) -(alias_def (alias) @local.definition) +(slot_def + (slot) @local.definition) -;; References +(alias_def + (alias) @local.definition) -(slot_ref (slot) @local.reference) -(alias_ref (alias) @local.reference) +; References +(slot_ref + (slot) @local.reference) + +(alias_ref + (alias) @local.reference) diff --git a/queries/clojure/folds.scm b/queries/clojure/folds.scm index d54daade6..eceb69712 100644 --- a/queries/clojure/folds.scm +++ b/queries/clojure/folds.scm @@ -1 +1,2 @@ -(source (list_lit) @fold) +(source + (list_lit) @fold) diff --git a/queries/clojure/highlights.scm b/queries/clojure/highlights.scm index 974a17c0a..60bc4365b 100644 --- a/queries/clojure/highlights.scm +++ b/queries/clojure/highlights.scm @@ -1,69 +1,87 @@ -;; >> Explanation -;; Parsers for lisps are a bit weird in that they just return the raw forms. -;; This means we have to do a bit of extra work in the queries to get things -;; highlighted as they should be. -;; -;; For the most part this means that some things have to be assigned multiple -;; groups. -;; By doing this we can add a basic capture and then later refine it with more -;; specialized captures. -;; This can mean that sometimes things are highlighted weirdly because they -;; have multiple highlight groups applied to them. +; >> Explanation +; Parsers for lisps are a bit weird in that they just return the raw forms. +; This means we have to do a bit of extra work in the queries to get things +; highlighted as they should be. +; +; For the most part this means that some things have to be assigned multiple +; groups. +; By doing this we can add a basic capture and then later refine it with more +; specialized captures. +; This can mean that sometimes things are highlighted weirdly because they +; have multiple highlight groups applied to them. +; >> Literals +((dis_expr) @comment + (#set! "priority" 105) + ; Higher priority to mark the whole sexpr as a comment + ) - -;; >> Literals - -( - (dis_expr) @comment - (#set! "priority" 105) ; Higher priority to mark the whole sexpr as a comment -) (kwd_lit) @string.special.symbol + (str_lit) @string + (num_lit) @number + (char_lit) @character + (bool_lit) @boolean -(nil_lit) @constant.builtin -(comment) @comment @spell -(regex_lit) @string.regexp -["'" "`"] @string.escape +(nil_lit) @constant.builtin -["~" "~@" "#"] @punctuation.special +(comment) @comment @spell -["{" "}" "[" "]" "(" ")"] @punctuation.bracket +(regex_lit) @string.regexp +[ + "'" + "`" +] @string.escape +[ + "~" + "~@" + "#" +] @punctuation.special -;; >> Symbols +[ + "{" + "}" + "[" + "]" + "(" + ")" +] @punctuation.bracket +; >> Symbols ; General symbol highlighting (sym_lit) @variable ; General function calls (list_lit - . - (sym_lit) @function.call) + . + (sym_lit) @function.call) + (anon_fn_lit - . - (sym_lit) @function.call) + . + (sym_lit) @function.call) ; Quoted symbols (quoting_lit - (sym_lit) @string.special.symbol) + (sym_lit) @string.special.symbol) + (syn_quoting_lit - (sym_lit) @string.special.symbol) + (sym_lit) @string.special.symbol) ; Used in destructure pattern ((sym_lit) @variable.parameter - (#lua-match? @variable.parameter "^[&]")) + (#lua-match? @variable.parameter "^[&]")) ; Inline function variables ((sym_lit) @variable.builtin - (#lua-match? @variable.builtin "^%%")) + (#lua-match? @variable.builtin "^%%")) ; Constructor ((sym_lit) @constructor - (#lua-match? @constructor "^-%>[^>].*")) + (#lua-match? @constructor "^-%>[^>].*")) ; Builtin dynamic variables ((sym_lit) @variable.builtin @@ -84,94 +102,91 @@ ; Builtin repl variables ((sym_lit) @variable.builtin - (#any-of? @variable.builtin - "*1" "*2" "*3" "*e")) + (#any-of? @variable.builtin "*1" "*2" "*3" "*e")) ; Gensym -;; Might not be needed +; Might not be needed ((sym_lit) @variable - (#lua-match? @variable "^.*#$")) + (#lua-match? @variable "^.*#$")) ; Types -;; TODO: improve? +; TODO: improve? ((sym_lit) @type - (#lua-match? @type "^[%u][^/]*$")) -;; Symbols with `.` but not `/` + (#lua-match? @type "^[%u][^/]*$")) + +; Symbols with `.` but not `/` ((sym_lit) @type - (#lua-match? @type "^[^/]+[.][^/]*$")) + (#lua-match? @type "^[^/]+[.][^/]*$")) ; Interop ; (.instanceMember instance args*) ; (.instanceMember Classname args*) ((sym_lit) @function.method - (#lua-match? @function.method "^%.[^-]")) + (#lua-match? @function.method "^%.[^-]")) + ; (.-instanceField instance) ((sym_lit) @variable.member - (#lua-match? @variable.member "^%.%-.*")) + (#lua-match? @variable.member "^%.%-.*")) + ; Classname/staticField ((sym_lit) @variable.member - (#lua-match? @variable.member "^[%u].*/.+")) + (#lua-match? @variable.member "^[%u].*/.+")) + ; (Classname/staticMethod args*) (list_lit - . - (sym_lit) @function.method - (#lua-match? @function.method "^[%u].*/.+")) -;; TODO: Special casing for the `.` macro + . + (sym_lit) @function.method + (#lua-match? @function.method "^[%u].*/.+")) +; TODO: Special casing for the `.` macro ; Operators ((sym_lit) @operator - (#any-of? @operator - "*" "*'" "+" "+'" "-" "-'" "/" - "<" "<=" ">" ">=" "=" "==")) + (#any-of? @operator "*" "*'" "+" "+'" "-" "-'" "/" "<" "<=" ">" ">=" "=" "==")) + ((sym_lit) @keyword.operator - (#any-of? @keyword.operator - "not" "not=" "and" "or")) + (#any-of? @keyword.operator "not" "not=" "and" "or")) ; Definition functions ((sym_lit) @keyword - (#any-of? @keyword - "def" "defonce" "defrecord" "defmacro" "definline" "definterface" - "defmulti" "defmethod" "defstruct" "defprotocol" - "deftype")) + (#any-of? @keyword "def" "defonce" "defrecord" "defmacro" "definline" "definterface" "defmulti" "defmethod" "defstruct" "defprotocol" "deftype")) + ((sym_lit) @keyword - (#eq? @keyword "declare")) + (#eq? @keyword "declare")) + ((sym_name) @keyword.coroutine - (#any-of? @keyword.coroutine - "alts!" "alts!!" "await" "await-for" "await1" "chan" "close!" "future" "go" "sync" "thread" "timeout" "<!" "<!!" ">!" ">!!")) + (#any-of? @keyword.coroutine "alts!" "alts!!" "await" "await-for" "await1" "chan" "close!" "future" "go" "sync" "thread" "timeout" "<!" "<!!" ">!" ">!!")) + ((sym_lit) @keyword.function - (#any-of? @keyword.function "defn" "defn-" "fn" "fn*")) + (#any-of? @keyword.function "defn" "defn-" "fn" "fn*")) ; Comment ((sym_lit) @comment - (#any-of? @comment "comment")) + (#any-of? @comment "comment")) ; Conditionals ((sym_lit) @keyword.conditional - (#any-of? @keyword.conditional - "case" "cond" "cond->" "cond->>" "condp")) + (#any-of? @keyword.conditional "case" "cond" "cond->" "cond->>" "condp")) + ((sym_lit) @keyword.conditional - (#any-of? @keyword.conditional - "if" "if-let" "if-not" "if-some")) + (#any-of? @keyword.conditional "if" "if-let" "if-not" "if-some")) + ((sym_lit) @keyword.conditional - (#any-of? @keyword.conditional - "when" "when-first" "when-let" "when-not" "when-some")) + (#any-of? @keyword.conditional "when" "when-first" "when-let" "when-not" "when-some")) ; Repeats ((sym_lit) @keyword.repeat - (#any-of? @keyword.repeat - "doseq" "dotimes" "for" "loop" "recur" "while")) + (#any-of? @keyword.repeat "doseq" "dotimes" "for" "loop" "recur" "while")) ; Exception ((sym_lit) @keyword.exception - (#any-of? @keyword.exception - "throw" "try" "catch" "finally")) + (#any-of? @keyword.exception "throw" "try" "catch" "finally")) ; Includes ((sym_lit) @keyword.import - (#any-of? @keyword.import "ns" "import" "require" "use")) + (#any-of? @keyword.import "ns" "import" "require" "use")) ; Builtin macros -;; TODO: Do all these items belong here? +; TODO: Do all these items belong here? ((sym_lit) @function.macro ; format-ignore (#any-of? @function.macro @@ -191,7 +206,7 @@ ; (keep (fn [[s v]] (when-not (:macro (meta v)) s))) ; sort ; clojure.pprint/pprint)) -;; ...and then lots of manual filtering... +; ...and then lots of manual filtering... ((sym_lit) @function.builtin ; format-ignore (#any-of? @function.builtin @@ -316,48 +331,43 @@ "seq-to-map-for-destructuring" "update-keys" "update-vals" ;; 1.12 "partitionv" "partitionv-all" "splitv-at")) - - - -;; >> Context based highlighting - -;; def-likes -;; Correctly highlight docstrings +; >> Context based highlighting +; def-likes +; Correctly highlight docstrings ;(list_lit - ;. - ;(sym_lit) @_keyword ; Don't really want to highlight twice - ;(#any-of? @_keyword - ;"def" "defonce" "defrecord" "defmacro" "definline" - ;"defmulti" "defmethod" "defstruct" "defprotocol" - ;"deftype") - ;. - ;(sym_lit) - ;. - ;;; TODO: Add @comment highlight - ;(str_lit)? - ;. - ;(_)) - +;. +;(sym_lit) @_keyword ; Don't really want to highlight twice +;(#any-of? @_keyword +;"def" "defonce" "defrecord" "defmacro" "definline" +;"defmulti" "defmethod" "defstruct" "defprotocol" +;"deftype") +;. +;(sym_lit) +;. +; TODO: Add @comment highlight +;(str_lit)? +;. +;(_)) ; Function definitions (list_lit - . - (sym_lit) @_keyword.function - (#any-of? @_keyword.function "fn" "fn*" "defn" "defn-") - . - (sym_lit)? @function - . - ;; TODO: Add @comment highlight - (str_lit)?) -;; TODO: Fix parameter highlighting -;; I think there's a bug here in nvim-treesitter -;; TODO: Reproduce bug and file ticket - ;. - ;[(vec_lit - ; (sym_lit)* @variable.parameter) - ; (list_lit - ; (vec_lit - ; (sym_lit)* @variable.parameter))]) - + . + (sym_lit) @_keyword.function + (#any-of? @_keyword.function "fn" "fn*" "defn" "defn-") + . + (sym_lit)? @function + . + ; TODO: Add @comment highlight + (str_lit)?) + +; TODO: Fix parameter highlighting +; I think there's a bug here in nvim-treesitter +; TODO: Reproduce bug and file ticket +;. +;[(vec_lit +; (sym_lit)* @variable.parameter) +; (list_lit +; (vec_lit +; (sym_lit)* @variable.parameter))]) ;[((list_lit ; (vec_lit ; (sym_lit) @variable.parameter) @@ -366,19 +376,17 @@ ; ((vec_lit ; (sym_lit) @variable.parameter) ; (_))) - - ; Meta punctuation -;; NOTE: When the above `Function definitions` query captures the -;; the @function it also captures the child meta_lit -;; We capture the meta_lit symbol (^) after so that the later -;; highlighting overrides the former +; NOTE: When the above `Function definitions` query captures the +; the @function it also captures the child meta_lit +; We capture the meta_lit symbol (^) after so that the later +; highlighting overrides the former "^" @punctuation.special -;; namespaces +; namespaces (list_lit - . - (sym_lit) @_include - (#eq? @_include "ns") - . - (sym_lit) @module) + . + (sym_lit) @_include + (#eq? @_include "ns") + . + (sym_lit) @module) diff --git a/queries/clojure/injections.scm b/queries/clojure/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/clojure/injections.scm +++ b/queries/clojure/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cmake/folds.scm b/queries/cmake/folds.scm index 9ac59ad4c..ef153b911 100644 --- a/queries/cmake/folds.scm +++ b/queries/cmake/folds.scm @@ -1,8 +1,8 @@ [ - (if_condition) - (foreach_loop) - (while_loop) - (function_def) - (macro_def) - (block_def) + (if_condition) + (foreach_loop) + (while_loop) + (function_def) + (macro_def) + (block_def) ] @fold diff --git a/queries/cmake/highlights.scm b/queries/cmake/highlights.scm index 13544661f..714893cb1 100644 --- a/queries/cmake/highlights.scm +++ b/queries/cmake/highlights.scm @@ -1,96 +1,107 @@ (normal_command (identifier) (argument_list - (argument (unquoted_argument)) @constant - ) - (#lua-match? @constant "^[%u@][%u%d_]+$") -) + (argument + (unquoted_argument)) @constant) + (#lua-match? @constant "^[%u@][%u%d_]+$")) [ - (quoted_argument) - (bracket_argument) + (quoted_argument) + (bracket_argument) ] @string (variable_ref) @none + (variable) @variable [ - (bracket_comment) - (line_comment) + (bracket_comment) + (line_comment) ] @comment @spell -(normal_command (identifier) @function) +(normal_command + (identifier) @function) + +[ + "ENV" + "CACHE" +] @keyword.storage -["ENV" "CACHE"] @keyword.storage -["$" "{" "}" "<" ">"] @punctuation.special -["(" ")"] @punctuation.bracket +[ + "$" + "{" + "}" + "<" + ">" +] @punctuation.special [ - (function) - (endfunction) - (macro) - (endmacro) + "(" + ")" +] @punctuation.bracket + +[ + (function) + (endfunction) + (macro) + (endmacro) ] @keyword.function [ - (if) - (elseif) - (else) - (endif) + (if) + (elseif) + (else) + (endif) ] @keyword.conditional [ - (foreach) - (endforeach) - (while) - (endwhile) + (foreach) + (endforeach) + (while) + (endwhile) ] @keyword.repeat (normal_command (identifier) @keyword.repeat - (#match? @keyword.repeat "\\c^(continue|break)$") -) + (#match? @keyword.repeat "\\c^(continue|break)$")) + (normal_command (identifier) @keyword.return - (#match? @keyword.return "\\c^return$") -) + (#match? @keyword.return "\\c^return$")) (function_command (function) (argument_list - . (argument) @function - (argument)* @variable.parameter - ) -) + . + (argument) @function + (argument)* @variable.parameter)) (macro_command (macro) (argument_list - . (argument) @function.macro - (argument)* @variable.parameter - ) -) + . + (argument) @function.macro + (argument)* @variable.parameter)) (block_def (block_command (block) @function.builtin (argument_list - (argument (unquoted_argument) @constant) - ) - (#any-of? @constant "SCOPE_FOR" "POLICIES" "VARIABLES" "PROPAGATE") - ) - (endblock_command (endblock) @function.builtin) -) + (argument + (unquoted_argument) @constant)) + (#any-of? @constant "SCOPE_FOR" "POLICIES" "VARIABLES" "PROPAGATE")) + (endblock_command + (endblock) @function.builtin)) + ; ((argument) @boolean - (#match? @boolean "\\c^(1|on|yes|true|y|0|off|no|false|n|ignore|notfound|.*-notfound)$") -) + (#match? @boolean "\\c^(1|on|yes|true|y|0|off|no|false|n|ignore|notfound|.*-notfound)$")) + ; (if_command (if) (argument_list - (argument) @keyword.operator - ) + (argument) @keyword.operator) ; format-ignore (#any-of? @keyword.operator "NOT" "AND" "OR" @@ -100,13 +111,12 @@ "LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL" "STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL" "VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL" - ) -) + )) + (elseif_command (elseif) (argument_list - (argument) @keyword.operator - ) + (argument) @keyword.operator) ; format-ignore (#any-of? @keyword.operator "NOT" "AND" "OR" @@ -116,106 +126,105 @@ "LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL" "STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL" "VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL" - ) -) + )) (normal_command (identifier) @function.builtin - (#match? @function.builtin "\\c^(cmake_host_system_information|cmake_language|cmake_minimum_required|cmake_parse_arguments|cmake_path|cmake_policy|configure_file|execute_process|file|find_file|find_library|find_package|find_path|find_program|foreach|get_cmake_property|get_directory_property|get_filename_component|get_property|include|include_guard|list|macro|mark_as_advanced|math|message|option|separate_arguments|set|set_directory_properties|set_property|site_name|string|unset|variable_watch|add_compile_definitions|add_compile_options|add_custom_command|add_custom_target|add_definitions|add_dependencies|add_executable|add_library|add_link_options|add_subdirectory|add_test|aux_source_directory|build_command|create_test_sourcelist|define_property|enable_language|enable_testing|export|fltk_wrap_ui|get_source_file_property|get_target_property|get_test_property|include_directories|include_external_msproject|include_regular_expression|install|link_directories|link_libraries|load_cache|project|remove_definitions|set_source_files_properties|set_target_properties|set_tests_properties|source_group|target_compile_definitions|target_compile_features|target_compile_options|target_include_directories|target_link_directories|target_link_libraries|target_link_options|target_precompile_headers|target_sources|try_compile|try_run|ctest_build|ctest_configure|ctest_coverage|ctest_empty_binary_directory|ctest_memcheck|ctest_read_custom_files|ctest_run_script|ctest_sleep|ctest_start|ctest_submit|ctest_test|ctest_update|ctest_upload)$") -) + (#match? @function.builtin "\\c^(cmake_host_system_information|cmake_language|cmake_minimum_required|cmake_parse_arguments|cmake_path|cmake_policy|configure_file|execute_process|file|find_file|find_library|find_package|find_path|find_program|foreach|get_cmake_property|get_directory_property|get_filename_component|get_property|include|include_guard|list|macro|mark_as_advanced|math|message|option|separate_arguments|set|set_directory_properties|set_property|site_name|string|unset|variable_watch|add_compile_definitions|add_compile_options|add_custom_command|add_custom_target|add_definitions|add_dependencies|add_executable|add_library|add_link_options|add_subdirectory|add_test|aux_source_directory|build_command|create_test_sourcelist|define_property|enable_language|enable_testing|export|fltk_wrap_ui|get_source_file_property|get_target_property|get_test_property|include_directories|include_external_msproject|include_regular_expression|install|link_directories|link_libraries|load_cache|project|remove_definitions|set_source_files_properties|set_target_properties|set_tests_properties|source_group|target_compile_definitions|target_compile_features|target_compile_options|target_include_directories|target_link_directories|target_link_libraries|target_link_options|target_precompile_headers|target_sources|try_compile|try_run|ctest_build|ctest_configure|ctest_coverage|ctest_empty_binary_directory|ctest_memcheck|ctest_read_custom_files|ctest_run_script|ctest_sleep|ctest_start|ctest_submit|ctest_test|ctest_update|ctest_upload)$")) (normal_command (identifier) @_function (argument_list - . (argument) @variable - ) - (#match? @_function "\\c^set$") -) + . + (argument) @variable) + (#match? @_function "\\c^set$")) (normal_command (identifier) @_function (#match? @_function "\\c^set$") (argument_list - . (argument) - ( - (argument) @_cache @keyword.storage . - (argument) @_type @type - (#any-of? @_cache "CACHE") - (#any-of? @_type "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL") - ) - ) -) + (argument) + ((argument) @_cache @keyword.storage + . + (argument) @_type @type + (#any-of? @_cache "CACHE") + (#any-of? @_type "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL")))) (normal_command (identifier) @_function (#match? @_function "\\c^unset$") (argument_list - . (argument) + . + (argument) (argument) @keyword.storage - (#any-of? @keyword.storage "CACHE" "PARENT_SCOPE") - ) -) + (#any-of? @keyword.storage "CACHE" "PARENT_SCOPE"))) (normal_command (identifier) @_function (#match? @_function "\\c^list$") (argument_list - . (argument) @constant + . + (argument) @constant (#any-of? @constant "LENGTH" "GET" "JOIN" "SUBLIST" "FIND") - . (argument) @variable - (argument) @variable . - ) -) + . + (argument) @variable + (argument) @variable .)) + (normal_command (identifier) @_function (#match? @_function "\\c^list$") (argument_list - . (argument) @constant - . (argument) @variable - (#any-of? @constant "APPEND" "FILTER" "INSERT" - "POP_BACK" "POP_FRONT" "PREPEND" - "REMOVE_ITEM" "REMOVE_AT" "REMOVE_DUPLICATES" - "REVERSE" "SORT") - ) -) + . + (argument) @constant + . + (argument) @variable + (#any-of? @constant "APPEND" "FILTER" "INSERT" "POP_BACK" "POP_FRONT" "PREPEND" "REMOVE_ITEM" "REMOVE_AT" "REMOVE_DUPLICATES" "REVERSE" "SORT"))) + (normal_command (identifier) @_function (#match? @_function "\\c^list$") (argument_list - . (argument) @_transform @constant - . (argument) @variable - . (argument) @_action @constant + . + (argument) @_transform @constant + . + (argument) @variable + . + (argument) @_action @constant (#eq? @_transform "TRANSFORM") - (#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE") - ) -) + (#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE"))) + (normal_command (identifier) @_function (#match? @_function "\\c^list$") (argument_list - . (argument) @_transform @constant - . (argument) @variable - . (argument) @_action @constant - . (argument)? @_selector @constant + . + (argument) @_transform @constant + . + (argument) @variable + . + (argument) @_action @constant + . + (argument)? @_selector @constant (#eq? @_transform "TRANSFORM") (#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE") - (#any-of? @_selector "AT" "FOR" "REGEX") - ) -) + (#any-of? @_selector "AT" "FOR" "REGEX"))) + (normal_command (identifier) @_function (#match? @_function "\\c^list$") (argument_list - . (argument) @_transform @constant - (argument) @constant . + . + (argument) @_transform @constant + (argument) @constant + . (argument) @variable (#eq? @_transform "TRANSFORM") - (#eq? @constant "OUTPUT_VARIABLE") - ) -) + (#eq? @constant "OUTPUT_VARIABLE"))) (escape_sequence) @string.escape -((source_file . (line_comment) @keyword.directive) +((source_file + . + (line_comment) @keyword.directive) (#lua-match? @keyword.directive "^#!/")) diff --git a/queries/cmake/indents.scm b/queries/cmake/indents.scm index 787cc2c98..e7f326b00 100644 --- a/queries/cmake/indents.scm +++ b/queries/cmake/indents.scm @@ -9,17 +9,18 @@ ] @indent.begin [ - (elseif_command) - (else_command) - (endif_command) - (endforeach_command) - (endwhile_command) - (endfunction_command) - (endmacro_command) - (endblock_command) + (elseif_command) + (else_command) + (endif_command) + (endforeach_command) + (endwhile_command) + (endfunction_command) + (endmacro_command) + (endblock_command) ] @indent.branch (")" @indent.branch) + (")" @indent.end) (argument_list) @indent.auto diff --git a/queries/comment/highlights.scm b/queries/comment/highlights.scm index 41b653e93..6556ec557 100644 --- a/queries/comment/highlights.scm +++ b/queries/comment/highlights.scm @@ -11,33 +11,39 @@ ((tag (name) @comment.note @nospell - ("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)? + ("(" @punctuation.bracket + (user) @constant + ")" @punctuation.bracket)? ":" @punctuation.delimiter) (#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST")) ("text" @comment.note @nospell - (#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST")) + (#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST")) ((tag (name) @comment.warning @nospell - ("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)? + ("(" @punctuation.bracket + (user) @constant + ")" @punctuation.bracket)? ":" @punctuation.delimiter) (#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX")) ("text" @comment.warning @nospell - (#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX")) + (#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX")) ((tag (name) @comment.error @nospell - ("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)? + ("(" @punctuation.bracket + (user) @constant + ")" @punctuation.bracket)? ":" @punctuation.delimiter) (#any-of? @comment.error "FIXME" "BUG" "ERROR")) ("text" @comment.error @nospell - (#any-of? @comment.error "FIXME" "BUG" "ERROR")) + (#any-of? @comment.error "FIXME" "BUG" "ERROR")) ; Issue number (#123) ("text" @number - (#lua-match? @number "^#[0-9]+$")) + (#lua-match? @number "^#[0-9]+$")) ((uri) @string.special.url @nospell) diff --git a/queries/commonlisp/folds.scm b/queries/commonlisp/folds.scm index d54daade6..eceb69712 100644 --- a/queries/commonlisp/folds.scm +++ b/queries/commonlisp/folds.scm @@ -1 +1,2 @@ -(source (list_lit) @fold) +(source + (list_lit) @fold) diff --git a/queries/commonlisp/highlights.scm b/queries/commonlisp/highlights.scm index 42da34d0e..57775019b 100644 --- a/queries/commonlisp/highlights.scm +++ b/queries/commonlisp/highlights.scm @@ -1,25 +1,48 @@ (sym_lit) @variable - -;; A highlighting for functions/macros in th cl namespace is available in theHamsta/nvim-treesitter-commonlisp +; A highlighting for functions/macros in th cl namespace is available in theHamsta/nvim-treesitter-commonlisp ;(list_lit . (sym_lit) @function.builtin (#cl-standard-function? @function.builtin)) ;(list_lit . (sym_lit) @function.builtin (#cl-standard-macro? @function.macro)) - (dis_expr) @comment (defun_keyword) @function.macro + (defun_header function_name: (_) @function) + (defun_header - lambda_list: (list_lit (sym_lit) @variable.parameter)) + lambda_list: + (list_lit + (sym_lit) @variable.parameter)) + (defun_header - keyword: (defun_keyword "defmethod") - lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @string.special.symbol))) + keyword: + (defun_keyword + "defmethod") + lambda_list: + (list_lit + (list_lit + . + (sym_lit) + . + (sym_lit) @string.special.symbol))) + (defun_header - lambda_list: (list_lit (list_lit . (sym_lit) @variable.parameter . (_)))) + lambda_list: + (list_lit + (list_lit + . + (sym_lit) @variable.parameter + . + (_)))) + (defun_header specifier: (sym_lit) @string.special.symbol) -[":" "::" "."] @punctuation.special +[ + ":" + "::" + "." +] @punctuation.special [ (accumulation_verb) @@ -49,99 +72,126 @@ "return" "initially" ] @function.macro + "=" @operator (include_reader_macro) @string.special.symbol -["#C" "#c"] @number -[(kwd_lit) (self_referential_reader_macro)] @string.special.symbol +[ + "#C" + "#c" +] @number + +[ + (kwd_lit) + (self_referential_reader_macro) +] @string.special.symbol (package_lit package: (_) @module) + "cl" @module (str_lit) @string (num_lit) @number -((sym_lit) @boolean (#any-of? @boolean "t" "T")) +((sym_lit) @boolean + (#any-of? @boolean "t" "T")) (nil_lit) @constant.builtin (comment) @comment @spell -;; dynamic variables +; dynamic variables ((sym_lit) @variable.builtin - (#lua-match? @variable.builtin "^[*].+[*]$")) + (#lua-match? @variable.builtin "^[*].+[*]$")) -;; quote +; quote "'" @string.escape + (format_specifier) @string.escape + (quoting_lit) @string.escape -;; syntax quote +; syntax quote "`" @string.escape + "," @string.escape + ",@" @string.escape + (syn_quoting_lit) @string.escape + (unquoting_lit) @none -(unquote_splicing_lit) @none +(unquote_splicing_lit) @none -["(" ")"] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket (block_comment) @comment @spell - (with_clause type: (_) @type) + (for_clause type: (_) @type) -;; defun-like things +; defun-like things (list_lit - . - (sym_lit) @function.macro - . - (sym_lit) @function - (#eq? @function.macro "deftest")) + . + (sym_lit) @function.macro + . + (sym_lit) @function + (#eq? @function.macro "deftest")) -;;; Macros and Special Operators +; Macros and Special Operators (list_lit - . - (sym_lit) @function.macro - ;; Generated via https://github.com/theHamsta/nvim-treesitter-commonlisp/blob/22fdc9fd6ed594176cc7299cc6f68dd21c94c63b/scripts/generate-symbols.lisp#L1-L21 + . + (sym_lit) @function.macro + ; Generated via https://github.com/theHamsta/nvim-treesitter-commonlisp/blob/22fdc9fd6ed594176cc7299cc6f68dd21c94c63b/scripts/generate-symbols.lisp#L1-L21 ; format-ignore (#any-of? @function.macro "do*" "step" "handler-bind" "decf" "prog1" "destructuring-bind" "defconstant" "do" "lambda" "with-standard-io-syntax" "case" "restart-bind" "ignore-errors" "with-slots" "prog2" "defclass" "define-condition" "print-unreadable-object" "defvar" "when" "with-open-file" "prog" "incf" "declaim" "and" "loop-finish" "multiple-value-bind" "pop" "psetf" "defmacro" "with-open-stream" "define-modify-macro" "defsetf" "formatter" "call-method" "handler-case" "pushnew" "or" "with-hash-table-iterator" "ecase" "cond" "defun" "remf" "ccase" "define-compiler-macro" "dotimes" "multiple-value-list" "assert" "deftype" "with-accessors" "trace" "with-simple-restart" "do-symbols" "nth-value" "define-symbol-macro" "psetq" "rotatef" "dolist" "check-type" "multiple-value-setq" "push" "pprint-pop" "loop" "define-setf-expander" "pprint-exit-if-list-exhausted" "with-condition-restarts" "defstruct" "with-input-from-string" "with-compilation-unit" "defgeneric" "with-output-to-string" "untrace" "defparameter" "ctypecase" "do-external-symbols" "etypecase" "do-all-symbols" "with-package-iterator" "unless" "defmethod" "in-package" "defpackage" "return" "typecase" "shiftf" "setf" "pprint-logical-block" "time" "restart-case" "prog*" "define-method-combination" "optimize")) -;; constant +; constant ((sym_lit) @constant - (#lua-match? @constant "^[+].+[+]$")) + (#lua-match? @constant "^[+].+[+]$")) (var_quoting_lit marker: "#'" @string.special.symbol value: (_) @string.special.symbol) -["#" "#p" "#P"] @string.special.symbol +[ + "#" + "#p" + "#P" +] @string.special.symbol (list_lit . (sym_lit) @function.builtin - ;; Generated via https://github.com/theHamsta/nvim-treesitter-commonlisp/blob/22fdc9fd6ed594176cc7299cc6f68dd21c94c63b/scripts/generate-symbols.lisp#L1-L21 + ; Generated via https://github.com/theHamsta/nvim-treesitter-commonlisp/blob/22fdc9fd6ed594176cc7299cc6f68dd21c94c63b/scripts/generate-symbols.lisp#L1-L21 ; format-ignore (#any-of? @function.builtin - "apropos-list" "subst" "substitute" "pprint-linear" "file-namestring" "write-char" "do*" "slot-exists-p" "file-author" "macro-function" "rassoc" "make-echo-stream" "arithmetic-error-operation" "position-if-not" "list" "cdadr" "lisp-implementation-type" "vector-push" "let" "length" "string-upcase" "adjoin" "digit-char" "step" "member-if" "handler-bind" "lognot" "apply" "gcd" "slot-unbound" "stringp" "values-list" "stable-sort" "decode-float" "make-list" "rplaca" "isqrt" "export" "synonym-stream-symbol" "function-keywords" "replace" "tanh" "maphash" "code-char" "decf" "array-displacement" "string-not-lessp" "slot-value" "remove-if" "cell-error-name" "vectorp" "cdddar" "two-way-stream-output-stream" "parse-integer" "get-internal-real-time" "fourth" "make-string" "slot-missing" "byte-size" "string-trim" "nstring-downcase" "cdaddr" "<" "labels" "interactive-stream-p" "fifth" "max" "logxor" "pathname-name" "function" "realp" "eql" "logand" "short-site-name" "prog1" "user-homedir-pathname" "list-all-packages" "exp" "cadar" "read-char-no-hang" "package-error-package" "stream-external-format" "bit-andc2" "nsubstitute-if" "mapcar" "complement" "load-logical-pathname-translations" "pprint-newline" "oddp" "caaar" "destructuring-bind" "copy-alist" "acos" "go" "bit-nor" "defconstant" "fceiling" "tenth" "nreverse" "=" "nunion" "slot-boundp" "string>" "count-if" "atom" "char=" "random-state-p" "row-major-aref" "bit-andc1" "translate-pathname" "simple-vector-p" "coerce" "substitute-if-not" "zerop" "invalid-method-error" "compile" "realpart" "remove-if-not" "pprint-tab" "hash-table-rehash-threshold" "invoke-restart" "if" "count" "/=" "do" "initialize-instance" "abs" "schar" "simple-condition-format-control" "delete-package" "subst-if" "lambda" "hash-table-count" "array-has-fill-pointer-p" "bit" "with-standard-io-syntax" "parse-namestring" "proclaim" "array-in-bounds-p" "multiple-value-call" "rplacd" "some" "graphic-char-p" "read-from-string" "consp" "cadaar" "acons" "every" "make-pathname" "mask-field" "case" "set-macro-character" "bit-and" "restart-bind" "echo-stream-input-stream" "compile-file" "fill-pointer" "numberp" "acosh" "array-dimensions" "documentation" "minusp" "inspect" "copy-structure" "integer-length" "ensure-generic-function" "char>=" "quote" "lognor" "make-two-way-stream" "ignore-errors" "tailp" "with-slots" "fboundp" "logical-pathname-translations" "equal" "float-sign" "shadow" "sleep" "numerator" "prog2" "getf" "ldb-test" "round" "locally" "echo-stream-output-stream" "log" "get-macro-character" "alphanumericp" "find-method" "nintersection" "defclass" "define-condition" "print-unreadable-object" "defvar" "broadcast-stream-streams" "floatp" "subst-if-not" "integerp" "translate-logical-pathname" "subsetp" "when" "write-string" "with-open-file" "clrhash" "apropos" "intern" "min" "string-greaterp" "import" "nset-difference" "prog" "incf" "both-case-p" "multiple-value-prog1" "characterp" "streamp" "digit-char-p" "random" "string-lessp" "make-string-input-stream" "copy-symbol" "read-sequence" "logcount" "bit-not" "boundp" "encode-universal-time" "third" "declaim" "map" "cons" "set-syntax-from-char" "and" "cis" "symbol-plist" "loop-finish" "standard-char-p" "multiple-value-bind" "asin" "string" "pop" "complex" "fdefinition" "psetf" "type-error-datum" "output-stream-p" "floor" "write-line" "<=" "defmacro" "rational" "hash-table-test" "with-open-stream" "read-char" "string-capitalize" "get-properties" "y-or-n-p" "use-package" "remove" "compiler-macro-function" "read" "package-nicknames" "remove-duplicates" "make-load-form-saving-slots" "dribble" "define-modify-macro" "make-dispatch-macro-character" "close" "cosh" "open" "finish-output" "string-downcase" "car" "nstring-capitalize" "software-type" "read-preserving-whitespace" "cadr" "fround" "nsublis" "defsetf" "find-all-symbols" "char>" "no-applicable-method" "compute-restarts" "pathname" "bit-orc2" "write-sequence" "pprint-tabular" "symbol-value" "char-name" "get-decoded-time" "formatter" "bit-vector-p" "intersection" "pathname-type" "clear-input" "call-method" "princ-to-string" "symbolp" "make-load-form" "nsubst" "pprint-dispatch" "handler-case" "method-combination-error" "probe-file" "atan" "string<" "type-error-expected-type" "pushnew" "unread-char" "print" "or" "with-hash-table-iterator" "make-sequence" "ecase" "unwind-protect" "require" "sixth" "get-dispatch-macro-character" "char-not-lessp" "read-byte" "tagbody" "file-error-pathname" "catch" "rationalp" "char-downcase" "char-int" "array-rank" "cond" "last" "make-string-output-stream" "array-dimension" "host-namestring" "input-stream-p" "decode-universal-time" "defun" "eval-when" "char-code" "pathname-directory" "evenp" "subseq" "pprint" "ftruncate" "make-instance" "pathname-host" "logbitp" "remf" "1+" "copy-pprint-dispatch" "char-upcase" "error" "read-line" "second" "make-package" "directory" "special-operator-p" "open-stream-p" "rassoc-if-not" "ccase" "equalp" "substitute-if" "*" "char/=" "cdr" "sqrt" "lcm" "logical-pathname" "eval" "define-compiler-macro" "nsubstitute-if-not" "mapcon" "imagpart" "set-exclusive-or" "simple-condition-format-arguments" "expt" "concatenate" "file-position" "macrolet" "keywordp" "hash-table-rehash-size" "+" "eighth" "use-value" "char-equal" "bit-xor" "format" "byte" "dotimes" "namestring" "char-not-equal" "multiple-value-list" "assert" "append" "notany" "typep" "delete-file" "makunbound" "cdaar" "file-write-date" ">" "cdddr" "write-to-string" "funcall" "member-if-not" "deftype" "readtable-case" "with-accessors" "truename" "constantp" "rassoc-if" "caaadr" "tree-equal" "nset-exclusive-or" "nsubstitute" "make-instances-obsolete" "package-use-list" "invoke-debugger" "provide" "count-if-not" "trace" "logandc1" "nthcdr" "char<=" "functionp" "with-simple-restart" "set-dispatch-macro-character" "logorc2" "unexport" "rest" "unbound-slot-instance" "make-hash-table" "hash-table-p" "reinitialize-instance" "nth" "do-symbols" "nreconc" "macroexpand" "store-value" "float-precision" "remprop" "nth-value" "define-symbol-macro" "update-instance-for-redefined-class" "identity" "progv" "progn" "return-from" "readtablep" "rem" "symbol-name" "psetq" "wild-pathname-p" "char" "list*" "char<" "plusp" "pairlis" "cddar" "pprint-indent" "union" "compiled-function-p" "rotatef" "abort" "machine-type" "concatenated-stream-streams" "string-right-trim" "enough-namestring" "arithmetic-error-operands" "ceiling" "dolist" "delete" "make-condition" "string-left-trim" "integer-decode-float" "check-type" "notevery" "function-lambda-expression" "-" "multiple-value-setq" "name-char" "push" "pprint-pop" "compile-file-pathname" "list-length" "nstring-upcase" "eq" "find-if" "method-qualifiers" "caadr" "cddr" "string=" "let*" "remove-method" "pathname-match-p" "find-package" "truncate" "caaddr" "get-setf-expansion" "loop" "define-setf-expander" "caddr" "package-shadowing-symbols" "force-output" "slot-makunbound" "string-not-greaterp" "cdadar" "cdaadr" "logandc2" "make-array" "merge-pathnames" "sin" "1-" "machine-version" "ffloor" "packagep" "set-pprint-dispatch" "flet" "gensym" "pprint-exit-if-list-exhausted" "cos" "get" "mapl" "delete-if" "with-condition-restarts" "atanh" "copy-list" "fill" "char-not-greaterp" "bit-orc1" "mod" "package-used-by-list" "warn" "add-method" "simple-string-p" "find-restart" "describe" "pathname-version" "peek-char" "yes-or-no-p" "complexp" "aref" "not" "position-if" "string>=" "defstruct" "float-radix" "ninth" "caadar" "subtypep" "set" "butlast" "allocate-instance" "with-input-from-string" "assoc" "write" "make-random-state" "bit-eqv" "float-digits" "long-site-name" "with-compilation-unit" "delete-duplicates" "make-symbol" "room" "cdar" "pprint-fill" "defgeneric" "macroexpand-1" "scale-float" "cdaaar" "update-instance-for-different-class" "array-row-major-index" "ed" "file-string-length" "ensure-directories-exist" "copy-readtable" "string<=" "seventh" "with-output-to-string" "signum" "elt" "untrace" "null" "defparameter" "block" "prin1" "revappend" "gentemp" "ctypecase" "ash" "sxhash" "listp" "do-external-symbols" "bit-ior" "etypecase" "sort" "change-class" "find-class" "alpha-char-p" "map-into" "terpri" "do-all-symbols" "ldb" "logorc1" "search" "fmakunbound" "load" "character" "string-not-equal" "pathnamep" "make-broadcast-stream" "arrayp" "mapcan" "cerror" "invoke-restart-interactively" "assoc-if-not" "with-package-iterator" "get-internal-run-time" "read-delimited-list" "unless" "lower-case-p" "restart-name" "/" "boole" "defmethod" "float" "software-version" "vector-pop" "vector-push-extend" "caar" "ldiff" "member" "find-symbol" "reduce" "svref" "describe-object" "logior" "string-equal" "type-of" "position" "cddadr" "pathname-device" "get-output-stream-string" "symbol-package" "tan" "compute-applicable-methods" "cddddr" "nsubst-if-not" "sublis" "set-difference" "two-way-stream-input-stream" "adjustable-array-p" "machine-instance" "signal" "conjugate" "caaaar" "endp" "lisp-implementation-version" "cddaar" "package-name" "adjust-array" "bit-nand" "gethash" "in-package" "symbol-function" "make-concatenated-stream" "defpackage" "class-of" "no-next-method" "logeqv" "deposit-field" "disassemble" "unuse-package" "copy-tree" "find" "asinh" "class-name" "rename-file" "values" "print-not-readable-object" "mismatch" "cadadr" "shadowing-import" "delete-if-not" "maplist" "listen" "return" "stream-element-type" "unintern" "merge" "make-synonym-stream" "prin1-to-string" "nsubst-if" "byte-position" "phase" "muffle-warning" "remhash" "continue" "load-time-value" "hash-table-size" "upgraded-complex-part-type" "char-lessp" "sbit" "upgraded-array-element-type" "file-length" "typecase" "cadddr" "first" "rationalize" "logtest" "find-if-not" "dpb" "mapc" "sinh" "char-greaterp" "shiftf" "denominator" "get-universal-time" "nconc" "setf" "lognand" "rename-package" "pprint-logical-block" "break" "symbol-macrolet" "the" "fresh-line" "clear-output" "assoc-if" "string/=" "princ" "directory-namestring" "stream-error-stream" "array-element-type" "setq" "copy-seq" "time" "restart-case" "prog*" "shared-initialize" "array-total-size" "simple-bit-vector-p" "define-method-combination" "write-byte" "constantly" "caddar" "print-object" "vector" "throw" "reverse" ">=" "upper-case-p" "nbutlast")) + "apropos-list" "subst" "substitute" "pprint-linear" "file-namestring" "write-char" "do*" "slot-exists-p" "file-author" "macro-function" "rassoc" "make-echo-stream" "arithmetic-error-operation" "position-if-not" "list" "cdadr" "lisp-implementation-type" "vector-push" "let" "length" "string-upcase" "adjoin" "digit-char" "step" "member-if" "handler-bind" "lognot" "apply" "gcd" "slot-unbound" "stringp" "values-list" "stable-sort" "decode-float" "make-list" "rplaca" "isqrt" "export" "synonym-stream-symbol" "function-keywords" "replace" "tanh" "maphash" "code-char" "decf" "array-displacement" "string-not-lessp" "slot-value" "remove-if" "cell-error-name" "vectorp" "cdddar" "two-way-stream-output-stream" "parse-integer" "get-internal-real-time" "fourth" "make-string" "slot-missing" "byte-size" "string-trim" "nstring-downcase" "cdaddr" "<" "labels" "interactive-stream-p" "fifth" "max" "logxor" "pathname-name" "function" "realp" "eql" "logand" "short-site-name" "prog1" "user-homedir-pathname" "list-all-packages" "exp" "cadar" "read-char-no-hang" "package-error-package" "stream-external-format" "bit-andc2" "nsubstitute-if" "mapcar" "complement" "load-logical-pathname-translations" "pprint-newline" "oddp" "caaar" "destructuring-bind" "copy-alist" "acos" "go" "bit-nor" "defconstant" "fceiling" "tenth" "nreverse" "=" "nunion" "slot-boundp" "string>" "count-if" "atom" "char=" "random-state-p" "row-major-aref" "bit-andc1" "translate-pathname" "simple-vector-p" "coerce" "substitute-if-not" "zerop" "invalid-method-error" "compile" "realpart" "remove-if-not" "pprint-tab" "hash-table-rehash-threshold" "invoke-restart" "if" "count" "/=" "do" "initialize-instance" "abs" "schar" "simple-condition-format-control" "delete-package" "subst-if" "lambda" "hash-table-count" "array-has-fill-pointer-p" "bit" "with-standard-io-syntax" "parse-namestring" "proclaim" "array-in-bounds-p" "multiple-value-call" "rplacd" "some" "graphic-char-p" "read-from-string" "consp" "cadaar" "acons" "every" "make-pathname" "mask-field" "case" "set-macro-character" "bit-and" "restart-bind" "echo-stream-input-stream" "compile-file" "fill-pointer" "numberp" "acosh" "array-dimensions" "documentation" "minusp" "inspect" "copy-structure" "integer-length" "ensure-generic-function" "char>=" "quote" "lognor" "make-two-way-stream" "ignore-errors" "tailp" "with-slots" "fboundp" "logical-pathname-translations" "equal" "float-sign" "shadow" "sleep" "numerator" "prog2" "getf" "ldb-test" "round" "locally" "echo-stream-output-stream" "log" "get-macro-character" "alphanumericp" "find-method" "nintersection" "defclass" "define-condition" "print-unreadable-object" "defvar" "broadcast-stream-streams" "floatp" "subst-if-not" "integerp" "translate-logical-pathname" "subsetp" "when" "write-string" "with-open-file" "clrhash" "apropos" "intern" "min" "string-greaterp" "import" "nset-difference" "prog" "incf" "both-case-p" "multiple-value-prog1" "characterp" "streamp" "digit-char-p" "random" "string-lessp" "make-string-input-stream" "copy-symbol" "read-sequence" "logcount" "bit-not" "boundp" "encode-universal-time" "third" "declaim" "map" "cons" "set-syntax-from-char" "and" "cis" "symbol-plist" "loop-finish" "standard-char-p" "multiple-value-bind" "asin" "string" "pop" "complex" "fdefinition" "psetf" "type-error-datum" "output-stream-p" "floor" "write-line" "<=" "defmacro" "rational" "hash-table-test" "with-open-stream" "read-char" "string-capitalize" "get-properties" "y-or-n-p" "use-package" "remove" "compiler-macro-function" "read" "package-nicknames" "remove-duplicates" "make-load-form-saving-slots" "dribble" "define-modify-macro" "make-dispatch-macro-character" "close" "cosh" "open" "finish-output" "string-downcase" "car" "nstring-capitalize" "software-type" "read-preserving-whitespace" "cadr" "fround" "nsublis" "defsetf" "find-all-symbols" "char>" "no-applicable-method" "compute-restarts" "pathname" "bit-orc2" "write-sequence" "pprint-tabular" "symbol-value" "char-name" "get-decoded-time" "formatter" "bit-vector-p" "intersection" "pathname-type" "clear-input" "call-method" "princ-to-string" "symbolp" "make-load-form" "nsubst" "pprint-dispatch" "handler-case" "method-combination-error" "probe-file" "atan" "string<" "type-error-expected-type" "pushnew" "unread-char" "print" "or" "with-hash-table-iterator" "make-sequence" "ecase" "unwind-protect" "require" "sixth" "get-dispatch-macro-character" "char-not-lessp" "read-byte" "tagbody" "file-error-pathname" "catch" "rationalp" "char-downcase" "char-int" "array-rank" "cond" "last" "make-string-output-stream" "array-dimension" "host-namestring" "input-stream-p" "decode-universal-time" "defun" "eval-when" "char-code" "pathname-directory" "evenp" "subseq" "pprint" "ftruncate" "make-instance" "pathname-host" "logbitp" "remf" "1+" "copy-pprint-dispatch" "char-upcase" "error" "read-line" "second" "make-package" "directory" "special-operator-p" "open-stream-p" "rassoc-if-not" "ccase" "equalp" "substitute-if" "*" "char/=" "cdr" "sqrt" "lcm" "logical-pathname" "eval" "define-compiler-macro" "nsubstitute-if-not" "mapcon" "imagpart" "set-exclusive-or" "simple-condition-format-arguments" "expt" "concatenate" "file-position" "macrolet" "keywordp" "hash-table-rehash-size" "+" "eighth" "use-value" "char-equal" "bit-xor" "format" "byte" "dotimes" "namestring" "char-not-equal" "multiple-value-list" "assert" "append" "notany" "typep" "delete-file" "makunbound" "cdaar" "file-write-date" ">" "cdddr" "write-to-string" "funcall" "member-if-not" "deftype" "readtable-case" "with-accessors" "truename" "constantp" "rassoc-if" "caaadr" "tree-equal" "nset-exclusive-or" "nsubstitute" "make-instances-obsolete" "package-use-list" "invoke-debugger" "provide" "count-if-not" "trace" "logandc1" "nthcdr" "char<=" "functionp" "with-simple-restart" "set-dispatch-macro-character" "logorc2" "unexport" "rest" "unbound-slot-instance" "make-hash-table" "hash-table-p" "reinitialize-instance" "nth" "do-symbols" "nreconc" "macroexpand" "store-value" "float-precision" "remprop" "nth-value" "define-symbol-macro" "update-instance-for-redefined-class" "identity" "progv" "progn" "return-from" "readtablep" "rem" "symbol-name" "psetq" "wild-pathname-p" "char" "list*" "char<" "plusp" "pairlis" "cddar" "pprint-indent" "union" "compiled-function-p" "rotatef" "abort" "machine-type" "concatenated-stream-streams" "string-right-trim" "enough-namestring" "arithmetic-error-operands" "ceiling" "dolist" "delete" "make-condition" "string-left-trim" "integer-decode-float" "check-type" "notevery" "function-lambda-expression" "-" "multiple-value-setq" "name-char" "push" "pprint-pop" "compile-file-pathname" "list-length" "nstring-upcase" "eq" "find-if" "method-qualifiers" "caadr" "cddr" "string=" "let*" "remove-method" "pathname-match-p" "find-package" "truncate" "caaddr" "get-setf-expansion" "loop" "define-setf-expander" "caddr" "package-shadowing-symbols" "force-output" "slot-makunbound" "string-not-greaterp" "cdadar" "cdaadr" "logandc2" "make-array" "merge-pathnames" "sin" "1-" "machine-version" "ffloor" "packagep" "set-pprint-dispatch" "flet" "gensym" "pprint-exit-if-list-exhausted" "cos" "get" "mapl" "delete-if" "with-condition-restarts" "atanh" "copy-list" "fill" "char-not-greaterp" "bit-orc1" "mod" "package-used-by-list" "warn" "add-method" "simple-string-p" "find-restart" "describe" "pathname-version" "peek-char" "yes-or-no-p" "complexp" "aref" "not" "position-if" "string>=" "defstruct" "float-radix" "ninth" "caadar" "subtypep" "set" "butlast" "allocate-instance" "with-input-from-string" "assoc" "write" "make-random-state" "bit-eqv" "float-digits" "long-site-name" "with-compilation-unit" "delete-duplicates" "make-symbol" "room" "cdar" "pprint-fill" "defgeneric" "macroexpand-1" "scale-float" "cdaaar" "update-instance-for-different-class" "array-row-major-index" "ed" "file-string-length" "ensure-directories-exist" "copy-readtable" "string<=" "seventh" "with-output-to-string" "signum" "elt" "untrace" "null" "defparameter" "block" "prin1" "revappend" "gentemp" "ctypecase" "ash" "sxhash" "listp" "do-external-symbols" "bit-ior" "etypecase" "sort" "change-class" "find-class" "alpha-char-p" "map-into" "terpri" "do-all-symbols" "ldb" "logorc1" "search" "fmakunbound" "load" "character" "string-not-equal" "pathnamep" "make-broadcast-stream" "arrayp" "mapcan" "cerror" "invoke-restart-interactively" "assoc-if-not" "with-package-iterator" "get-internal-run-time" "read-delimited-list" "unless" "lower-case-p" "restart-name" "/" "boole" "defmethod" "float" "software-version" "vector-pop" "vector-push-extend" "caar" "ldiff" "member" "find-symbol" "reduce" "svref" "describe-object" "logior" "string-equal" "type-of" "position" "cddadr" "pathname-device" "get-output-stream-string" "symbol-package" "tan" "compute-applicable-methods" "cddddr" "nsubst-if-not" "sublis" "set-difference" "two-way-stream-input-stream" "adjustable-array-p" "machine-instance" "signal" "conjugate" "caaaar" "endp" "lisp-implementation-version" "cddaar" "package-name" "adjust-array" "bit-nand" "gethash" "in-package" "symbol-function" "make-concatenated-stream" "defpackage" "class-of" "no-next-method" "logeqv" "deposit-field" "disassemble" "unuse-package" "copy-tree" "find" "asinh" "class-name" "rename-file" "values" "print-not-readable-object" "mismatch" "cadadr" "shadowing-import" "delete-if-not" "maplist" "listen" "return" "stream-element-type" "unintern" "merge" "make-synonym-stream" "prin1-to-string" "nsubst-if" "byte-position" "phase" "muffle-warning" "remhash" "continue" "load-time-value" "hash-table-size" "upgraded-complex-part-type" "char-lessp" "sbit" "upgraded-array-element-type" "file-length" "typecase" "cadddr" "first" "rationalize" "logtest" "find-if-not" "dpb" "mapc" "sinh" "char-greaterp" "shiftf" "denominator" "get-universal-time" "nconc" "setf" "lognand" "rename-package" "pprint-logical-block" "break" "symbol-macrolet" "the" "fresh-line" "clear-output" "assoc-if" "string/=" "princ" "directory-namestring" "stream-error-stream" "array-element-type" "setq" "copy-seq" "time" "restart-case" "prog*" "shared-initialize" "array-total-size" "simple-bit-vector-p" "define-method-combination" "write-byte" "constantly" "caddar" "print-object" "vector" "throw" "reverse" ">=" "upper-case-p" "nbutlast") + ) (list_lit - . - (sym_lit) @operator - (#match? @operator "^([+*-+=<>]|<=|>=|/=)$")) - + . + (sym_lit) @operator + (#match? @operator "^([+*-+=<>]|<=|>=|/=)$")) ((sym_lit) @string.special.symbol -(#lua-match? @string.special.symbol "^[&]")) + (#lua-match? @string.special.symbol "^[&]")) -[(array_dimension) "#0A" "#0a"] @number +[ + (array_dimension) + "#0A" + "#0a" +] @number (char_lit) @character diff --git a/queries/commonlisp/locals.scm b/queries/commonlisp/locals.scm index 647d1007f..2865c1f0f 100644 --- a/queries/commonlisp/locals.scm +++ b/queries/commonlisp/locals.scm @@ -1,72 +1,113 @@ - (defun_header - function_name: (sym_lit) @local.definition.function (#set! definition.function.scope "parent")) + function_name: (sym_lit) @local.definition.function + (#set! definition.function.scope "parent")) + (defun_header - lambda_list: (list_lit (sym_lit) @local.definition.parameter)) + lambda_list: + (list_lit + (sym_lit) @local.definition.parameter)) (defun_header - keyword: (defun_keyword "defmethod") - lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @local.definition.type))) + keyword: + (defun_keyword + "defmethod") + lambda_list: + (list_lit + (list_lit + . + (sym_lit) + . + (sym_lit) @local.definition.type))) + (defun_header - lambda_list: (list_lit (list_lit . (sym_lit) @local.definition.parameter . (_)))) + lambda_list: + (list_lit + (list_lit + . + (sym_lit) @local.definition.parameter + . + (_)))) (sym_lit) @local.reference (defun) @local.scope -((list_lit . (sym_lit) @_defvar . (sym_lit) @local.definition.var) -(#match? @_defvar "^(cl:)?(defvar|defparameter)$")) +((list_lit + . + (sym_lit) @_defvar + . + (sym_lit) @local.definition.var) + (#match? @_defvar "^(cl:)?(defvar|defparameter)$")) (list_lit - . - (sym_lit) @_deftest - . - (sym_lit) @local.definition.function - (#eq? @_deftest "deftest")) @local.scope + . + (sym_lit) @_deftest + . + (sym_lit) @local.definition.function + (#eq? @_deftest "deftest")) @local.scope (list_lit - . - (sym_lit) @_deftest - . - (sym_lit) @local.definition.function - (#eq? @_deftest "deftest")) @local.scope + . + (sym_lit) @_deftest + . + (sym_lit) @local.definition.function + (#eq? @_deftest "deftest")) @local.scope + +(for_clause + . + (sym_lit) @local.definition.var) + +(with_clause + . + (sym_lit) @local.definition.var) -(for_clause . (sym_lit) @local.definition.var) -(with_clause . (sym_lit) @local.definition.var) (loop_macro) @local.scope (list_lit - . - (sym_lit) @_let (#match? @_let "(cl:|cffi:)?(with-accessors|with-foreign-objects|let[*]?)") - . - (list_lit (list_lit . (sym_lit) @local.definition.var))) @local.scope + . + (sym_lit) @_let + (#match? @_let "(cl:|cffi:)?(with-accessors|with-foreign-objects|let[*]?)") + . + (list_lit + (list_lit + . + (sym_lit) @local.definition.var))) @local.scope (list_lit - . - (sym_lit) @_let (#match? @_let "(cl:|alexandria:)?(with-gensyms|dotimes|with-foreign-object)") - . - (list_lit . (sym_lit) @local.definition.var)) @local.scope + . + (sym_lit) @_let + (#match? @_let "(cl:|alexandria:)?(with-gensyms|dotimes|with-foreign-object)") + . + (list_lit + . + (sym_lit) @local.definition.var)) @local.scope (list_lit - . - (kwd_lit) @_import_from (#eq? @_import_from ":import-from") - . - (_) - (kwd_lit (kwd_symbol) @local.definition.import)) + . + (kwd_lit) @_import_from + (#eq? @_import_from ":import-from") + . + (_) + (kwd_lit + (kwd_symbol) @local.definition.import)) (list_lit - . - (kwd_lit) @_import_from (#eq? @_import_from ":import-from") - . - (_) - (sym_lit) @local.definition.import) + . + (kwd_lit) @_import_from + (#eq? @_import_from ":import-from") + . + (_) + (sym_lit) @local.definition.import) (list_lit - . - (kwd_lit) @_use (#eq? @_use ":use") - (kwd_lit (kwd_symbol) @local.definition.import)) + . + (kwd_lit) @_use + (#eq? @_use ":use") + (kwd_lit + (kwd_symbol) @local.definition.import)) (list_lit - . - (kwd_lit) @_use (#eq? @_use ":use") - (sym_lit) @local.definition.import) + . + (kwd_lit) @_use + (#eq? @_use ":use") + (sym_lit) @local.definition.import) diff --git a/queries/cooklang/highlights.scm b/queries/cooklang/highlights.scm index 2ed9f2049..cd4eedade 100644 --- a/queries/cooklang/highlights.scm +++ b/queries/cooklang/highlights.scm @@ -3,20 +3,20 @@ (ingredient "@" @tag (name)? @markup.heading - (amount - (quantity)? @number - (units)? @tag.attribute)?) + (amount + (quantity)? @number + (units)? @tag.attribute)?) (timer "~" @tag (name)? @markup.heading - (amount - (quantity)? @number - (units)? @tag.attribute)?) + (amount + (quantity)? @number + (units)? @tag.attribute)?) (cookware "#" @tag (name)? @markup.heading - (amount - (quantity)? @number - (units)? @tag.attribute)?) + (amount + (quantity)? @number + (units)? @tag.attribute)?) diff --git a/queries/corn/folds.scm b/queries/corn/folds.scm index c081ecb47..2ce5ddb31 100644 --- a/queries/corn/folds.scm +++ b/queries/corn/folds.scm @@ -1,5 +1,5 @@ [ - (object) - (array) - (assign_block) + (object) + (array) + (assign_block) ] @fold diff --git a/queries/corn/highlights.scm b/queries/corn/highlights.scm index 18672fd04..029291462 100644 --- a/queries/corn/highlights.scm +++ b/queries/corn/highlights.scm @@ -1,4 +1,5 @@ "let" @keyword + "in" @keyword [ @@ -11,10 +12,15 @@ "." @punctuation.delimiter (input) @constant + (comment) @comment @spell (string) @string + (integer) @number + (float) @number.float + (boolean) @boolean + (null) @keyword diff --git a/queries/corn/indents.scm b/queries/corn/indents.scm index 1f5a2c402..f1f5e04da 100644 --- a/queries/corn/indents.scm +++ b/queries/corn/indents.scm @@ -1,14 +1,24 @@ [ - (assign_block "{") - (object) - (array) + (assign_block + "{") + (object) + (array) ] @indent.begin -(assign_block "}" @indent.branch) -(assign_block "}" @indent.end) +(assign_block + "}" @indent.branch) -(object "}" @indent.branch) -(object "}" @indent.end) +(assign_block + "}" @indent.end) -(array "]" @indent.branch) -(array "]" @indent.end) +(object + "}" @indent.branch) + +(object + "}" @indent.end) + +(array + "]" @indent.branch) + +(array + "]" @indent.end) diff --git a/queries/corn/locals.scm b/queries/corn/locals.scm index 009d29202..7e78c4d23 100644 --- a/queries/corn/locals.scm +++ b/queries/corn/locals.scm @@ -1,16 +1,13 @@ ; scopes - [ (object) (array) ] @local.scope ; definitions - -(assign_block +(assign_block (assignment - (input) - @local.definition.constant)) - -(value (input) @local.reference) + (input) @local.definition.constant)) +(value + (input) @local.reference) diff --git a/queries/cpon/highlights.scm b/queries/cpon/highlights.scm index 370c48b1b..531b3961f 100644 --- a/queries/cpon/highlights.scm +++ b/queries/cpon/highlights.scm @@ -1,6 +1,6 @@ ; Literals - (string) @string + (escape_sequence) @string.escape (hex_blob @@ -15,7 +15,8 @@ "d" @character.special (_) @string.special) -(_ key: (_) @label) +(_ + key: (_) @label) (number) @number @@ -26,21 +27,28 @@ (null) @constant.builtin ; Punctuation - [ "," ":" ] @punctuation.delimiter -[ "{" "}" ] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "<" ">" ] @punctuation.bracket +[ + "<" + ">" +] @punctuation.bracket (("\"" @string) - (#set! conceal "")) + (#set! conceal "")) ; Comments - (comment) @comment @spell diff --git a/queries/cpon/injections.scm b/queries/cpon/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/cpon/injections.scm +++ b/queries/cpon/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cpon/locals.scm b/queries/cpon/locals.scm index 8341b9725..2a4ba4712 100644 --- a/queries/cpon/locals.scm +++ b/queries/cpon/locals.scm @@ -1,6 +1,5 @@ [ - (document) - + (document) (meta_map) (map) (array) diff --git a/queries/cpp/folds.scm b/queries/cpp/folds.scm index 23d623b04..26a068a55 100644 --- a/queries/cpp/folds.scm +++ b/queries/cpp/folds.scm @@ -1,14 +1,13 @@ ; 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) + (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 diff --git a/queries/cpp/highlights.scm b/queries/cpp/highlights.scm index 4919a1b3f..cb8f9c3f3 100644 --- a/queries/cpp/highlights.scm +++ b/queries/cpp/highlights.scm @@ -1,5 +1,4 @@ ; inherits: c - ((identifier) @variable.member (#lua-match? @variable.member "^m_.*$")) @@ -8,23 +7,24 @@ ; function(Foo ...foo) (variadic_parameter_declaration - declarator: (variadic_declarator - (_) @variable.parameter)) + declarator: + (variadic_declarator + (_) @variable.parameter)) + ; int foo = 0 (optional_parameter_declaration - declarator: (_) @variable.parameter) + declarator: (_) @variable.parameter) ;(field_expression) @variable.parameter ;; How to highlight this? - (((field_expression - (field_identifier) @function.method)) @_parent - (#has-parent? @_parent template_method function_declarator)) + (field_identifier) @function.method)) @_parent + (#has-parent? @_parent template_method function_declarator)) (field_declaration (field_identifier) @variable.member) (field_initializer - (field_identifier) @property) + (field_identifier) @property) (function_declarator declarator: (field_identifier) @function.method) @@ -38,13 +38,25 @@ (auto) @type.builtin (namespace_identifier) @module + ((namespace_identifier) @type (#lua-match? @type "^[%u]")) (case_statement - value: (qualified_identifier (identifier) @constant)) + value: + (qualified_identifier + (identifier) @constant)) -(using_declaration . "using" . "namespace" . [(qualified_identifier) (identifier)] @module) +(using_declaration + . + "using" + . + "namespace" + . + [ + (qualified_identifier) + (identifier) + ] @module) (destructor_name (identifier) @function.method) @@ -53,15 +65,18 @@ (function_declarator (qualified_identifier (identifier) @function)) + (function_declarator (qualified_identifier (qualified_identifier (identifier) @function))) + (function_declarator (qualified_identifier (qualified_identifier (qualified_identifier (identifier) @function)))) + ((qualified_identifier (qualified_identifier (qualified_identifier @@ -74,21 +89,26 @@ (identifier) @function)) (operator_name) @function + "operator" @function + "static_assert" @function.builtin (call_expression (qualified_identifier (identifier) @function.call)) + (call_expression (qualified_identifier (qualified_identifier (identifier) @function.call))) + (call_expression (qualified_identifier (qualified_identifier (qualified_identifier (identifier) @function.call)))) + ((qualified_identifier (qualified_identifier (qualified_identifier @@ -99,21 +119,25 @@ (call_expression (template_function (identifier) @function.call)) + (call_expression (qualified_identifier (template_function (identifier) @function.call))) + (call_expression (qualified_identifier (qualified_identifier (template_function (identifier) @function.call)))) + (call_expression (qualified_identifier (qualified_identifier (qualified_identifier (template_function (identifier) @function.call))))) + ((qualified_identifier (qualified_identifier (qualified_identifier @@ -126,12 +150,12 @@ (function_declarator (template_method (field_identifier) @function.method)) + (call_expression (field_expression (field_identifier) @function.method.call)) ; constructors - ((function_declarator (qualified_identifier (identifier) @constructor)) @@ -139,93 +163,91 @@ ((call_expression function: (identifier) @constructor) -(#lua-match? @constructor "^%u")) + (#lua-match? @constructor "^%u")) + ((call_expression - function: (qualified_identifier - name: (identifier) @constructor)) -(#lua-match? @constructor "^%u")) + function: + (qualified_identifier + name: (identifier) @constructor)) + (#lua-match? @constructor "^%u")) ((call_expression - function: (field_expression - field: (field_identifier) @constructor)) -(#lua-match? @constructor "^%u")) + function: + (field_expression + field: (field_identifier) @constructor)) + (#lua-match? @constructor "^%u")) -;; constructing a type in an initializer list: Constructor (): **SuperType (1)** +; constructing a type in an initializer list: Constructor (): **SuperType (1)** ((field_initializer (field_identifier) @constructor (argument_list)) - (#lua-match? @constructor "^%u")) - + (#lua-match? @constructor "^%u")) ; Constants - (this) @variable.builtin -(null "nullptr" @constant.builtin) + +(null + "nullptr" @constant.builtin) (true) @boolean + (false) @boolean ; Literals - -(raw_string_literal) @string +(raw_string_literal) @string ; Keywords - [ - "try" - "catch" - "noexcept" - "throw" + "try" + "catch" + "noexcept" + "throw" ] @keyword.exception - [ - "class" - "decltype" - "explicit" - "friend" - "namespace" - "override" - "template" - "typename" - "using" - "concept" - "requires" - "constexpr" + "class" + "decltype" + "explicit" + "friend" + "namespace" + "override" + "template" + "typename" + "using" + "concept" + "requires" + "constexpr" ] @keyword -[ - "co_await" -] @keyword.coroutine +"co_await" @keyword.coroutine [ - "co_yield" - "co_return" + "co_yield" + "co_return" ] @keyword.coroutine.return [ - "public" - "private" - "protected" - "virtual" - "final" + "public" + "private" + "protected" + "virtual" + "final" ] @type.qualifier [ - "new" - "delete" - - "xor" - "bitand" - "bitor" - "compl" - "not" - "xor_eq" - "and_eq" - "or_eq" - "not_eq" - "and" - "or" + "new" + "delete" + "xor" + "bitand" + "bitor" + "compl" + "not" + "xor_eq" + "and_eq" + "or_eq" + "not_eq" + "and" + "or" ] @keyword.operator "<=>" @operator @@ -233,9 +255,15 @@ "::" @punctuation.delimiter (template_argument_list - ["<" ">"] @punctuation.bracket) + [ + "<" + ">" + ] @punctuation.bracket) (template_parameter_list - ["<" ">"] @punctuation.bracket) + [ + "<" + ">" + ] @punctuation.bracket) (literal_suffix) @operator diff --git a/queries/cpp/indents.scm b/queries/cpp/indents.scm index 6faa6f144..be6826d6e 100644 --- a/queries/cpp/indents.scm +++ b/queries/cpp/indents.scm @@ -1,9 +1,7 @@ ; inherits: c - -[ - (condition_clause) -] @indent.begin +(condition_clause) @indent.begin ((field_initializer_list) @indent.begin (#set! indent.start_at_same_line 1)) + (access_specifier) @indent.branch diff --git a/queries/cpp/injections.scm b/queries/cpp/injections.scm index 75f851367..2038347a2 100644 --- a/queries/cpp/injections.scm +++ b/queries/cpp/injections.scm @@ -1,8 +1,5 @@ ((preproc_arg) @injection.content - (#set! injection.language "cpp")) - -((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "cpp")) ((comment) @injection.content (#lua-match? @injection.content "/[*][!<*][^a-zA-Z]") diff --git a/queries/cpp/locals.scm b/queries/cpp/locals.scm index d8bb18c05..863f9de7d 100644 --- a/queries/cpp/locals.scm +++ b/queries/cpp/locals.scm @@ -1,12 +1,14 @@ ; inherits: c - -;; Parameters +; Parameters (variadic_parameter_declaration - declarator: (variadic_declarator - (identifier) @local.definition.parameter)) + declarator: + (variadic_declarator + (identifier) @local.definition.parameter)) + (optional_parameter_declaration declarator: (identifier) @local.definition.parameter) -;; Class / struct definitions + +; Class / struct definitions (class_specifier) @local.scope (reference_declarator @@ -16,8 +18,9 @@ (identifier) @local.definition.var) (struct_specifier - name: (qualified_identifier - name: (type_identifier) @local.definition.type)) + name: + (qualified_identifier + name: (type_identifier) @local.definition.type)) (class_specifier name: (type_identifier) @local.definition.type) @@ -26,8 +29,9 @@ name: (identifier) @local.definition.type) (class_specifier - name: (qualified_identifier - name: (type_identifier) @local.definition.type)) + name: + (qualified_identifier + name: (type_identifier) @local.definition.type)) (alias_declaration name: (type_identifier) @local.definition.type) @@ -35,9 +39,10 @@ ;template <typename T> (type_parameter_declaration (type_identifier) @local.definition.type) + (template_declaration) @local.scope -;; Namespaces +; Namespaces (namespace_definition name: (namespace_identifier) @local.definition.namespace body: (_) @local.scope) @@ -47,9 +52,9 @@ body: (_) @local.scope) ((namespace_identifier) @local.reference - (#set! reference.kind "namespace")) + (#set! reference.kind "namespace")) -;; Function definitions +; Function definitions (template_function name: (identifier) @local.definition.function) @local.scope @@ -57,16 +62,18 @@ name: (field_identifier) @local.definition.method) @local.scope (function_declarator - declarator: (qualified_identifier - name: (identifier) @local.definition.function)) @local.scope + declarator: + (qualified_identifier + name: (identifier) @local.definition.function)) @local.scope (field_declaration - declarator: (function_declarator - (field_identifier) @local.definition.method)) + declarator: + (function_declarator + (field_identifier) @local.definition.method)) (lambda_expression) @local.scope -;; Control structures +; Control structures (try_statement body: (_) @local.scope) diff --git a/queries/css/folds.scm b/queries/css/folds.scm index 9d2995c48..2c244d63f 100644 --- a/queries/css/folds.scm +++ b/queries/css/folds.scm @@ -1,3 +1 @@ -[ - (rule_set) -] @fold +(rule_set) @fold diff --git a/queries/css/highlights.scm b/queries/css/highlights.scm index 8beba125f..506f78251 100644 --- a/queries/css/highlights.scm +++ b/queries/css/highlights.scm @@ -1,92 +1,99 @@ [ - "@media" - "@charset" - "@namespace" - "@supports" - "@keyframes" - (at_keyword) - (to) - (from) - ] @keyword + "@media" + "@charset" + "@namespace" + "@supports" + "@keyframes" + (at_keyword) + (to) + (from) +] @keyword "@import" @keyword.import (comment) @comment @spell [ - (tag_name) - (nesting_selector) - (universal_selector) - ] @type + (tag_name) + (nesting_selector) + (universal_selector) +] @type (function_name) @function [ - "~" - ">" - "+" - "-" - "*" - "/" - "=" - "^=" - "|=" - "~=" - "$=" - "*=" - ] @operator + "~" + ">" + "+" + "-" + "*" + "/" + "=" + "^=" + "|=" + "~=" + "$=" + "*=" +] @operator [ - "and" - "or" - "not" - "only" - ] @keyword.operator + "and" + "or" + "not" + "only" +] @keyword.operator (important) @type.qualifier -(attribute_selector (plain_value) @string) -(pseudo_element_selector "::" (tag_name) @property) -(pseudo_class_selector (class_name) @property) +(attribute_selector + (plain_value) @string) + +(pseudo_element_selector + "::" + (tag_name) @property) + +(pseudo_class_selector + (class_name) @property) [ - (class_name) - (id_name) - (property_name) - (feature_name) - (attribute_name) - ] @property + (class_name) + (id_name) + (property_name) + (feature_name) + (attribute_name) +] @property (namespace_name) @module ((property_name) @type.definition (#lua-match? @type.definition "^[-][-]")) + ((plain_value) @type (#lua-match? @type "^[-][-]")) [ - (string_value) - (color_value) - (unit) - ] @string + (string_value) + (color_value) + (unit) +] @string [ - (integer_value) - (float_value) - ] @number + (integer_value) + (float_value) +] @number [ - "#" - "," - "." - ":" - "::" - ";" - ] @punctuation.delimiter + "#" + "," + "." + ":" + "::" + ";" +] @punctuation.delimiter [ - "{" - ")" - "(" - "}" - ] @punctuation.bracket + "{" + ")" + "(" + "}" +] @punctuation.bracket diff --git a/queries/css/indents.scm b/queries/css/indents.scm index cd22ed66c..8385bfc82 100644 --- a/queries/css/indents.scm +++ b/queries/css/indents.scm @@ -3,7 +3,9 @@ (declaration) ] @indent.begin -(block ("}") @indent.branch) +(block + ("}") @indent.branch) + ("}") @indent.dedent (comment) @indent.ignore diff --git a/queries/css/injections.scm b/queries/css/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/css/injections.scm +++ b/queries/css/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/csv/highlights.scm b/queries/csv/highlights.scm index de2213aa1..94abe21cc 100644 --- a/queries/csv/highlights.scm +++ b/queries/csv/highlights.scm @@ -1,3 +1,2 @@ ; inherits: tsv - "," @punctuation.delimiter diff --git a/queries/cuda/highlights.scm b/queries/cuda/highlights.scm index 0a90dbf67..0b2a13e49 100644 --- a/queries/cuda/highlights.scm +++ b/queries/cuda/highlights.scm @@ -1,6 +1,8 @@ ; inherits: cpp - -[ "<<<" ">>>" ] @punctuation.bracket +[ + "<<<" + ">>>" +] @punctuation.bracket [ "__host__" diff --git a/queries/cuda/injections.scm b/queries/cuda/injections.scm index 82aac968e..0259958c5 100644 --- a/queries/cuda/injections.scm +++ b/queries/cuda/injections.scm @@ -1,5 +1,5 @@ ((preproc_arg) @injection.content - (#set! injection.language "cuda")) + (#set! injection.language "cuda")) -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cue/highlights.scm b/queries/cue/highlights.scm index 47fd36311..3371bc33e 100644 --- a/queries/cue/highlights.scm +++ b/queries/cue/highlights.scm @@ -1,49 +1,41 @@ ; Includes - [ "package" "import" ] @keyword.import ; Namespaces - (package_identifier) @module -(import_spec ["." "_"] @punctuation.special) +(import_spec + [ + "." + "_" + ] @punctuation.special) [ (attr_path) (package_path) -] @string.special.url ;; In attributes +] @string.special.url ; In attributes ; Attributes - (attribute) @attribute ; Conditionals - "if" @keyword.conditional ; Repeats +"for" @keyword.repeat -[ - "for" -] @keyword.repeat - -(for_clause "_" @punctuation.special) +(for_clause + "_" @punctuation.special) ; Keywords +"let" @keyword -[ - "let" -] @keyword - -[ - "in" -] @keyword.operator +"in" @keyword.operator ; Operators - [ "+" "-" @@ -66,34 +58,33 @@ ] @operator ; Fields & Properties - -(field - (label - (identifier) @variable.member)) +(field + (label + (identifier) @variable.member)) (selector_expression (_) (identifier) @property) ; Functions - (call_expression function: (identifier) @function.call) + (call_expression - function: (selector_expression - (_) - (identifier) @function.call)) + function: + (selector_expression + (_) + (identifier) @function.call)) + (call_expression function: (builtin_function) @function.call) (builtin_function) @function.builtin ; Variables - (identifier) @variable ; Types - (primitive_type) @type.builtin ((identifier) @type @@ -102,22 +93,33 @@ [ (slice_type) (pointer_type) -] @type ;; In attributes +] @type ; In attributes ; Punctuation - [ "," ":" ] @punctuation.delimiter -[ "{" "}" ] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -[ "<" ">" ] @punctuation.bracket +[ + "<" + ">" +] @punctuation.bracket [ (ellipsis) @@ -125,7 +127,6 @@ ] @punctuation.special ; Literals - (string) @string [ @@ -150,11 +151,15 @@ ] @constant.builtin ; Interpolations +(interpolation + "\\(" @punctuation.special + (_) + ")" @punctuation.special) @none -(interpolation "\\(" @punctuation.special (_) ")" @punctuation.special) @none - -(interpolation "\\(" (identifier) @variable ")") +(interpolation + "\\(" + (identifier) @variable + ")") ; Comments - (comment) @comment @spell diff --git a/queries/cue/indents.scm b/queries/cue/indents.scm index 71a03a778..cef2345cc 100644 --- a/queries/cue/indents.scm +++ b/queries/cue/indents.scm @@ -9,11 +9,20 @@ ")" ] @indent.end -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch [ (ERROR) diff --git a/queries/cue/injections.scm b/queries/cue/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/cue/injections.scm +++ b/queries/cue/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cue/locals.scm b/queries/cue/locals.scm index bdc4a56a2..9c5a7378e 100644 --- a/queries/cue/locals.scm +++ b/queries/cue/locals.scm @@ -1,5 +1,4 @@ ; Scopes - [ (source_file) (field) @@ -7,17 +6,15 @@ ] @local.scope ; References - (identifier) @local.reference ; Definitions - (import_spec path: (string) @local.definition.import) (field (label - (identifier) @local.definition.field)) + (identifier) @local.definition.field)) (package_identifier) @local.definition.namespace diff --git a/queries/d/highlights.scm b/queries/d/highlights.scm index 18ced7246..2b63dd48c 100644 --- a/queries/d/highlights.scm +++ b/queries/d/highlights.scm @@ -1,5 +1,4 @@ -;; Misc - +; Misc [ (line_comment) (block_comment) @@ -8,6 +7,7 @@ ((line_comment) @comment.documentation (#lua-match? @comment.documentation "^///[^/]")) + ((line_comment) @comment.documentation (#lua-match? @comment.documentation "^///$")) @@ -18,9 +18,12 @@ (#lua-match? @comment.documentation "^/[+][+][^+].*[+]/$")) [ - "(" ")" - "[" "]" - "{" "}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket [ @@ -35,8 +38,7 @@ "$" ] @punctuation.special -;; Constants - +; Constants [ "__FILE_FULL_PATH__" "__FILE__" @@ -66,11 +68,9 @@ "false" ] @boolean -;; Functions - +; Functions (func_declarator - (identifier) @function -) + (identifier) @function) [ "__traits" @@ -83,29 +83,22 @@ ] @function.builtin (import_expression - "import" @function.builtin -) + "import" @function.builtin) (parameter (var_declarator - (identifier) @variable.parameter - ) -) + (identifier) @variable.parameter)) (function_literal - (identifier) @variable.parameter -) + (identifier) @variable.parameter) (constructor - "this" @constructor -) + "this" @constructor) (destructor - "this" @constructor -) - -;; Keywords + "this" @constructor) +; Keywords [ "case" "default" @@ -238,51 +231,45 @@ ] @type.qualifier (alias_assignment - . (identifier) @type.definition) + . + (identifier) @type.definition) (module_declaration - "module" @keyword.import -) + "module" @keyword.import) (import_declaration - "import" @keyword.import -) + "import" @keyword.import) (type) @type (catch_parameter - (qualified_identifier) @type -) + (qualified_identifier) @type) (var_declarations - (qualified_identifier) @type -) + (qualified_identifier) @type) (func_declaration - (qualified_identifier) @type -) + (qualified_identifier) @type) (parameter - (qualified_identifier) @type -) + (qualified_identifier) @type) (class_declaration - (identifier) @type -) + (identifier) @type) (fundamental_type) @type.builtin -(module_fully_qualified_name (packages (package_name) @module)) +(module_fully_qualified_name + (packages + (package_name) @module)) + (module_name) @module (at_attribute) @attribute (user_defined_attribute - "@" @attribute -) - -;; Variables + "@" @attribute) +; Variables (primary_expression - "this" @variable.builtin -) + "this" @variable.builtin) diff --git a/queries/d/indents.scm b/queries/d/indents.scm index 9ced7527d..81624cabd 100644 --- a/queries/d/indents.scm +++ b/queries/d/indents.scm @@ -5,9 +5,12 @@ ] @indent.begin [ - "(" ")" - "{" "}" - "[" "]" + "(" + ")" + "{" + "}" + "[" + "]" ] @indent.branch [ diff --git a/queries/d/injections.scm b/queries/d/injections.scm index 6dd8aeacf..7437b932b 100644 --- a/queries/d/injections.scm +++ b/queries/d/injections.scm @@ -2,8 +2,8 @@ (line_comment) (block_comment) (nesting_block_comment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) ((token_string_tokens) @injection.content - (#set! injection.language "d")) + (#set! injection.language "d")) 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 diff --git a/queries/devicetree/highlights.scm b/queries/devicetree/highlights.scm index 6236189bf..a81cf2c89 100644 --- a/queries/devicetree/highlights.scm +++ b/queries/devicetree/highlights.scm @@ -6,6 +6,7 @@ ] @keyword.import (preproc_def) @constant.macro + (preproc_function_def) @function.macro [ @@ -22,14 +23,39 @@ (integer_literal) @number (identifier) @variable -(node (identifier) @module) -(property (identifier) @property) -(labeled_item (identifier) @label) -(call_expression (identifier) @function.macro) + +(node + (identifier) @module) + +(property + (identifier) @property) + +(labeled_item + (identifier) @label) + +(call_expression + (identifier) @function.macro) (reference) @label ; referencing labeled_item.identifier + (unit_address) @constant -[ "=" ] @operator -[ "(" ")" "[" "]" "{" "}" "<" ">" ] @punctuation.bracket -[ ";" ":" "," "@" ] @punctuation.delimiter +"=" @operator + +[ + "(" + ")" + "[" + "]" + "{" + "}" + "<" + ">" +] @punctuation.bracket + +[ + ";" + ":" + "," + "@" +] @punctuation.delimiter diff --git a/queries/devicetree/indents.scm b/queries/devicetree/indents.scm index 6cfc81cf2..9740060ca 100644 --- a/queries/devicetree/indents.scm +++ b/queries/devicetree/indents.scm @@ -9,6 +9,4 @@ ">" ] @indent.branch -[ - (comment) -] @indent.ignore +(comment) @indent.ignore diff --git a/queries/devicetree/injections.scm b/queries/devicetree/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/devicetree/injections.scm +++ b/queries/devicetree/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/devicetree/locals.scm b/queries/devicetree/locals.scm index 88b266ec2..e33a81dfd 100644 --- a/queries/devicetree/locals.scm +++ b/queries/devicetree/locals.scm @@ -1,4 +1,4 @@ [ (node) (integer_cells) -]@local.scope +] @local.scope diff --git a/queries/dhall/folds.scm b/queries/dhall/folds.scm index 305079aa8..bc92797b4 100644 --- a/queries/dhall/folds.scm +++ b/queries/dhall/folds.scm @@ -1,14 +1,10 @@ [ (let_binding) - (application_expression) (lambda_expression) - (record_type) (union_type) - (list_literal) (record_literal) - (block_comment) ] @fold diff --git a/queries/dhall/highlights.scm b/queries/dhall/highlights.scm index 5e2a77848..efd7fedf2 100644 --- a/queries/dhall/highlights.scm +++ b/queries/dhall/highlights.scm @@ -1,7 +1,5 @@ -;; Text - -;; Imports - +; Text +; Imports (missing_import) @keyword.import (local_import) @string.special.path @@ -13,47 +11,55 @@ (import_hash) ] @string.special -[ (import_as_location) (import_as_text) ] @type - -;; Types +[ + (import_as_location) + (import_as_text) +] @type +; Types ([ - (let_binding (label) @type) - (union_type_entry (label) @type) -] (#lua-match? @type "^%u")) + (let_binding + (label) @type) + (union_type_entry + (label) @type) +] + (#lua-match? @type "^%u")) ((primitive_expression - (identifier (label) @type) - (selector (label) @type)) @variable + (identifier + (label) @type) + (selector + (label) @type)) @variable (#lua-match? @variable "^[A-Z][^.]*$")) -;; Parameters - -(lambda_expression label: (label) @variable.parameter) - -;; Variables +; Parameters +(lambda_expression + label: (label) @variable.parameter) +; Variables (label) @variable -(identifier [ - (label) @variable - (de_bruijn_index) @operator -]) +(identifier + [ + (label) @variable + (de_bruijn_index) @operator + ]) -(let_binding label: (label) @variable) +(let_binding + label: (label) @variable) ; Fields +(record_literal_entry + (label) @variable.member) -(record_literal_entry (label) @variable.member) - -(record_type_entry (label) @variable.member) +(record_type_entry + (label) @variable.member) (selector (selector_dot) (_) @variable.member) -;; Keywords - +; Keywords (env_import) @keyword [ @@ -68,8 +74,7 @@ "with" ] @keyword.operator -;; Operators - +; Operators [ (type_operator) (assign_operator) @@ -82,71 +87,88 @@ (empty_record_literal) ] @operator -;; Builtins - +; Builtins (builtin_function) @function.builtin -(builtin [ - "Natural" - "Natural/build" - "Natural/fold" - "Natural/isZero" - "Natural/even" - "Natural/odd" - "Natural/subtract" - "Natural/toInteger" - "Natural/show" - "Integer" - "Integer/toDouble" - "Integer/show" - "Integer/negate" - "Integer/clamp" - "Double" - "Double/show" - "List" - "List/build" - "List/fold" - "List/length" - "List/head" - "List/last" - "List/indexed" - "List/reverse" - "Text" - "Text/show" - "Text/replace" - "Optional" - "Date" - "Time" - "TimeZone" - "Type" - "Kind" - "Sort" -] @type.builtin) -;; Punctuation +(builtin + [ + "Natural" + "Natural/build" + "Natural/fold" + "Natural/isZero" + "Natural/even" + "Natural/odd" + "Natural/subtract" + "Natural/toInteger" + "Natural/show" + "Integer" + "Integer/toDouble" + "Integer/show" + "Integer/negate" + "Integer/clamp" + "Double" + "Double/show" + "List" + "List/build" + "List/fold" + "List/length" + "List/head" + "List/last" + "List/indexed" + "List/reverse" + "Text" + "Text/show" + "Text/replace" + "Optional" + "Date" + "Time" + "TimeZone" + "Type" + "Kind" + "Sort" + ] @type.builtin) -[ "," "|" ] @punctuation.delimiter -(selector_dot) @punctuation.delimiter +; Punctuation +[ + "," + "|" +] @punctuation.delimiter -[ "{" "}" ] @punctuation.bracket +(selector_dot) @punctuation.delimiter -[ "[" "]" ] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "<" ">" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -;; Conditionals +[ + "<" + ">" +] @punctuation.bracket +; Conditionals [ "if" "then" "else" ] @keyword.conditional -;; Literals - +; Literals (text_literal) @string -(interpolation "}" @string) + +(interpolation + "}" @string) + [ (double_quote_escaped) (single_quote_escaped) @@ -161,10 +183,10 @@ (boolean_literal) @boolean -(builtin "None") @constant.builtin - -;; Comments +(builtin + "None") @constant.builtin +; Comments [ (line_comment) (block_comment) diff --git a/queries/dhall/injections.scm b/queries/dhall/injections.scm index 43ae7287b..3cd6aac8e 100644 --- a/queries/dhall/injections.scm +++ b/queries/dhall/injections.scm @@ -1,5 +1,5 @@ ([ (line_comment) (block_comment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) diff --git a/queries/diff/highlights.scm b/queries/diff/highlights.scm index 4288913d9..d8e600882 100644 --- a/queries/diff/highlights.scm +++ b/queries/diff/highlights.scm @@ -1,6 +1,15 @@ -[(addition) (new_file)] @diff.plus -[(deletion) (old_file)] @diff.minus +[ + (addition) + (new_file) +] @diff.plus + +[ + (deletion) + (old_file) +] @diff.minus (commit) @constant + (location) @attribute + (command) @function diff --git a/queries/dockerfile/highlights.scm b/queries/dockerfile/highlights.scm index 592e70423..762e34426 100644 --- a/queries/dockerfile/highlights.scm +++ b/queries/dockerfile/highlights.scm @@ -41,17 +41,19 @@ "$" "{" "}" - ] @punctuation.special -) + ] @punctuation.special) ((variable) @constant (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) (arg_instruction - . (unquoted_string) @property) + . + (unquoted_string) @property) (env_instruction - (env_pair . (unquoted_string) @property)) + (env_pair + . + (unquoted_string) @property)) (expose_instruction (expose_port) @number) diff --git a/queries/dockerfile/injections.scm b/queries/dockerfile/injections.scm index 0eb9ffdf2..0304f982e 100644 --- a/queries/dockerfile/injections.scm +++ b/queries/dockerfile/injections.scm @@ -1,6 +1,6 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) -((shell_command) @injection.content - (#set! injection.language "bash") - (#set! injection.include-children)) +((shell_command) @injection.content + (#set! injection.language "bash") + (#set! injection.include-children)) diff --git a/queries/dot/highlights.scm b/queries/dot/highlights.scm index f204ce44c..7919e87f5 100644 --- a/queries/dot/highlights.scm +++ b/queries/dot/highlights.scm @@ -10,6 +10,7 @@ ] @keyword (string_literal) @string + (number_literal) @number [ @@ -32,19 +33,19 @@ ] @punctuation.bracket (subgraph - id: (id - (identifier) @module) -) + id: + (id + (identifier) @module)) (attribute - name: (id - (identifier) @variable.member) -) + name: + (id + (identifier) @variable.member)) (attribute - value: (id - (identifier) @constant) -) + value: + (id + (identifier) @constant)) (comment) @comment diff --git a/queries/dot/injections.scm b/queries/dot/injections.scm index ac41393ab..4fe39a8ba 100644 --- a/queries/dot/injections.scm +++ b/queries/dot/injections.scm @@ -1,5 +1,5 @@ -((html_internal) @injection.content - (#set! injection.language "html")) +((html_internal) @injection.content + (#set! injection.language "html")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/doxygen/highlights.scm b/queries/doxygen/highlights.scm index fadcdfa80..e3e26881e 100644 --- a/queries/doxygen/highlights.scm +++ b/queries/doxygen/highlights.scm @@ -9,11 +9,12 @@ (identifier) @variable ((tag - (tag_name) @_param + (tag_name) @_param (identifier) @variable.parameter) (#any-of? @_param "@param" "\\param")) -(function (identifier) @function) +(function + (identifier) @function) (function_link) @function @@ -48,6 +49,13 @@ (code_block_end) ] @punctuation.delimiter -[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket (code_block_content) @none diff --git a/queries/doxygen/injections.scm b/queries/doxygen/injections.scm index 8353dfd7a..e0eff433a 100644 --- a/queries/doxygen/injections.scm +++ b/queries/doxygen/injections.scm @@ -1,7 +1,10 @@ ((type) @injection.content (#set! injection.parent)) -([ (function_link) (code) ] @injection.content +([ + (function_link) + (code) +] @injection.content (#set! injection.parent)) ((link) @injection.content diff --git a/queries/dtd/folds.scm b/queries/dtd/folds.scm index ba7ea121b..b1bce4ffb 100644 --- a/queries/dtd/folds.scm +++ b/queries/dtd/folds.scm @@ -1,4 +1,4 @@ [ - (conditionalSect) - (Comment) + (conditionalSect) + (Comment) ] @fold diff --git a/queries/dtd/highlights.scm b/queries/dtd/highlights.scm index fac7d923c..12a2093d1 100644 --- a/queries/dtd/highlights.scm +++ b/queries/dtd/highlights.scm @@ -1,80 +1,95 @@ -;; XML declaration +; XML declaration +(XMLDecl + "xml" @keyword.directive) -(XMLDecl "xml" @keyword.directive) +(XMLDecl + [ + "version" + "encoding" + ] @tag.attribute) -(XMLDecl [ "version" "encoding" ] @tag.attribute) +(XMLDecl + (EncName) @string.special) -(XMLDecl (EncName) @string.special) - -(XMLDecl (VersionNum) @number) - -;; Processing instructions +(XMLDecl + (VersionNum) @number) +; Processing instructions (PI) @keyword.directive -;; Element declaration - +; Element declaration (elementdecl "ELEMENT" @keyword.directive.define (Name) @tag) (contentspec - (_ (Name) @tag.attribute)) + (_ + (Name) @tag.attribute)) "#PCDATA" @type.builtin -[ "EMPTY" "ANY" ] @type.qualifier - -[ "*" "?" "+" ] @character.special +[ + "EMPTY" + "ANY" +] @type.qualifier -;; Entity declaration +[ + "*" + "?" + "+" +] @character.special +; Entity declaration (GEDecl "ENTITY" @keyword.directive.define (Name) @constant) -(GEDecl (EntityValue) @string) +(GEDecl + (EntityValue) @string) (NDataDecl "NDATA" @keyword (Name) @label) -;; Parsed entity declaration - +; Parsed entity declaration (PEDecl "ENTITY" @keyword.directive.define "%" @operator (Name) @function.macro) -(PEDecl (EntityValue) @string) - -;; Notation declaration +(PEDecl + (EntityValue) @string) +; Notation declaration (NotationDecl "NOTATION" @keyword.directive (Name) @label) ((NotationDecl (ExternalID - (SystemLiteral (URI) @string.special.url)) - (#set! "priority" 105))) - -;; Attlist declaration + (SystemLiteral + (URI) @string.special.url)) + (#set! "priority" 105))) +; Attlist declaration (AttlistDecl "ATTLIST" @keyword.directive.define (Name) @tag) -(AttDef (Name) @tag.attribute) +(AttDef + (Name) @tag.attribute) -(AttDef (Enumeration (Nmtoken) @string)) +(AttDef + (Enumeration + (Nmtoken) @string)) [ (StringType) (TokenizedType) ] @type.builtin -(NotationType "NOTATION" @type.builtin) +(NotationType + "NOTATION" @type.builtin) [ "#REQUIRED" @@ -82,38 +97,57 @@ "#FIXED" ] @attribute -;; Entities - +; Entities (EntityRef) @constant ((EntityRef) @constant.builtin - (#any-of? @constant.builtin - "&" "<" ">" """ "'")) + (#any-of? @constant.builtin "&" "<" ">" """ "'")) (CharRef) @character (PEReference) @function.macro -;; External references - -[ "PUBLIC" "SYSTEM" ] @keyword +; External references +[ + "PUBLIC" + "SYSTEM" +] @keyword (PubidLiteral) @string.special -(SystemLiteral (URI) @string.special.url) - -;; Delimiters & punctuation - -[ "<?" "?>" "<!" ">" "]]>" ] @tag.delimiter +(SystemLiteral + (URI) @string.special.url) -[ "(" ")" "[" ] @punctuation.bracket +; Delimiters & punctuation +[ + "<?" + "?>" + "<!" + ">" + "]]>" +] @tag.delimiter -[ "\"" "'" ] @punctuation.delimiter +[ + "(" + ")" + "[" +] @punctuation.bracket -[ "," "|" "=" ] @operator +[ + "\"" + "'" +] @punctuation.delimiter -;; Misc +[ + "," + "|" + "=" +] @operator -[ "INCLUDE" "IGNORE" ] @keyword.import +; Misc +[ + "INCLUDE" + "IGNORE" +] @keyword.import (Comment) @comment @spell diff --git a/queries/dtd/locals.scm b/queries/dtd/locals.scm index 6f64c6791..88246c04a 100644 --- a/queries/dtd/locals.scm +++ b/queries/dtd/locals.scm @@ -1,7 +1,11 @@ -(elementdecl (Name) @local.definition.type) +(elementdecl + (Name) @local.definition.type) (elementdecl (contentspec - (children (Name) @local.reference))) + (children + (Name) @local.reference))) -(AttlistDecl . (Name) @local.reference) +(AttlistDecl + . + (Name) @local.reference) diff --git a/queries/ebnf/highlights.scm b/queries/ebnf/highlights.scm index b0dfa2737..8715091b1 100644 --- a/queries/ebnf/highlights.scm +++ b/queries/ebnf/highlights.scm @@ -1,4 +1,4 @@ -;;;; Simple tokens ;;;; +; Simple tokens ;;;; (terminal) @string.grammar (special_sequence) @string.special.grammar @@ -7,37 +7,36 @@ (comment) @comment @spell -;;;; Identifiers ;;;; - +; Identifiers ;;;; ; Allow different highlighting for specific casings ((identifier) @type - (#lua-match? @type "^%u")) + (#lua-match? @type "^%u")) ((identifier) @string.special.symbol - (#lua-match? @string.special.symbol "^%l")) + (#lua-match? @string.special.symbol "^%l")) ((identifier) @constant - (#lua-match? @constant "^%u[%u%d_]+$")) + (#lua-match? @constant "^%u[%u%d_]+$")) -;;; Punctuation ;;;; +; Punctuation ;;;; [ - ";" - "," + ";" + "," ] @punctuation.delimiter [ - "|" - "*" - "-" + "|" + "*" + "-" ] @operator "=" @keyword.operator [ - "(" - ")" - "[" - "]" - "{" - "}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket diff --git a/queries/ecma/highlights.scm b/queries/ecma/highlights.scm index b6fd64668..223198410 100644 --- a/queries/ecma/highlights.scm +++ b/queries/ecma/highlights.scm @@ -1,92 +1,60 @@ ; Types - ; Javascript - ; Variables ;----------- (identifier) @variable ; Properties ;----------- - (property_identifier) @property + (shorthand_property_identifier) @property + (private_property_identifier) @property (variable_declarator - name: (object_pattern - (shorthand_property_identifier_pattern))) @variable + name: + (object_pattern + (shorthand_property_identifier_pattern))) @variable ; Special identifiers ;-------------------- - ((identifier) @type - (#lua-match? @type "^[A-Z]")) + (#lua-match? @type "^[A-Z]")) ((identifier) @constant - (#lua-match? @constant "^_*[A-Z][A-Z%d_]*$")) + (#lua-match? @constant "^_*[A-Z][A-Z%d_]*$")) ((shorthand_property_identifier) @constant - (#lua-match? @constant "^_*[A-Z][A-Z%d_]*$")) + (#lua-match? @constant "^_*[A-Z][A-Z%d_]*$")) ((identifier) @variable.builtin - (#any-of? @variable.builtin - "arguments" - "module" - "console" - "window" - "document")) + (#any-of? @variable.builtin "arguments" "module" "console" "window" "document")) ((identifier) @type.builtin - (#any-of? @type.builtin - "Object" - "Function" - "Boolean" - "Symbol" - "Number" - "Math" - "Date" - "String" - "RegExp" - "Map" - "Set" - "WeakMap" - "WeakSet" - "Promise" - "Array" - "Int8Array" - "Uint8Array" - "Uint8ClampedArray" - "Int16Array" - "Uint16Array" - "Int32Array" - "Uint32Array" - "Float32Array" - "Float64Array" - "ArrayBuffer" - "DataView" - "Error" - "EvalError" - "InternalError" - "RangeError" - "ReferenceError" - "SyntaxError" - "TypeError" - "URIError")) + (#any-of? @type.builtin "Object" "Function" "Boolean" "Symbol" "Number" "Math" "Date" "String" "RegExp" "Map" "Set" "WeakMap" "WeakSet" "Promise" "Array" "Int8Array" "Uint8Array" "Uint8ClampedArray" "Int16Array" "Uint16Array" "Int32Array" "Uint32Array" "Float32Array" "Float64Array" "ArrayBuffer" "DataView" "Error" "EvalError" "InternalError" "RangeError" "ReferenceError" "SyntaxError" "TypeError" "URIError")) ; Function and method definitions ;-------------------------------- - (function name: (identifier) @function) + (function_declaration name: (identifier) @function) + (generator_function name: (identifier) @function) + (generator_function_declaration name: (identifier) @function) + (method_definition - name: [(property_identifier) (private_property_identifier)] @function.method) + name: + [ + (property_identifier) + (private_property_identifier) + ] @function.method) + (method_definition name: (property_identifier) @constructor (#eq? @constructor "constructor")) @@ -94,22 +62,27 @@ (pair key: (property_identifier) @function.method value: (function)) + (pair key: (property_identifier) @function.method value: (arrow_function)) (assignment_expression - left: (member_expression - property: (property_identifier) @function.method) + left: + (member_expression + property: (property_identifier) @function.method) right: (arrow_function)) + (assignment_expression - left: (member_expression - property: (property_identifier) @function.method) + left: + (member_expression + property: (property_identifier) @function.method) right: (function)) (variable_declarator name: (identifier) @function value: (arrow_function)) + (variable_declarator name: (identifier) @function value: (function)) @@ -117,42 +90,35 @@ (assignment_expression left: (identifier) @function right: (arrow_function)) + (assignment_expression left: (identifier) @function right: (function)) ; Function and method calls ;-------------------------- - (call_expression function: (identifier) @function.call) (call_expression - function: (member_expression - property: [(property_identifier) (private_property_identifier)] @function.method.call)) + function: + (member_expression + property: + [ + (property_identifier) + (private_property_identifier) + ] @function.method.call)) ; Builtins ;--------- - ((identifier) @module.builtin - (#eq? @module.builtin "Intl")) + (#eq? @module.builtin "Intl")) ((identifier) @function.builtin - (#any-of? @function.builtin - "eval" - "isFinite" - "isNaN" - "parseFloat" - "parseInt" - "decodeURI" - "decodeURIComponent" - "encodeURI" - "encodeURIComponent" - "require")) + (#any-of? @function.builtin "eval" "isFinite" "isNaN" "parseFloat" "parseInt" "decodeURI" "decodeURIComponent" "encodeURI" "encodeURIComponent" "require")) ; Constructor ;------------ - (new_expression constructor: (identifier) @constructor) @@ -163,19 +129,24 @@ ; Decorators ;---------- -(decorator "@" @attribute (identifier) @attribute) -(decorator "@" @attribute (call_expression (identifier) @attribute)) +(decorator + "@" @attribute + (identifier) @attribute) + +(decorator + "@" @attribute + (call_expression + (identifier) @attribute)) ; Literals ;--------- - [ (this) (super) ] @variable.builtin ((identifier) @variable.builtin - (#eq? @variable.builtin "self")) + (#eq? @variable.builtin "self")) [ (true) @@ -195,30 +166,45 @@ (hash_bang_line) @keyword.directive ((string_fragment) @keyword.directive - (#eq? @keyword.directive "use strict")) + (#eq? @keyword.directive "use strict")) (string) @string + (template_string) @string + (escape_sequence) @string.escape + (regex_pattern) @string.regexp + (regex_flags) @character.special -(regex "/" @punctuation.bracket) ; Regex delimiters + +(regex + "/" @punctuation.bracket) ; Regex delimiters (number) @number + ((identifier) @number (#any-of? @number "NaN" "Infinity")) ; Punctuation ;------------ - ";" @punctuation.delimiter + "." @punctuation.delimiter + "," @punctuation.delimiter -(pair ":" @punctuation.delimiter) -(pair_pattern ":" @punctuation.delimiter) -(switch_case ":" @punctuation.delimiter) -(switch_default ":" @punctuation.delimiter) +(pair + ":" @punctuation.delimiter) + +(pair_pattern + ":" @punctuation.delimiter) + +(switch_case + ":" @punctuation.delimiter) + +(switch_default + ":" @punctuation.delimiter) [ "--" @@ -265,10 +251,28 @@ "..." ] @operator -(binary_expression "/" @operator) -(ternary_expression ["?" ":"] @keyword.conditional.ternary) -(unary_expression ["!" "~" "-" "+"] @operator) -(unary_expression ["delete" "void"] @keyword.operator) +(binary_expression + "/" @operator) + +(ternary_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) + +(unary_expression + [ + "!" + "~" + "-" + "+" + ] @operator) + +(unary_expression + [ + "delete" + "void" + ] @keyword.operator) [ "(" @@ -279,11 +283,14 @@ "}" ] @punctuation.bracket -((template_substitution ["${" "}"] @punctuation.special) @none) +((template_substitution + [ + "${" + "}" + ] @punctuation.special) @none) ; Keywords ;---------- - [ "if" "else" @@ -296,10 +303,17 @@ "from" ] @keyword.import -(export_specifier "as" @keyword.import) -(import_specifier "as" @keyword.import) -(namespace_export "as" @keyword.import) -(namespace_import "as" @keyword.import) +(export_specifier + "as" @keyword.import) + +(import_specifier + "as" @keyword.import) + +(namespace_export + "as" @keyword.import) + +(namespace_import + "as" @keyword.import) [ "for" @@ -335,9 +349,7 @@ "yield" ] @keyword.return -[ - "function" -] @keyword.function +"function" @keyword.function [ "new" @@ -356,5 +368,6 @@ (export_statement "default" @keyword) + (switch_default "default" @keyword.conditional) diff --git a/queries/ecma/indents.scm b/queries/ecma/indents.scm index 538c5bdc7..03b10c605 100644 --- a/queries/ecma/indents.scm +++ b/queries/ecma/indents.scm @@ -18,36 +18,56 @@ (ternary_expression) ] @indent.begin -(arguments (call_expression) @indent.begin) -(binary_expression (call_expression) @indent.begin) -(expression_statement (call_expression) @indent.begin) +(arguments + (call_expression) @indent.begin) + +(binary_expression + (call_expression) @indent.begin) + +(expression_statement + (call_expression) @indent.begin) + (arrow_function body: (_) @_body - (#not-has-type? @_body statement_block) -) @indent.begin + (#not-has-type? @_body statement_block)) @indent.begin + (assignment_expression right: (_) @_right - (#not-has-type? @_right arrow_function function) -) @indent.begin + (#not-has-type? @_right arrow_function function)) @indent.begin + (variable_declarator value: (_) @_value - (#not-has-type? @_value arrow_function call_expression function) -) @indent.begin + (#not-has-type? @_value arrow_function call_expression function)) @indent.begin + +(arguments + ")" @indent.end) -(arguments ")" @indent.end) -(object "}" @indent.end) -(statement_block "}" @indent.end) +(object + "}" @indent.end) + +(statement_block + "}" @indent.end) [ - (arguments (object)) + (arguments + (object)) ")" "}" "]" ] @indent.branch -(statement_block "{" @indent.branch) -(parenthesized_expression ("(" (_) ")" @indent.end)) -["}" "]"] @indent.end +(statement_block + "{" @indent.branch) + +(parenthesized_expression + ("(" + (_) + ")" @indent.end)) + +[ + "}" + "]" +] @indent.end (template_string) @indent.ignore diff --git a/queries/ecma/injections.scm b/queries/ecma/injections.scm index 97dbbb628..9421d8113 100644 --- a/queries/ecma/injections.scm +++ b/queries/ecma/injections.scm @@ -3,98 +3,116 @@ (#set! injection.language "jsdoc")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ; html(`...`), html`...`, sql(...) etc (call_expression - function: ((identifier) @injection.language) - arguments: [ - (arguments - (template_string) @injection.content) - (template_string) @injection.content - ] - (#lua-match? @injection.language "^[a-zA-Z][a-zA-Z0-9]*$") - (#offset! @injection.content 0 1 0 -1) - (#not-eq? @injection.language "svg")) + function: + ((identifier) @injection.language) + arguments: + [ + (arguments + (template_string) @injection.content) + (template_string) @injection.content + ] + (#lua-match? @injection.language "^[a-zA-Z][a-zA-Z0-9]*$") + (#offset! @injection.content 0 1 0 -1) + (#not-eq? @injection.language "svg")) ; svg`...` or svg(`...`), which uses the html parser, so is not included in the previous query (call_expression - function: ((identifier) @_name (#eq? @_name "svg")) - arguments: [ - (arguments - (template_string) @injection.content) - (template_string) @injection.content - ] - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "html")) - + function: + ((identifier) @_name + (#eq? @_name "svg")) + arguments: + [ + (arguments + (template_string) @injection.content) + (template_string) @injection.content + ] + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "html")) (call_expression - function: ((identifier) @_name - (#eq? @_name "gql")) - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "graphql"))) + function: + ((identifier) @_name + (#eq? @_name "gql")) + arguments: + ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "graphql"))) (call_expression - function: ((identifier) @_name - (#eq? @_name "hbs")) - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "glimmer"))) + function: + ((identifier) @_name + (#eq? @_name "hbs")) + arguments: + ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "glimmer"))) ((glimmer_template) @injection.content - (#set! injection.language "glimmer")) + (#set! injection.language "glimmer")) ; styled.div`<css>` (call_expression - function: (member_expression - object: (identifier) @_name - (#eq? @_name "styled")) - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "styled"))) + function: + (member_expression + object: (identifier) @_name + (#eq? @_name "styled")) + arguments: + ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "styled"))) ; styled(Component)`<css>` (call_expression - function: (call_expression - function: (identifier) @_name - (#eq? @_name "styled")) - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "styled"))) + function: + (call_expression + function: (identifier) @_name + (#eq? @_name "styled")) + arguments: + ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "styled"))) ; styled.div.attrs({ prop: "foo" })`<css>` (call_expression - function: (call_expression - function: (member_expression - object: (member_expression - object: (identifier) @_name - (#eq? @_name "styled")))) - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "styled"))) - + function: + (call_expression + function: + (member_expression + object: + (member_expression + object: (identifier) @_name + (#eq? @_name "styled")))) + arguments: + ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "styled"))) ; styled(Component).attrs({ prop: "foo" })`<css>` (call_expression - function: (call_expression - function: (member_expression - object: (call_expression - function: (identifier) @_name - (#eq? @_name "styled")))) - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "styled"))) + function: + (call_expression + function: + (member_expression + object: + (call_expression + function: (identifier) @_name + (#eq? @_name "styled")))) + arguments: + ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "styled"))) ((regex_pattern) @injection.content - (#set! injection.language "regex")) + (#set! injection.language "regex")) ; ((comment) @_gql_comment ; (#eq? @_gql_comment "/* GraphQL */") ; (template_string) @injection.content ; (#set! injection.language "graphql")) - ((template_string) @injection.content (#lua-match? @injection.content "^`#graphql") (#offset! @injection.content 0 1 0 -1) @@ -102,20 +120,21 @@ ; el.innerHTML = `<html>` (assignment_expression - left: + left: (member_expression property: (property_identifier) @_prop (#any-of? @_prop "outerHTML" "innerHTML")) right: (template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "html")) + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "html")) ; el.innerHTML = '<html>' (assignment_expression - left: + left: (member_expression property: (property_identifier) @_prop (#any-of? @_prop "outerHTML" "innerHTML")) - right: - (string (string_fragment) @injection.content) - (#set! injection.language "html")) + right: + (string + (string_fragment) @injection.content) + (#set! injection.language "html")) diff --git a/queries/ecma/locals.scm b/queries/ecma/locals.scm index 86e565490..54da79335 100644 --- a/queries/ecma/locals.scm +++ b/queries/ecma/locals.scm @@ -1,18 +1,23 @@ ; Scopes ;------- - (statement_block) @local.scope + (function) @local.scope + (arrow_function) @local.scope + (function_declaration) @local.scope + (method_definition) @local.scope + (for_statement) @local.scope + (for_in_statement) @local.scope + (catch_clause) @local.scope ; Definitions ;------------ - (variable_declarator name: (identifier) @local.definition.var) @@ -24,14 +29,14 @@ (function_declaration ((identifier) @local.definition.function) - (#set! definition.var.scope parent)) + (#set! definition.var.scope parent)) (method_definition ((property_identifier) @local.definition.function) - (#set! definition.var.scope parent)) + (#set! definition.var.scope parent)) ; References ;------------ - (identifier) @local.reference + (shorthand_property_identifier) @local.reference diff --git a/queries/eds/highlights.scm b/queries/eds/highlights.scm index 42f408754..2ce79c048 100644 --- a/queries/eds/highlights.scm +++ b/queries/eds/highlights.scm @@ -1,49 +1,58 @@ "=" @punctuation.delimiter -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket ((section_name) @variable.builtin - (#match? @variable.builtin "\\c^(FileInfo|DeviceInfo|DummyUsage|MandatoryObjects|OptionalObjects)$")) + (#match? @variable.builtin "\\c^(FileInfo|DeviceInfo|DummyUsage|MandatoryObjects|OptionalObjects)$")) ((section_name) @variable.builtin - (#lua-match? @variable.builtin "^1")) + (#lua-match? @variable.builtin "^1")) (section - (section_name) @_name - (#match? @_name "\\c^Comments$")) @comment + (section_name) @_name + (#match? @_name "\\c^Comments$")) @comment (section - (section_name) @_name - (statement (key) @_key) @string - (#match? @_key "\\c^ParameterName$") - (#not-match? @_name "\\c^Comments$")) + (section_name) @_name + (statement + (key) @_key) @string + (#match? @_key "\\c^ParameterName$") + (#not-match? @_name "\\c^Comments$")) (section - (section_name) @_name - (statement (key) @_key) @type - (#match? @_key "\\c^ObjectType$") - (#not-match? @_name "\\c^Comments$")) + (section_name) @_name + (statement + (key) @_key) @type + (#match? @_key "\\c^ObjectType$") + (#not-match? @_name "\\c^Comments$")) (section - (section_name) @_name - (statement (key) @_key) @type - (#match? @_key "\\c^DataType$") - (#not-match? @_name "\\c^Comments$")) + (section_name) @_name + (statement + (key) @_key) @type + (#match? @_key "\\c^DataType$") + (#not-match? @_name "\\c^Comments$")) (section - (section_name) @_name - (statement (key) @_key) @type.qualifier - (#match? @_key "\\c^AccessType$") - (#not-match? @_name "\\c^Comments$")) + (section_name) @_name + (statement + (key) @_key) @type.qualifier + (#match? @_key "\\c^AccessType$") + (#not-match? @_name "\\c^Comments$")) (section - (section_name) @_name - (statement (key) @_key) @attribute - (#match? @_key "\\c^PDOMapping$") - (#not-match? @_name "\\c^Comments$")) + (section_name) @_name + (statement + (key) @_key) @attribute + (#match? @_key "\\c^PDOMapping$") + (#not-match? @_name "\\c^Comments$")) (section - (section_name) @_name - (statement (key) @_key) @number - (#match? @_key "\\c^(DefaultValue|LowLimit|HighLimit|SubNumber)$") - (#not-match? @_name "\\c^Comments$")) + (section_name) @_name + (statement + (key) @_key) @number + (#match? @_key "\\c^(DefaultValue|LowLimit|HighLimit|SubNumber)$") + (#not-match? @_name "\\c^Comments$")) diff --git a/queries/eex/highlights.scm b/queries/eex/highlights.scm index d032a7486..ae91a2774 100644 --- a/queries/eex/highlights.scm +++ b/queries/eex/highlights.scm @@ -7,6 +7,5 @@ "<%%=" "<%=" ] @tag.delimiter - ; EEx comments are highlighted as such (comment) @comment @spell diff --git a/queries/eex/injections.scm b/queries/eex/injections.scm index 9331f5925..f13d3c14e 100644 --- a/queries/eex/injections.scm +++ b/queries/eex/injections.scm @@ -1,8 +1,8 @@ ; EEx expressions are Elixir -((expression) @injection.content - (#set! injection.language "elixir")) +((expression) @injection.content + (#set! injection.language "elixir")) ; EEx expressions can span multiple interpolated lines ((partial_expression) @injection.content - (#set! injection.language "elixir") - (#set! injection.combined)) + (#set! injection.language "elixir") + (#set! injection.combined)) diff --git a/queries/elixir/highlights.scm b/queries/elixir/highlights.scm index 5a9297fc7..57e299b17 100644 --- a/queries/elixir/highlights.scm +++ b/queries/elixir/highlights.scm @@ -15,15 +15,14 @@ "}" ] @punctuation.bracket -[ - "%" -] @punctuation.special +"%" @punctuation.special ; Identifiers (identifier) @variable ; Unused Identifiers -((identifier) @comment (#lua-match? @comment "^_")) +((identifier) @comment + (#lua-match? @comment "^_")) ; Comments (comment) @comment @spell @@ -43,7 +42,11 @@ ] @string.special.symbol ; Interpolation -(interpolation ["#{" "}"] @string.special) +(interpolation + [ + "#{" + "}" + ] @string.special) ; Escape sequences (escape_sequence) @string.escape @@ -69,82 +72,65 @@ ; Operators (operator_identifier) @operator -(unary_operator operator: _ @operator) +(unary_operator + operator: _ @operator) -(binary_operator operator: _ @operator) +(binary_operator + operator: _ @operator) ; Pipe Operator -(binary_operator operator: "|>" right: (identifier) @function) +(binary_operator + operator: "|>" + right: (identifier) @function) -(dot operator: _ @operator) +(dot + operator: _ @operator) -(stab_clause operator: _ @operator) +(stab_clause + operator: _ @operator) ; Local Function Calls -(call target: (identifier) @function.call) +(call + target: (identifier) @function.call) ; Remote Function Calls -(call target: (dot left: [ - (atom) @type - (_) -] right: (identifier) @function.call) (arguments)) +(call + target: + (dot + left: + [ + (atom) @type + (_) + ] + right: (identifier) @function.call) + (arguments)) ; Definition Function Calls -(call target: ((identifier) @keyword.function (#any-of? @keyword.function - "def" - "defdelegate" - "defexception" - "defguard" - "defguardp" - "defimpl" - "defmacro" - "defmacrop" - "defmodule" - "defn" - "defnp" - "defoverridable" - "defp" - "defprotocol" - "defstruct" - )) - (arguments [ - (call (identifier) @function) - (identifier) @function - (binary_operator left: (call target: (identifier) @function) operator: "when")])?) +(call + target: + ((identifier) @keyword.function + (#any-of? @keyword.function "def" "defdelegate" "defexception" "defguard" "defguardp" "defimpl" "defmacro" "defmacrop" "defmodule" "defn" "defnp" "defoverridable" "defp" "defprotocol" "defstruct")) + (arguments + [ + (call + (identifier) @function) + (identifier) @function + (binary_operator + left: + (call + target: (identifier) @function) + operator: "when") + ])?) ; Kernel Keywords & Special Forms -(call target: ((identifier) @keyword (#any-of? @keyword - "alias" - "case" - "catch" - "cond" - "else" - "for" - "if" - "import" - "quote" - "raise" - "receive" - "require" - "reraise" - "super" - "throw" - "try" - "unless" - "unquote" - "unquote_splicing" - "use" - "with" -))) +(call + target: + ((identifier) @keyword + (#any-of? @keyword "alias" "case" "catch" "cond" "else" "for" "if" "import" "quote" "raise" "receive" "require" "reraise" "super" "throw" "try" "unless" "unquote" "unquote_splicing" "use" "with"))) ; Special Constants -((identifier) @constant.builtin (#any-of? @constant.builtin - "__CALLER__" - "__DIR__" - "__ENV__" - "__MODULE__" - "__STACKTRACE__" -)) +((identifier) @constant.builtin + (#any-of? @constant.builtin "__CALLER__" "__DIR__" "__ENV__" "__MODULE__" "__STACKTRACE__")) ; Reserved Keywords [ @@ -170,14 +156,22 @@ ; Capture Operator (unary_operator operator: "&" - operand: [ - (integer) @operator - (binary_operator - left: [ - (call target: (dot left: (_) right: (identifier) @function)) - (identifier) @function - ] operator: "/" right: (integer) @operator) - ]) + operand: + [ + (integer) @operator + (binary_operator + left: + [ + (call + target: + (dot + left: (_) + right: (identifier) @function)) + (identifier) @function + ] + operator: "/" + right: (integer) @operator) + ]) ; Non-String Sigils (sigil @@ -201,24 +195,30 @@ ; Module attributes (unary_operator operator: "@" - operand: [ - (identifier) - (call target: (identifier)) - ] @constant) @constant + operand: + [ + (identifier) + (call + target: (identifier)) + ] @constant) @constant ; Documentation (unary_operator operator: "@" - operand: (call - target: ((identifier) @_identifier (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) @comment.documentation - (arguments [ - (string) - (boolean) - (charlist) - (sigil - "~" @comment.documentation - ((sigil_name) @comment.documentation) - quoted_start: _ @comment.documentation - (quoted_content) @comment.documentation - quoted_end: _ @comment.documentation) - ] @comment.documentation))) @comment.documentation + operand: + (call + target: + ((identifier) @_identifier + (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) @comment.documentation + (arguments + [ + (string) + (boolean) + (charlist) + (sigil + "~" @comment.documentation + ((sigil_name) @comment.documentation) + quoted_start: _ @comment.documentation + (quoted_content) @comment.documentation + quoted_end: _ @comment.documentation) + ] @comment.documentation))) @comment.documentation diff --git a/queries/elixir/indents.scm b/queries/elixir/indents.scm index 0ba8fd442..5470b6422 100644 --- a/queries/elixir/indents.scm +++ b/queries/elixir/indents.scm @@ -20,4 +20,6 @@ ] @indent.end @indent.branch ; Elixir pipelines are not indented, but other binary operator chains are -((binary_operator operator: _ @_operator) @indent.begin (#not-eq? @_operator "|>")) +((binary_operator + operator: _ @_operator) @indent.begin + (#not-eq? @_operator "|>")) diff --git a/queries/elixir/injections.scm b/queries/elixir/injections.scm index 1f0b31f07..b580f2ea6 100644 --- a/queries/elixir/injections.scm +++ b/queries/elixir/injections.scm @@ -1,56 +1,61 @@ ; Comments -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) ; Documentation (unary_operator operator: "@" - operand: (call - target: ((identifier) @_identifier (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) - (arguments [ - (string (quoted_content) @injection.content) - (sigil (quoted_content) @injection.content) - ]) - (#set! injection.language "markdown"))) + operand: + (call + target: + ((identifier) @_identifier + (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) + (arguments + [ + (string + (quoted_content) @injection.content) + (sigil + (quoted_content) @injection.content) + ]) + (#set! injection.language "markdown"))) ; HEEx (sigil (sigil_name) @_sigil_name (quoted_content) @injection.content - (#eq? @_sigil_name "H") - (#set! injection.language "heex")) + (#eq? @_sigil_name "H") + (#set! injection.language "heex")) ; Surface (sigil (sigil_name) @_sigil_name (quoted_content) @injection.content - (#eq? @_sigil_name "F") - (#set! injection.language "surface")) + (#eq? @_sigil_name "F") + (#set! injection.language "surface")) ; Zigler (sigil (sigil_name) @_sigil_name (quoted_content) @injection.content - (#any-of? @_sigil_name "E" "L") - (#set! injection.language "eex")) + (#any-of? @_sigil_name "E" "L") + (#set! injection.language "eex")) (sigil (sigil_name) @_sigil_name (quoted_content) @injection.content - (#any-of? @_sigil_name "z" "Z") - (#set! injection.language "zig")) + (#any-of? @_sigil_name "z" "Z") + (#set! injection.language "zig")) ; Regex (sigil (sigil_name) @_sigil_name (quoted_content) @injection.content - (#any-of? @_sigil_name "r" "R") - (#set! injection.language "regex")) + (#any-of? @_sigil_name "r" "R") + (#set! injection.language "regex")) ; Json (sigil (sigil_name) @_sigil_name (quoted_content) @injection.content - (#any-of? @_sigil_name "j" "J") - (#set! injection.language "json")) - + (#any-of? @_sigil_name "j" "J") + (#set! injection.language "json")) diff --git a/queries/elixir/locals.scm b/queries/elixir/locals.scm index 59e55eae0..003ec4b1b 100644 --- a/queries/elixir/locals.scm +++ b/queries/elixir/locals.scm @@ -5,7 +5,7 @@ ; Module Definitions (call - target: + target: ((identifier) @_identifier (#eq? @_identifier "defmodule")) (arguments diff --git a/queries/elm/highlights.scm b/queries/elm/highlights.scm index 11bc0a00d..86351fe60 100644 --- a/queries/elm/highlights.scm +++ b/queries/elm/highlights.scm @@ -6,10 +6,8 @@ ((block_comment) @comment.documentation (#lua-match? @comment.documentation "^{[-]|[^|]")) - ; Keywords ;--------- - [ "if" "then" @@ -34,13 +32,9 @@ (exposing) ] @keyword.import - ; Punctuation ;------------ - -[ - (double_dot) -] @punctuation.special +(double_dot) @punctuation.special [ "," @@ -57,71 +51,89 @@ "]" ] @punctuation.bracket - ; Variables ;---------- - (value_qid (lower_case_identifier) @variable) + (value_declaration - (function_declaration_left (lower_case_identifier) @variable)) + (function_declaration_left + (lower_case_identifier) @variable)) + (type_annotation (lower_case_identifier) @variable) + (port_annotation (lower_case_identifier) @variable) + (anything_pattern (underscore) @variable) + (record_base_identifier (lower_case_identifier) @variable) + (lower_pattern (lower_case_identifier) @variable) + (exposed_value (lower_case_identifier) @variable) (value_qid - ((dot) (lower_case_identifier) @variable.member)) + ((dot) + (lower_case_identifier) @variable.member)) + (field_access_expr - ((dot) (lower_case_identifier) @variable.member)) + ((dot) + (lower_case_identifier) @variable.member)) (function_declaration_left - (anything_pattern (underscore) @variable.parameter)) -(function_declaration_left - (lower_pattern (lower_case_identifier) @variable.parameter)) + (anything_pattern + (underscore) @variable.parameter)) +(function_declaration_left + (lower_pattern + (lower_case_identifier) @variable.parameter)) ; Functions ;---------- - (value_declaration functionDeclarationLeft: (function_declaration_left (lower_case_identifier) @function (pattern))) + (value_declaration functionDeclarationLeft: (function_declaration_left (lower_case_identifier) @function pattern: (_))) + (value_declaration functionDeclarationLeft: (function_declaration_left (lower_case_identifier) @function) body: (anonymous_function_expr)) + (type_annotation name: (lower_case_identifier) @function - typeExpression: (type_expression (arrow))) + typeExpression: + (type_expression + (arrow))) + (port_annotation name: (lower_case_identifier) @function - typeExpression: (type_expression (arrow))) + typeExpression: + (type_expression + (arrow))) (function_call_expr - target: (value_expr - (value_qid (lower_case_identifier) @function.call))) - + target: + (value_expr + (value_qid + (lower_case_identifier) @function.call))) ; Operators ;---------- - [ (operator_identifier) (eq) @@ -131,31 +143,38 @@ "::" ] @operator - ; Modules ;-------- - (module_declaration - (upper_case_qid (upper_case_identifier) @module)) + (upper_case_qid + (upper_case_identifier) @module)) + (import_clause - (upper_case_qid (upper_case_identifier) @module)) + (upper_case_qid + (upper_case_identifier) @module)) + (as_clause (upper_case_identifier) @module) -(value_expr - (value_qid (upper_case_identifier) @module)) +(value_expr + (value_qid + (upper_case_identifier) @module)) ; Types ;------ - (type_declaration (upper_case_identifier) @type) + (type_ref - (upper_case_qid (upper_case_identifier) @type)) + (upper_case_qid + (upper_case_identifier) @type)) + (type_variable (lower_case_identifier) @type) + (lower_type_name (lower_case_identifier) @type) + (exposed_type (upper_case_identifier) @type) @@ -164,34 +183,43 @@ (field_type name: (lower_case_identifier) @property) + (field name: (lower_case_identifier) @property) (type_declaration - (union_variant (upper_case_identifier) @constructor)) + (union_variant + (upper_case_identifier) @constructor)) + (nullary_constructor_argument_pattern - (upper_case_qid (upper_case_identifier) @constructor)) + (upper_case_qid + (upper_case_identifier) @constructor)) + (union_pattern - (upper_case_qid (upper_case_identifier) @constructor)) -(value_expr - (upper_case_qid (upper_case_identifier)) @constructor) + (upper_case_qid + (upper_case_identifier) @constructor)) +(value_expr + (upper_case_qid + (upper_case_identifier)) @constructor) ; Literals ;--------- - (number_constant_expr (number_literal) @number) (upper_case_qid - ((upper_case_identifier) @boolean (#any-of? @boolean "True" "False"))) + ((upper_case_identifier) @boolean + (#any-of? @boolean "True" "False"))) [ (open_quote) (close_quote) ] @string + (string_constant_expr (string_escape) @string) + (string_constant_expr (regular_string_part) @string) @@ -199,7 +227,9 @@ (open_char) (close_char) ] @character + (char_constant_expr (string_escape) @character) + (char_constant_expr (regular_string_part) @character) diff --git a/queries/elm/injections.scm b/queries/elm/injections.scm index b8b3e9943..7ee6c7f03 100644 --- a/queries/elm/injections.scm +++ b/queries/elm/injections.scm @@ -1,8 +1,8 @@ ([ - (line_comment) + (line_comment) (block_comment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) ((glsl_content) @injection.content - (#set! injection.language "glsl")) + (#set! injection.language "glsl")) diff --git a/queries/elsa/highlights.scm b/queries/elsa/highlights.scm index 8e52b6f5b..1a974bda6 100644 --- a/queries/elsa/highlights.scm +++ b/queries/elsa/highlights.scm @@ -1,28 +1,22 @@ ; Keywords - [ "eval" "let" ] @keyword ; Function - (function) @function ; Method - (method) @function.method ; Parameter - (parameter) @variable.parameter ; Variables - (identifier) @variable ; Operators - [ "\\" "->" @@ -31,11 +25,12 @@ ] @operator ; Punctuation - -["(" ")"] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket ":" @punctuation.delimiter ; Comments - (comment) @comment @spell diff --git a/queries/elsa/injections.scm b/queries/elsa/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/elsa/injections.scm +++ b/queries/elsa/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/elvish/highlights.scm b/queries/elvish/highlights.scm index d6243549f..a2fd9302c 100644 --- a/queries/elvish/highlights.scm +++ b/queries/elvish/highlights.scm @@ -1,32 +1,90 @@ (comment) @comment @spell -["if" "elif"] @keyword.conditional -(if (else "else" @keyword.conditional)) +[ + "if" + "elif" +] @keyword.conditional + +(if + (else + "else" @keyword.conditional)) + +[ + "while" + "for" +] @keyword.repeat -["while" "for"] @keyword.repeat -(while (else "else" @keyword.repeat)) -(for (else "else" @keyword.repeat)) +(while + (else + "else" @keyword.repeat)) + +(for + (else + "else" @keyword.repeat)) + +[ + "try" + "catch" + "finally" +] @keyword.exception -["try" "catch" "finally"] @keyword.exception -(try (else "else" @keyword.exception)) +(try + (else + "else" @keyword.exception)) "use" @keyword.import -(import (bareword) @string.special.path) -(wildcard ["*" "**" "?"] @character.special) +(import + (bareword) @string.special.path) + +(wildcard + [ + "*" + "**" + "?" + ] @character.special) + +(command + argument: (bareword) @variable.parameter) + +(command + head: (identifier) @function.call) + +((command + head: (identifier) @keyword.return) + (#eq? @keyword.return "return")) + +((command + (identifier) @keyword.operator) + (#any-of? @keyword.operator "and" "or" "coalesce")) -(command argument: (bareword) @variable.parameter) -(command head: (identifier) @function.call) -((command head: (identifier) @keyword.return) - (#eq? @keyword.return "return")) -((command (identifier) @keyword.operator) - (#any-of? @keyword.operator "and" "or" "coalesce")) [ - "+" "-" "*" "/" "%" "<" "<=""==" "!=" ">" - ">=" "<s" "<=s" "==s" "!=s" ">s" ">=s" + "+" + "-" + "*" + "/" + "%" + "<" + "<=" + "==" + "!=" + ">" + ">=" + "<s" + "<=s" + "==s" + "!=s" + ">s" + ">=s" ] @function.builtin -[">" "<" ">>" "<>" "|"] @operator +[ + ">" + "<" + ">>" + "<>" + "|" +] @operator (io_port) @number @@ -35,36 +93,63 @@ (identifier) @function) (parameter_list) @variable.parameter -(parameter_list "|" @punctuation.bracket) -["var" "set" "tmp" "del"] @keyword +(parameter_list + "|" @punctuation.bracket) + +[ + "var" + "set" + "tmp" + "del" +] @keyword + (variable_declaration - (lhs (identifier) @variable)) + (lhs + (identifier) @variable)) (variable_assignment - (lhs (identifier) @variable)) + (lhs + (identifier) @variable)) (temporary_assignment - (lhs (identifier) @variable)) + (lhs + (identifier) @variable)) (variable_deletion (identifier) @variable) - (number) @number + (string) @string -(variable (identifier) @variable) -((variable (identifier) @function) +(variable + (identifier) @variable) + +((variable + (identifier) @function) (#match? @function ".+\\~$")) -((variable (identifier) @boolean) - (#any-of? @boolean "true" "false")) -((variable (identifier) @constant.builtin) - (#any-of? @constant.builtin - "_" "after-chdir" "args" "before-chdir" "buildinfo" "nil" - "notify-bg-job-success" "num-bg-jobs" "ok" "paths" "pid" - "pwd" "value-out-indicator" "version")) -["$" "@"] @punctuation.special -["(" ")" "[" "]" "{" "}"] @punctuation.bracket +((variable + (identifier) @boolean) + (#any-of? @boolean "true" "false")) + +((variable + (identifier) @constant.builtin) + (#any-of? @constant.builtin "_" "after-chdir" "args" "before-chdir" "buildinfo" "nil" "notify-bg-job-success" "num-bg-jobs" "ok" "paths" "pid" "pwd" "value-out-indicator" "version")) + +[ + "$" + "@" +] @punctuation.special + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + ";" @punctuation.delimiter diff --git a/queries/elvish/injections.scm b/queries/elvish/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/elvish/injections.scm +++ b/queries/elvish/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/embedded_template/injections.scm b/queries/embedded_template/injections.scm index 2824f7a00..cdeb2cd4f 100644 --- a/queries/embedded_template/injections.scm +++ b/queries/embedded_template/injections.scm @@ -1,7 +1,7 @@ ((content) @injection.content - (#set! injection.language "html") - (#set! injection.combined)) + (#set! injection.language "html") + (#set! injection.combined)) ((code) @injection.content - (#set! injection.language "ruby") - (#set! injection.combined)) + (#set! injection.language "ruby") + (#set! injection.combined)) diff --git a/queries/erlang/highlights.scm b/queries/erlang/highlights.scm index da0d1e600..1b9aeaf4e 100644 --- a/queries/erlang/highlights.scm +++ b/queries/erlang/highlights.scm @@ -1,8 +1,12 @@ -((atom) @constant (#set! "priority" "90")) +((atom) @constant + (#set! "priority" "90")) + (var) @variable (char) @character + (integer) @number + (float) @number.float (comment) @comment @spell @@ -10,13 +14,13 @@ ((comment) @comment.documentation (#lua-match? @comment.documentation "^[%%][%%]")) -;; keyword +; keyword [ "fun" "div" ] @keyword -;; bracket +; bracket [ "(" ")" @@ -27,7 +31,7 @@ "#" ] @punctuation.bracket -;;; Comparisons +; Comparisons [ "==" "=:=" @@ -36,14 +40,14 @@ ">=" "<" ">" -] @operator ;; .comparison +] @operator ; .comparison -;;; operator +; operator [ ":" ":=" "!" - ;; "-" + ; "-" "+" "=" "->" @@ -58,7 +62,7 @@ ";" ] @punctuation.delimiter -;; conditional +; conditional [ "receive" "if" @@ -77,54 +81,108 @@ "try" ] @keyword.exception -((atom) @boolean (#any-of? @boolean "true" "false")) +((atom) @boolean + (#any-of? @boolean "true" "false")) -;; Macros -((macro_call_expr) @constant.macro (#set! "priority" 101)) +; Macros +((macro_call_expr) @constant.macro + (#set! "priority" 101)) -;; Preprocessor +; Preprocessor (pp_define - lhs: _ @constant.macro (#set! "priority" 101) -) -(_preprocessor_directive) @keyword.directive (#set! "priority" 99) + lhs: _ @constant.macro + (#set! "priority" 101)) -;; Attributes +(_preprocessor_directive) @keyword.directive +(#set! "priority" 99) + +; Attributes (pp_include) @keyword.import + (pp_include_lib) @keyword.import + (export_attribute) @keyword.import + (export_type_attribute) @type.definition -(export_type_attribute types: (fa fun: _ @type (#set! "priority" 101))) + +(export_type_attribute + types: + (fa + fun: _ @type + (#set! "priority" 101))) + (behaviour_attribute) @keyword.import -(module_attribute (atom) @module) @keyword.import -(wild_attribute name: (attr_name name: _ @attribute)) @attribute -;; Records +(module_attribute + (atom) @module) @keyword.import + +(wild_attribute + name: + (attr_name + name: _ @attribute)) @attribute + +; Records (record_expr) @type -(record_field_expr _ @variable.member) @type -(record_field_name _ @variable.member) @type -(record_name "#" @type name: _ @type) @type -(record_decl name: _ @type) @type.definition -(record_field name: _ @variable.member) -(record_field name: _ @variable.member ty: _ @type) -;; Type alias -(type_alias name: _ @type) @type.definition +(record_field_expr + _ @variable.member) @type + +(record_field_name + _ @variable.member) @type + +(record_name + "#" @type + name: _ @type) @type + +(record_decl + name: _ @type) @type.definition + +(record_field + name: _ @variable.member) + +(record_field + name: _ @variable.member + ty: _ @type) + +; Type alias +(type_alias + name: _ @type) @type.definition + (spec) @type.definition -[(string) (binary)] @string +[ + (string) + (binary) +] @string + +; expr_function_call +(call + expr: + [ + (atom) + (remote) + (var) + ] @function) -;;; expr_function_call -(call expr: [(atom) (remote) (var)] @function) -(call (atom) @keyword.exception (#any-of? @keyword.exception "error" "throw" "exit")) +(call + (atom) @keyword.exception + (#any-of? @keyword.exception "error" "throw" "exit")) -;;; Parenthesized expression: (SomeFunc)(), only highlight the parens +; Parenthesized expression: (SomeFunc)(), only highlight the parens (call - expr: (paren_expr "(" @function.call ")" @function.call) -) + expr: + (paren_expr + "(" @function.call + ")" @function.call)) -;;; function +; function (external_fun) @function.call -(internal_fun fun: (atom) @function.call) -(function_clause name: (atom) @function) -(fa fun: (atom) @function) +(internal_fun + fun: (atom) @function.call) + +(function_clause + name: (atom) @function) + +(fa + fun: (atom) @function) diff --git a/queries/facility/highlights.scm b/queries/facility/highlights.scm index 060ccd05c..01f1bab19 100644 --- a/queries/facility/highlights.scm +++ b/queries/facility/highlights.scm @@ -11,9 +11,10 @@ "]" "{" "}" -] @punctuation.bracket +] @punctuation.bracket (comment) @comment @spell + (doc_comment) @comment.documentation @spell "method" @keyword.function @@ -78,4 +79,5 @@ name: (identifier) @function.method) (number_literal) @number + (string_literal) @string diff --git a/queries/facility/indents.scm b/queries/facility/indents.scm index 96a24f202..247949ba1 100644 --- a/queries/facility/indents.scm +++ b/queries/facility/indents.scm @@ -1,8 +1,7 @@ [ - (service_block) - (values_block) - (field_list) + (service_block) + (values_block) + (field_list) ] @indent.begin "}" @indent.branch - diff --git a/queries/facility/injections.scm b/queries/facility/injections.scm index 572849ab4..5d9b7836f 100644 --- a/queries/facility/injections.scm +++ b/queries/facility/injections.scm @@ -1,5 +1,8 @@ ((remarks) @injection.content (#set! injection.language "markdown")) -([(comment) (doc_comment)] @injection.content +([ + (comment) + (doc_comment) +] @injection.content (#set! injection.language "comment")) diff --git a/queries/fennel/folds.scm b/queries/fennel/folds.scm index c8427b188..619300c4f 100644 --- a/queries/fennel/folds.scm +++ b/queries/fennel/folds.scm @@ -1 +1,11 @@ -[(list) (table) (sequential_table) (let) (fn) (let_clause) (quoted_list) (local) (global)] @fold +[ + (list) + (table) + (sequential_table) + (let) + (fn) + (let_clause) + (quoted_list) + (local) + (global) +] @fold diff --git a/queries/fennel/highlights.scm b/queries/fennel/highlights.scm index 620c42ef3..ec2a82759 100644 --- a/queries/fennel/highlights.scm +++ b/queries/fennel/highlights.scm @@ -18,29 +18,38 @@ ] @punctuation.special (nil) @constant.builtin + (vararg) @punctuation.special (boolean) @boolean + (number) @number (string) @string + (escape_sequence) @string.escape (symbol) @variable (multi_symbol - "." @punctuation.delimiter - (symbol) @variable.member) + "." @punctuation.delimiter + (symbol) @variable.member) (multi_symbol_method - ":" @punctuation.delimiter - (symbol) @function.method.call .) + ":" @punctuation.delimiter + (symbol) @function.method.call .) + +(list + . + (symbol) @function.call) -(list . (symbol) @function.call) -(list . (multi_symbol (symbol) @function.call .)) +(list + . + (multi_symbol + (symbol) @function.call .)) ((symbol) @variable.builtin - (#lua-match? @variable.builtin "^[$]")) + (#lua-match? @variable.builtin "^[$]")) (binding) @string.special.symbol @@ -51,30 +60,34 @@ "#" ] @keyword.function -(fn name: [ - (symbol) @function - (multi_symbol (symbol) @function .) -]) +(fn + name: + [ + (symbol) @function + (multi_symbol + (symbol) @function .) + ]) -(lambda name: [ - (symbol) @function - (multi_symbol (symbol) @function .) -]) +(lambda + name: + [ + (symbol) @function + (multi_symbol + (symbol) @function .) + ]) [ "for" "each" ] @keyword.repeat + ((symbol) @keyword.repeat - (#any-of? @keyword.repeat - "while")) + (#any-of? @keyword.repeat "while")) + +"match" @keyword.conditional -[ - "match" -] @keyword.conditional ((symbol) @keyword.conditional - (#any-of? @keyword.conditional - "if" "when")) + (#any-of? @keyword.conditional "if" "when")) [ "global" @@ -85,13 +98,12 @@ "where" "or" ] @keyword + ((symbol) @keyword - (#any-of? @keyword - "comment" "do" "doc" "eval-compiler" "lua" "macros" "quote" "tset" "values")) + (#any-of? @keyword "comment" "do" "doc" "eval-compiler" "lua" "macros" "quote" "tset" "values")) ((symbol) @keyword.import - (#any-of? @keyword.import - "require" "require-macros" "import-macros" "include")) + (#any-of? @keyword.import "require" "require-macros" "import-macros" "include")) [ "collect" @@ -100,22 +112,14 @@ ] @function.macro ((symbol) @function.macro - (#any-of? @function.macro - "->" "->>" "-?>" "-?>>" "?." "doto" "macro" "macrodebug" "partial" "pick-args" - "pick-values" "with-open")) + (#any-of? @function.macro "->" "->>" "-?>" "-?>>" "?." "doto" "macro" "macrodebug" "partial" "pick-args" "pick-values" "with-open")) ; Lua builtins ((symbol) @constant.builtin - (#any-of? @constant.builtin - "arg" "_ENV" "_G" "_VERSION")) + (#any-of? @constant.builtin "arg" "_ENV" "_G" "_VERSION")) ((symbol) @function.builtin - (#any-of? @function.builtin - "assert" "collectgarbage" "dofile" "error" "getmetatable" "ipairs" - "load" "loadfile" "next" "pairs" "pcall" "print" "rawequal" "rawget" - "rawlen" "rawset" "require" "select" "setmetatable" "tonumber" "tostring" - "type" "warn" "xpcall")) + (#any-of? @function.builtin "assert" "collectgarbage" "dofile" "error" "getmetatable" "ipairs" "load" "loadfile" "next" "pairs" "pcall" "print" "rawequal" "rawget" "rawlen" "rawset" "require" "select" "setmetatable" "tonumber" "tostring" "type" "warn" "xpcall")) ((symbol) @function.builtin - (#any-of? @function.builtin - "loadstring" "module" "setfenv" "unpack")) + (#any-of? @function.builtin "loadstring" "module" "setfenv" "unpack")) diff --git a/queries/fennel/injections.scm b/queries/fennel/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/fennel/injections.scm +++ b/queries/fennel/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/fennel/locals.scm b/queries/fennel/locals.scm index 38e54bf6d..bf3701a50 100644 --- a/queries/fennel/locals.scm +++ b/queries/fennel/locals.scm @@ -1,26 +1,32 @@ [ - (program) - (fn) - (lambda) - (let) - (each) - (for) - (match) + (program) + (fn) + (lambda) + (let) + (each) + (for) + (match) ] @local.scope -( - (list . (symbol) @_special) @local.scope - (#any-of? @_special - "while" "if" "when" "do" "collect" "icollect" "accumulate") -) +((list + . + (symbol) @_special) @local.scope + (#any-of? @_special "while" "if" "when" "do" "collect" "icollect" "accumulate")) -(fn name: (symbol) @local.definition.function +(fn + name: (symbol) @local.definition.function (#set! definition.function.scope "parent")) -(lambda name: (symbol) @local.definition.function + +(lambda + name: (symbol) @local.definition.function (#set! definition.function.scope "parent")) ; TODO: use @local.definition.parameter for parameters -(binding (symbol) @local.definition.var) -(for_clause . (symbol) @local.definition.var) +(binding + (symbol) @local.definition.var) + +(for_clause + . + (symbol) @local.definition.var) (symbol) @local.reference diff --git a/queries/firrtl/folds.scm b/queries/firrtl/folds.scm index 437b2c81c..4c64e644f 100644 --- a/queries/firrtl/folds.scm +++ b/queries/firrtl/folds.scm @@ -1,6 +1,6 @@ [ - (circuit) - (module) - (when) - (else) + (circuit) + (module) + (when) + (else) ] @fold diff --git a/queries/firrtl/highlights.scm b/queries/firrtl/highlights.scm index 5f165eb32..8e078fad2 100644 --- a/queries/firrtl/highlights.scm +++ b/queries/firrtl/highlights.scm @@ -1,30 +1,26 @@ ; Namespaces +(circuit + (identifier) @module) -(circuit (identifier) @module) - -(module (identifier) @module) +(module + (identifier) @module) ; Types - ((identifier) @type (#lua-match? @type "^[A-Z][A-Za-z0-9_$]*$")) ; Keywords - [ "circuit" "module" "extmodule" - "flip" "parameter" "reset" "wire" - "cmem" "smem" "mem" - "reg" "with" "mport" @@ -34,39 +30,32 @@ "is" "invalid" "skip" - "infer" "read" "write" "rdwr" - "defname" ] @keyword ; Qualifiers - (qualifier) @type.qualifier ; Storageclasses - [ "input" "output" ] @keyword.storage ; Conditionals - [ "when" "else" ] @keyword.conditional ; Annotations - (info) @attribute ; Builtins - [ "stop" "printf" @@ -89,7 +78,6 @@ ] @type.builtin ; Fields - [ "data-type" "depth" @@ -104,33 +92,44 @@ ((field_id) @variable.member (#set! "priority" 105)) -(port (identifier) @variable.member) +(port + (identifier) @variable.member) -(wire (identifier) @variable.member) +(wire + (identifier) @variable.member) -(cmem (identifier) @variable.member) +(cmem + (identifier) @variable.member) -(smem (identifier) @variable.member) +(smem + (identifier) @variable.member) -(memory (identifier) @variable.member) +(memory + (identifier) @variable.member) -(register (identifier) @variable.member) +(register + (identifier) @variable.member) ; Parameters +(primitive_operation + (identifier) @variable.parameter) -(primitive_operation (identifier) @variable.parameter) +(mux + (identifier) @variable.parameter) -(mux (identifier) @variable.parameter) -(printf (identifier) @variable.parameter) -(reset (identifier) @variable.parameter) -(stop (identifier) @variable.parameter) +(printf + (identifier) @variable.parameter) -; Variables +(reset + (identifier) @variable.parameter) +(stop + (identifier) @variable.parameter) + +; Variables (identifier) @variable ; Operators - (primop) @keyword.operator [ @@ -143,7 +142,6 @@ ] @operator ; Literals - [ (uint) (number) @@ -164,14 +162,25 @@ ] @constant.builtin ; Punctuation +[ + "{" + "}" +] @punctuation.bracket -[ "{" "}" ] @punctuation.bracket - -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "<" ">" ] @punctuation.bracket +[ + "<" + ">" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket [ "," @@ -180,7 +189,10 @@ ] @punctuation.delimiter ; Comments - (comment) @comment @spell -["=>" "<=" "="] @operator +[ + "=>" + "<=" + "=" +] @operator diff --git a/queries/firrtl/indents.scm b/queries/firrtl/indents.scm index 8bc1e2019..e172e1e81 100644 --- a/queries/firrtl/indents.scm +++ b/queries/firrtl/indents.scm @@ -1,9 +1,9 @@ [ - (circuit) - (module) - (memory) - (when) - (else) + (circuit) + (module) + (memory) + (when) + (else) ] @indent.begin [ diff --git a/queries/firrtl/injections.scm b/queries/firrtl/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/firrtl/injections.scm +++ b/queries/firrtl/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/firrtl/locals.scm b/queries/firrtl/locals.scm index aa0e294cd..97b7931bf 100644 --- a/queries/firrtl/locals.scm +++ b/queries/firrtl/locals.scm @@ -1,38 +1,45 @@ ; Scopes - [ (source_file) (circuit) (module) - (else) (when) ] @local.scope ; References - (identifier) @local.reference ; Definitions +(port + (identifier) @local.definition.field) -(port (identifier) @local.definition.field) - -(wire (identifier) @local.definition.field) +(wire + (identifier) @local.definition.field) -(cmem (identifier) @local.definition.field) +(cmem + (identifier) @local.definition.field) -(smem (identifier) @local.definition.field) +(smem + (identifier) @local.definition.field) -(memory (identifier) @local.definition.field) +(memory + (identifier) @local.definition.field) -(register (identifier) @local.definition.field) +(register + (identifier) @local.definition.field) -(circuit (identifier) @local.definition.namespace) +(circuit + (identifier) @local.definition.namespace) -(module (identifier) @local.definition.namespace) +(module + (identifier) @local.definition.namespace) -(parameter (identifier) @local.definition.parameter) +(parameter + (identifier) @local.definition.parameter) -(rdwr (identifier) @local.definition.var) +(rdwr + (identifier) @local.definition.var) -(node (identifier) @local.definition.var) +(node + (identifier) @local.definition.var) diff --git a/queries/fish/folds.scm b/queries/fish/folds.scm index 6075e2e04..06363e15e 100644 --- a/queries/fish/folds.scm +++ b/queries/fish/folds.scm @@ -1,8 +1,8 @@ [ - (function_definition) - (if_statement) - (switch_statement) - (for_statement) - (while_statement) - (begin_statement) + (function_definition) + (if_statement) + (switch_statement) + (for_statement) + (while_statement) + (begin_statement) ] @fold diff --git a/queries/fish/highlights.scm b/queries/fish/highlights.scm index 28ddf0b98..77dccbf89 100644 --- a/queries/fish/highlights.scm +++ b/queries/fish/highlights.scm @@ -1,163 +1,174 @@ -;; Fish highlighting - -;; Operators - +; Fish highlighting +; Operators [ - "&&" - "||" - "|" - "&" - ".." - "!" - (direction) - (stream_redirect) + "&&" + "||" + "|" + "&" + ".." + "!" + (direction) + (stream_redirect) ] @operator -;; match operators of test command +; match operators of test command (command - name: (word) @function.builtin (#eq? @function.builtin "test") - argument: (word) @operator (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) + name: (word) @function.builtin + (#eq? @function.builtin "test") + argument: (word) @operator + (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) -;; match operators of [ command +; match operators of [ command (command - name: (word) @punctuation.bracket (#eq? @punctuation.bracket "[") - argument: (word) @operator (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) + name: (word) @punctuation.bracket + (#eq? @punctuation.bracket "[") + argument: (word) @operator + (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) [ - "not" - "and" - "or" + "not" + "and" + "or" ] @keyword.operator -;; Conditionals - +; Conditionals (if_statement -[ - "if" - "end" -] @keyword.conditional) + [ + "if" + "end" + ] @keyword.conditional) (switch_statement -[ - "switch" - "end" -] @keyword.conditional) + [ + "switch" + "end" + ] @keyword.conditional) (case_clause -[ - "case" -] @keyword.conditional) + "case" @keyword.conditional) -(else_clause -[ - "else" -] @keyword.conditional) - -(else_if_clause -[ - "else" - "if" -] @keyword.conditional) +(else_clause + "else" @keyword.conditional) -;; Loops/Blocks +(else_if_clause + [ + "else" + "if" + ] @keyword.conditional) +; Loops/Blocks (while_statement -[ - "while" - "end" -] @keyword.repeat) + [ + "while" + "end" + ] @keyword.repeat) (for_statement -[ - "for" - "end" -] @keyword.repeat) + [ + "for" + "end" + ] @keyword.repeat) (begin_statement -[ - "begin" - "end" -] @keyword.repeat) - -;; Keywords + [ + "begin" + "end" + ] @keyword.repeat) +; Keywords [ - "in" - (break) - (continue) + "in" + (break) + (continue) ] @keyword "return" @keyword.return -;; Punctuation - +; Punctuation [ - "[" - "]" - "{" - "}" - "(" - ")" + "[" + "]" + "{" + "}" + "(" + ")" ] @punctuation.bracket "," @punctuation.delimiter -;; Commands - +; Commands (command - argument: [ - (word) @variable.parameter (#lua-match? @variable.parameter "^[-]") - ] -) + argument: + [ + (word) @variable.parameter + (#lua-match? @variable.parameter "^[-]") + ]) -(command_substitution "$" @punctuation.bracket) +(command_substitution + "$" @punctuation.bracket) ; non-builtin command names -(command name: (word) @function.call) +(command + name: (word) @function.call) ; derived from builtin -n (fish 3.2.2) (command - name: [ - (word) @function.builtin - (#any-of? @function.builtin "." ":" "_" "alias" "argparse" "bg" "bind" "block" "breakpoint" "builtin" "cd" "command" "commandline" "complete" "contains" "count" "disown" "echo" "emit" "eval" "exec" "exit" "fg" "functions" "history" "isatty" "jobs" "math" "printf" "pwd" "random" "read" "realpath" "set" "set_color" "source" "status" "string" "test" "time" "type" "ulimit" "wait") - ] -) - -;; Functions + name: + [ + (word) @function.builtin + (#any-of? @function.builtin "." ":" "_" "alias" "argparse" "bg" "bind" "block" "breakpoint" "builtin" "cd" "command" "commandline" "complete" "contains" "count" "disown" "echo" "emit" "eval" "exec" "exit" "fg" "functions" "history" "isatty" "jobs" "math" "printf" "pwd" "random" "read" "realpath" "set" "set_color" "source" "status" "string" "test" "time" "type" "ulimit" "wait") + ]) -(function_definition ["function" "end"] @keyword.function) +; Functions +(function_definition + [ + "function" + "end" + ] @keyword.function) (function_definition - name: [ - (word) (concatenation) - ] -@function) + name: + [ + (word) + (concatenation) + ] @function) (function_definition - option: [ - (word) - (concatenation (word)) - ] @variable.parameter (#lua-match? @variable.parameter "^[-]") -) + option: + [ + (word) + (concatenation + (word)) + ] @variable.parameter + (#lua-match? @variable.parameter "^[-]")) -;; Strings +; Strings +[ + (double_quote_string) + (single_quote_string) +] @string -[(double_quote_string) (single_quote_string)] @string (escape_sequence) @string.escape -;; Variables - +; Variables (variable_name) @variable + (variable_expansion) @constant -;; Nodes +; Nodes +[ + (integer) + (float) +] @number -[(integer) (float)] @number (comment) @comment + (comment) @spell ((word) @boolean -(#any-of? @boolean "true" "false")) + (#any-of? @boolean "true" "false")) -((program . (comment) @keyword.directive) +((program + . + (comment) @keyword.directive) (#lua-match? @keyword.directive "^#!/")) diff --git a/queries/fish/indents.scm b/queries/fish/indents.scm index 526c56e69..4984c4cb2 100644 --- a/queries/fish/indents.scm +++ b/queries/fish/indents.scm @@ -1,16 +1,16 @@ [ - (function_definition) - (while_statement) - (for_statement) - (if_statement) - (begin_statement) - (switch_statement) + (function_definition) + (while_statement) + (for_statement) + (if_statement) + (begin_statement) + (switch_statement) ] @indent.begin [ - "else" ; else and else if must both start the line with "else", so tag the string directly - "case" - "end" + "else" ; else and else if must both start the line with "else", so tag the string directly + "case" + "end" ] @indent.branch "end" @indent.end diff --git a/queries/fish/injections.scm b/queries/fish/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/fish/injections.scm +++ b/queries/fish/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/fish/locals.scm b/queries/fish/locals.scm index 15c3aac1d..904d568f9 100644 --- a/queries/fish/locals.scm +++ b/queries/fish/locals.scm @@ -1,4 +1,4 @@ -;; Scopes +; Scopes [ (command) (function_definition) @@ -9,10 +9,11 @@ (switch_statement) ] @local.scope -;; Definitions +; Definitions (function_definition name: (word) @local.definition.function) -;; References +; References (variable_name) @local.reference + (word) @local.reference diff --git a/queries/foam/folds.scm b/queries/foam/folds.scm index 2e499c2e2..e05d0dbaa 100644 --- a/queries/foam/folds.scm +++ b/queries/foam/folds.scm @@ -1,7 +1,8 @@ [ - (comment) - (list) - (dict_core) + (comment) + (list) + (dict_core) ] @fold -(code (code_body)* @fold) +(code + (code_body)* @fold) diff --git a/queries/foam/highlights.scm b/queries/foam/highlights.scm index 33370df66..9c96f196e 100644 --- a/queries/foam/highlights.scm +++ b/queries/foam/highlights.scm @@ -1,44 +1,47 @@ -;; Comments +; Comments (comment) @comment @spell -;; Generic Key-value pairs and dictionary keywords +; Generic Key-value pairs and dictionary keywords (key_value - keyword: (identifier) @function -) + keyword: (identifier) @function) + (dict - key: (identifier) @type -) + key: (identifier) @type) -;; Macros +; Macros (macro - "$" @keyword.conditional - (prev_scope)* @keyword.conditional - (identifier)* @module -) - + "$" @keyword.conditional + (prev_scope)* @keyword.conditional + (identifier)* @module) -;; Directives +; Directives "#" @keyword.conditional + (preproc_call - directive: (identifier)* @keyword.conditional - argument: (identifier)* @module -) + directive: (identifier)* @keyword.conditional + argument: (identifier)* @module) + ((preproc_call argument: (identifier)* @module) @keyword.conditional (#eq? @keyword.conditional "ifeq")) + ((preproc_call) @keyword.conditional (#any-of? @keyword.conditional "else" "endif")) -;; Literals +; Literals (number_literal) @number.float + (string_literal) @string + (escape_sequence) @string.escape + (boolean) @boolean -;; Treat [m^2 s^-2] the same as if it was put in numbers format -(dimensions dimension: (identifier) @number.float) +; Treat [m^2 s^-2] the same as if it was put in numbers format +(dimensions + dimension: (identifier) @number.float) -;; Punctuation +; Punctuation [ "(" ")" diff --git a/queries/foam/indents.scm b/queries/foam/indents.scm index a52cafea6..be02b80ed 100644 --- a/queries/foam/indents.scm +++ b/queries/foam/indents.scm @@ -3,9 +3,9 @@ "}" ] @indent.branch -[(dict) (key_value)] @indent.begin - - [ - (comment) -] @indent.ignore + (dict) + (key_value) +] @indent.begin + +(comment) @indent.ignore diff --git a/queries/foam/injections.scm b/queries/foam/injections.scm index 2d744f6af..e1c223bd2 100644 --- a/queries/foam/injections.scm +++ b/queries/foam/injections.scm @@ -1,20 +1,20 @@ -;; Pass code blocks to Cpp highlighter -(code - (code_body) @injection.content +; Pass code blocks to Cpp highlighter +(code + (code_body) @injection.content (#set! injection.language "cpp")) -;; Pass identifiers to Go highlighter (Cheating I know) -;; ((identifier) @injection.content -;; (#set! injection.language "lua") +; Pass identifiers to Go highlighter (Cheating I know) +; ((identifier) @injection.content +; (#set! injection.language "lua") +; Highlight regex syntax inside literal strings +((string_literal) @injection.content + (#set! injection.language "regex")) -;; Highlight regex syntax inside literal strings -((string_literal) @injection.content - (#set! injection.language "regex")) - -;; Highlight PyFoam syntax as Python statements +; Highlight PyFoam syntax as Python statements (pyfoam_variable code_body: (_) @injection.content (#set! injection.language "python")) + (pyfoam_expression code_body: (_) @injection.content (#set! injection.language "python")) diff --git a/queries/foam/locals.scm b/queries/foam/locals.scm index c1f635036..508643672 100644 --- a/queries/foam/locals.scm +++ b/queries/foam/locals.scm @@ -1,6 +1,12 @@ (dict) @local.scope -(dict key: (_) @local.definition.type) +(dict + key: (_) @local.definition.type) -(key_value keyword: (_) @local.definition.parameter) -(key_value value: (macro (identifier)*)* @local.reference) +(key_value + keyword: (_) @local.definition.parameter) + +(key_value + value: + (macro + (identifier)*)* @local.reference) diff --git a/queries/fortran/folds.scm b/queries/fortran/folds.scm index a2edc64d3..cedbdb635 100644 --- a/queries/fortran/folds.scm +++ b/queries/fortran/folds.scm @@ -1,11 +1,11 @@ -;; by @oponkork +; by @oponkork [ - (if_statement) - (where_statement) - (enum_statement) - (do_loop_statement) - (derived_type_definition) - (function) - (subroutine) - (interface) + (if_statement) + (where_statement) + (enum_statement) + (do_loop_statement) + (derived_type_definition) + (function) + (subroutine) + (interface) ] @fold diff --git a/queries/fortran/highlights.scm b/queries/fortran/highlights.scm index c2eaa6a7e..c88ad9cec 100644 --- a/queries/fortran/highlights.scm +++ b/queries/fortran/highlights.scm @@ -1,9 +1,7 @@ ; Preprocs - (preproc_file_line) @keyword.directive ; Namespaces - (program_statement (name) @module) @@ -23,7 +21,6 @@ (name) @module) ; Includes - [ "import" "include" @@ -32,10 +29,12 @@ (import_statement "," - ["all" "none"] @keyword) + [ + "all" + "none" + ] @keyword) ; Attributes - [ (none) "implicit" @@ -46,7 +45,6 @@ "type" @attribute) ; Keywords - [ "attributes" "associate" @@ -88,22 +86,14 @@ "typeis" ] @keyword -[ - (default) -] @keyword +(default) @keyword ; Types +(type_name) @type -[ - (type_name) -] @type - -[ - (intrinsic_type) -] @type.builtin +(intrinsic_type) @type.builtin ; Qualifiers - [ "abstract" "allocatable" @@ -150,7 +140,6 @@ ] @keyword.storage ; Labels - [ (statement_label) (statement_label_reference) @@ -174,7 +163,6 @@ ] @keyword.return ; Functions - (function_statement (name) @function) @@ -208,13 +196,9 @@ ] @function.builtin ; Exceptions - -[ - "error" -] @keyword.exception +"error" @keyword.exception ; Conditionals - [ "else" "elseif" @@ -227,7 +211,6 @@ ] @keyword.conditional ; Repeats - [ "do" "concurrent" @@ -241,11 +224,9 @@ ] @keyword.repeat ; Variables - (identifier) @variable ; Parameters - (keyword_argument name: (identifier) @variable.parameter) @@ -253,12 +234,10 @@ (identifier) @variable.parameter) ; Properties - (derived_type_member_expression (type_member) @property) ; Operators - [ "+" "-" @@ -291,15 +270,26 @@ ] @keyword.operator ; Punctuation +[ + "[" + "]" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket - -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -[ "<<<" ">>>" ] @punctuation.bracket +[ + "<<<" + ">>>" +] @punctuation.bracket (array_literal - ["(/" "/)"] @punctuation.bracket) + [ + "(/" + "/)" + ] @punctuation.bracket) [ ":" @@ -311,7 +301,6 @@ ] @punctuation.delimiter ; Literals - (string_literal) @string (number_literal) @number @@ -321,7 +310,6 @@ (null_literal) @constant.builtin ; Comments - (comment) @comment @spell ((comment) @comment.documentation diff --git a/queries/fsh/highlights.scm b/queries/fsh/highlights.scm index 9a11e279f..3404fa7c6 100644 --- a/queries/fsh/highlights.scm +++ b/queries/fsh/highlights.scm @@ -71,17 +71,23 @@ "Canonical" ] @type.builtin +(sd_metadata + (parent + (name))) @type -(sd_metadata (parent (name))) @type -(target_type (name)) @type +(target_type + (name)) @type ; Strings (string) @string + (multiline_string) @string ; Constants (strength_value) @constant + (bool) @constant.boolean + (flag) @constant ; Special Params diff --git a/queries/func/highlights.scm b/queries/func/highlights.scm index b5b6dde35..a6fb6bd0b 100644 --- a/queries/func/highlights.scm +++ b/queries/func/highlights.scm @@ -1,13 +1,10 @@ ; Include - "#include" @keyword.import + (include_path) @string ; Preproc - -[ - "#pragma" -] @keyword.directive +"#pragma" @keyword.directive (pragma_directive [ @@ -17,7 +14,6 @@ ] @keyword.directive) ; Keywords - [ "asm" "impure" @@ -27,12 +23,9 @@ "type" ] @keyword -[ - "return" -] @keyword.return +"return" @keyword.return ; Conditionals - [ "if" "ifnot" @@ -43,14 +36,12 @@ ] @keyword.conditional ; Exceptions - [ "try" "catch" ] @keyword.exception ; Repeats - [ "do" "forall" @@ -66,16 +57,13 @@ ] @type.qualifier ; Variables - (identifier) @variable ; Constants - (const_var_declarations name: (identifier) @constant) ; Functions/Methods - (function_definition name: (function_name) @function) @@ -86,17 +74,14 @@ method_name: (identifier) @function.method.call) ; Parameters - (parameter) @variable.parameter ; Types - (type_identifier) @type (primitive_type) @type.builtin ; Operators - [ "=" "+=" @@ -143,7 +128,6 @@ ] @operator ; Literals - [ (string) (asm_instruction) @@ -157,12 +141,21 @@ (number) @number ; Punctuation +[ + "{" + "}" +] @punctuation.bracket -["{" "}"] @punctuation.bracket - -["(" ")" "()"] @punctuation.bracket +[ + "(" + ")" + "()" +] @punctuation.bracket -["[" "]"] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket [ ";" @@ -171,5 +164,4 @@ ] @punctuation.delimiter ; Comments - (comment) @comment @spell diff --git a/queries/fusion/highlights.scm b/queries/fusion/highlights.scm index e8c217e67..dca576f84 100644 --- a/queries/fusion/highlights.scm +++ b/queries/fusion/highlights.scm @@ -1,11 +1,14 @@ (comment) @comment @spell + (afx_comment) @comment @spell ; identifiers afx (afx_opening_element (afx_identifier) @tag) + (afx_closing_element (afx_identifier) @tag) + (afx_element_self_closing (afx_identifier) @tag) @@ -15,11 +18,9 @@ (afx_text) @spell ; identifiers eel - (eel_object_path (eel_path_identifier) @variable.builtin - (#any-of? @variable.builtin "this" "props") -) + (#any-of? @variable.builtin "this" "props")) (eel_object_path (eel_path_identifier) @variable) @@ -33,19 +34,16 @@ ; identifiers fusion ; ----------- - (path_part) @property + (meta_property) @attribute + (prototype_signature - "prototype" @keyword + "prototype" @keyword) -) (include_statement - [ - "include" - ] @keyword.import - (source_file) @string.special.url -) + "include" @keyword.import + (source_file) @string.special.url) (namespace_declaration "namespace" @keyword @@ -58,21 +56,21 @@ ; ------ (afx_opening_element [ - "<" - ">" - ] @punctuation.bracket) + "<" + ">" + ] @punctuation.bracket) - (afx_closing_element +(afx_closing_element [ - "<" - ">" - "/" - ] @punctuation.bracket) + "<" + ">" + "/" + ] @punctuation.bracket) (afx_element_self_closing [ - "<" - "/>" + "<" + "/>" ] @punctuation.bracket) [ @@ -80,41 +78,55 @@ (alias_namespace) ] @module -(namespace_declaration "=" @operator) -(assignment "=" @operator) -(copy "<" @operator) +(namespace_declaration + "=" @operator) + +(assignment + "=" @operator) + +(copy + "<" @operator) + (deletion) @operator + (eel_binary_expression operator: _ @operator) + (eel_not_expression [ - "!" - "not" + "!" + "not" ] @operator) (string) @string + (number) @number + (boolean) @boolean + (null) @constant.builtin (value_expression start: _ @punctuation.special - end: _ @punctuation.special -) + end: _ @punctuation.special) + [ - "(" - ")" - "{" - "}" - "[" - "]" + "(" + ")" + "{" + "}" + "[" + "]" ] @punctuation.bracket [ - ":" - "." - "?" + ":" + "." + "?" ] @punctuation.delimiter (eel_ternary_expression - ["?" ":"] @keyword.conditional.ternary) + [ + "?" + ":" + ] @keyword.conditional.ternary) diff --git a/queries/fusion/indents.scm b/queries/fusion/indents.scm index 73133191b..0ba6cf758 100644 --- a/queries/fusion/indents.scm +++ b/queries/fusion/indents.scm @@ -7,13 +7,18 @@ (eel_object) ] @indent.begin +(block + end: _ @indent.branch) -(block end: _ @indent.branch) -(value_dsl end: _ @indent.branch) -(eel_array end: _ @indent.branch) -(eel_object end: _ @indent.branch) -[ - (afx_closing_element) -] @indent.branch +(value_dsl + end: _ @indent.branch) + +(eel_array + end: _ @indent.branch) + +(eel_object + end: _ @indent.branch) + +(afx_closing_element) @indent.branch (comment) @indent.ignore diff --git a/queries/fusion/locals.scm b/queries/fusion/locals.scm index 19afce078..d23e0ab46 100644 --- a/queries/fusion/locals.scm +++ b/queries/fusion/locals.scm @@ -1,21 +1,23 @@ -;; Fusion base +; Fusion base (block) @local.scope (namespace_declaration (alias_namespace) @local.definition.namespace) (property - (path (path_part) @local.definition.field)) + (path + (path_part) @local.definition.field)) (type namespace: (package_name)? @local.definition.namespace - name: (type_name) @local.definition.type -) + name: (type_name) @local.definition.type) -;; Eel Expressions +; Eel Expressions (eel_arrow_function) @local.scope + (eel_object) @local.scope (eel_parameter) @local.definition.parameter + (eel_object_pair key: (eel_property_name) @local.definition.field) diff --git a/queries/gdscript/folds.scm b/queries/gdscript/folds.scm index 946b0fea3..828ef807f 100644 --- a/queries/gdscript/folds.scm +++ b/queries/gdscript/folds.scm @@ -2,7 +2,6 @@ ; Body fold will "join" the next adjacent fold into a SUPER fold. ; This is an issue with the grammar. ; (body) - (if_statement) (elif_clause) (else_clause) @@ -16,10 +15,11 @@ (lambda) (constructor_definition) ] @fold - ; It's nice to be able to fold the if/elif/else clauses and the entire ; if_statement. -(if_statement (body) @fold) +(if_statement + (body) @fold) ; Fold strings that are probably doc strings. -(expression_statement (string) @fold) +(expression_statement + (string) @fold) diff --git a/queries/gdscript/highlights.scm b/queries/gdscript/highlights.scm index 21e0b8e0b..212bc67e3 100644 --- a/queries/gdscript/highlights.scm +++ b/queries/gdscript/highlights.scm @@ -1,23 +1,44 @@ -;; Basic - +; Basic (identifier) @variable + (name) @variable + (type) @type + (comment) @comment @spell + (string_name) @string + (string) @string + (float) @number.float + (integer) @number + (null) @constant + (setter) @function + (getter) @function -(set_body "set" @keyword.function) -(get_body "get" @keyword.function) + +(set_body + "set" @keyword.function) + +(get_body + "get" @keyword.function) + (static_keyword) @type.qualifier + (tool_statement) @keyword + (breakpoint_statement) @keyword.debug + (inferred_type) @operator -[(true) (false)] @boolean + +[ + (true) + (false) +] @boolean [ (get_node) @@ -31,68 +52,105 @@ "const" @type.qualifier (name) @constant) -(expression_statement (string) @comment @spell) +(expression_statement + (string) @comment @spell) -;; Identifier naming conventions +; Identifier naming conventions ((identifier) @type (#lua-match? @type "^[A-Z]")) + ((identifier) @constant (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) -;; Functions +; Functions (constructor_definition) @constructor (function_definition - (name) @function (parameters + (name) @function + (parameters (identifier) @variable.parameter)*) -(typed_parameter (identifier) @variable.parameter) -(default_parameter (identifier) @variable.parameter) +(typed_parameter + (identifier) @variable.parameter) + +(default_parameter + (identifier) @variable.parameter) -(call (identifier) @function.call) -(call (identifier) @keyword.import - (#any-of? @keyword.import "preload" "load")) +(call + (identifier) @function.call) -;; Properties and Methods +(call + (identifier) @keyword.import + (#any-of? @keyword.import "preload" "load")) +; Properties and Methods ; We'll use @property since that's the term Godot uses. ; But, should (source (variable_statement (name))) be @property, too? Since a ; script file is a class in gdscript. (class_definition - (body (variable_statement (name) @property))) + (body + (variable_statement + (name) @property))) ; Same question but for methods? (class_definition - (body (function_definition (name) @function.method))) + (body + (function_definition + (name) @function.method))) -(attribute_call (identifier) @function.method.call) -(attribute (_) (identifier) @property) +(attribute_call + (identifier) @function.method.call) -;; Enums +(attribute + (_) + (identifier) @property) -(enumerator left: (identifier) @constant) - -;; Special Builtins +; Enums +(enumerator + left: (identifier) @constant) +; Special Builtins ((identifier) @variable.builtin (#any-of? @variable.builtin "self" "super")) -(attribute_call (identifier) @keyword.operator - (#eq? @keyword.operator "new")) +(attribute_call + (identifier) @keyword.operator + (#eq? @keyword.operator "new")) -;; Match Pattern +; Match Pattern +(underscore) @constant ; The "_" pattern. -(underscore) @constant ; The "_" pattern. (pattern_open_ending) @operator ; The ".." pattern. -;; Alternations -["(" ")" "[" "]" "{" "}"] @punctuation.bracket +; Alternations +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket -["," "." ":"] @punctuation.delimiter +[ + "," + "." + ":" +] @punctuation.delimiter -["if" "elif" "else" "match"] @keyword.conditional +[ + "if" + "elif" + "else" + "match" +] @keyword.conditional -["for" "while" "break" "continue"] @keyword.repeat +[ + "for" + "while" + "break" + "continue" +] @keyword.repeat [ "~" @@ -157,28 +215,24 @@ "func" @keyword.function -[ - "return" -] @keyword.return - -[ - "await" -] @keyword.coroutine +"return" @keyword.return -(call (identifier) @keyword.coroutine - (#eq? @keyword.coroutine "yield")) +"await" @keyword.coroutine +(call + (identifier) @keyword.coroutine + (#eq? @keyword.coroutine "yield")) -;; Builtins +; Builtins ; generated from ; - https://github.com/godotengine/godot/blob/491ded18983a4ae963ce9c29e8df5d5680873ccb/doc/classes/@GlobalScope.xml ; - https://github.com/godotengine/godot/blob/491ded18983a4ae963ce9c29e8df5d5680873ccb/modules/gdscript/doc_classes/@GDScript.xml ; some from: ; - https://github.com/godotengine/godot-vscode-plugin/blob/0636797c22bf1e23a41fd24d55cdb9be62e0c992/syntaxes/GDScript.tmLanguage.json - -;; Built-in Annotations - -((annotation "@" @attribute (identifier) @attribute) +; Built-in Annotations +((annotation + "@" @attribute + (identifier) @attribute) ; format-ignore (#any-of? @attribute ; @GDScript @@ -191,9 +245,11 @@ "export_placeholder" "export_range" "export_subgroup" "icon" "onready" "rpc" "tool" "warning_ignore")) -;; Builtin Types - -([(identifier) (type)] @type.builtin +; Builtin Types +([ + (identifier) + (type) +] @type.builtin ; format-ignore (#any-of? @type.builtin ; from godot-vscode-plugin @@ -220,9 +276,9 @@ "TranslationServer" "WorkerThreadPool" "XRServer" )) -;; Builtin Funcs - -(call (identifier) @function.builtin +; Builtin Funcs +(call + (identifier) @function.builtin ; format-ignore (#any-of? @function.builtin ; @GlobalScope @@ -248,9 +304,7 @@ "Color8" "assert" "char" "convert" "dict_to_inst" "get_stack" "inst_to_dict" "is_instance_of" "len" "print_debug" "print_stack" "range" "type_exists")) - -;; Builtin Constants - +; Builtin Constants ((identifier) @constant.builtin ; format-ignore (#any-of? @constant.builtin @@ -341,4 +395,3 @@ "OP_EQUAL" "OP_NOT_EQUAL" "OP_LESS" "OP_LESS_EQUAL" "OP_GREATER" "OP_GREATER_EQUAL" "OP_ADD" "OP_SUBTRACT" "OP_MULTIPLY" "OP_DIVIDE" "OP_NEGATE" "OP_POSITIVE" "OP_MODULE" "OP_POWER" "OP_SHIFT_LEFT" "OP_SHIFT_RIGHT" "OP_BIT_AND" "OP_BIT_OR" "OP_BIT_XOR" "OP_BIT_NEGATE" "OP_AND" "OP_OR" "OP_XOR" "OP_NOT" "OP_IN" "OP_MAX")) - diff --git a/queries/gdscript/indents.scm b/queries/gdscript/indents.scm index 4eb579b22..22d155e6f 100644 --- a/queries/gdscript/indents.scm +++ b/queries/gdscript/indents.scm @@ -1,7 +1,6 @@ [ (lambda) (function_definition) - (for_statement) (while_statement) (if_statement) @@ -20,12 +19,12 @@ ] @indent.branch [ - (string) - (comment) - (array) - (dictionary) - (parenthesized_expression) - (ERROR) + (string) + (comment) + (array) + (dictionary) + (parenthesized_expression) + (ERROR) ] @indent.auto [ @@ -36,43 +35,43 @@ ] @indent.dedent [ - (ERROR "[") - (ERROR "(") - (ERROR "{") + (ERROR + "[") + (ERROR + "(") + (ERROR + "{") ] @indent.begin -;; This only works with expanded tabs. +; This only works with expanded tabs. ; ((parameters) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")")) ; ((arguments) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")")) - -;; The following queries either do not agree with the current body parsing or are -;; attempted workarounds. Specifically as the last statement of a body. Opening -;; a new line in between statements works well. -;; -;; The overall experience is poor, so I've opted for @indent.auto. -;; -;; The gdscript parser will need to be patched to accommodate more interactive -;; edits. As far as I can tell the parser greedily consumes whitespace -;; as a zero-width token which causes trouble when inserting indents. - -;; This indents correctly with tabs. +; The following queries either do not agree with the current body parsing or are +; attempted workarounds. Specifically as the last statement of a body. Opening +; a new line in between statements works well. +; +; The overall experience is poor, so I've opted for @indent.auto. +; +; The gdscript parser will need to be patched to accommodate more interactive +; edits. As far as I can tell the parser greedily consumes whitespace +; as a zero-width token which causes trouble when inserting indents. +; This indents correctly with tabs. ; (arguments) @indent.begin ; (parameters) @indent.begin ; (array) @indent.begin ; (dictionary) @indent.begin ; (parenthesized_expression) @indent.begin - -;; Partial workaround for when the cursor is on the bracket character and a newline -;; is created with <o>. Without this the newline is opened with extra -;; indentation. +; Partial workaround for when the cursor is on the bracket character and a newline +; is created with <o>. Without this the newline is opened with extra +; indentation. ; (body (_ (array "]" @indent.end) ) _) -;; Problematic behaviors occur at the last statement of a body. -;; with @dedent: -;; - [ | ] i<CR> will dedent ] to 0. -;; - [ -;; ]| o will open new line at correct indentation. -;; with @auto: -;; - [ | ] i<CR> same -;; - [ -;; ]| o will open new line with extra indent. +; Problematic behaviors occur at the last statement of a body. +; with @dedent: +; - [ | ] i<CR> will dedent ] to 0. +; - [ +; ]| o will open new line at correct indentation. +; with @auto: +; - [ | ] i<CR> same +; - [ +; ]| o will open new line with extra indent. ;(body (_ (array "]" @indent.auto) ) .) diff --git a/queries/gdscript/injections.scm b/queries/gdscript/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/gdscript/injections.scm +++ b/queries/gdscript/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/gdscript/locals.scm b/queries/gdscript/locals.scm index ebcda4f7d..83a1b4433 100644 --- a/queries/gdscript/locals.scm +++ b/queries/gdscript/locals.scm @@ -1,5 +1,4 @@ -;; Scopes - +; Scopes [ (if_statement) (elif_clause) @@ -16,77 +15,107 @@ (set_body) ] @local.scope -;; Parameters +; Parameters +(parameters + (identifier) @local.definition.parameter) + +(default_parameter + (identifier) @local.definition.parameter) -(parameters (identifier) @local.definition.parameter) -(default_parameter (identifier) @local.definition.parameter) -(typed_parameter (identifier) @local.definition.parameter) -(typed_default_parameter (identifier) @local.definition.parameter) +(typed_parameter + (identifier) @local.definition.parameter) -;; Signals +(typed_default_parameter + (identifier) @local.definition.parameter) +; Signals ; Can gdscript 2 signals be considered fields? -(signal_statement (name) @local.definition.field) +(signal_statement + (name) @local.definition.field) -;; Variable Definitions +; Variable Definitions +(const_statement + (name) @local.definition.constant) -(const_statement (name) @local.definition.constant) ; onready and export variations are only properties. -(variable_statement (name) @local.definition.var) +(variable_statement + (name) @local.definition.var) (setter) @local.reference -(getter) @local.reference - -;; Function Definition -((function_definition (name) @local.definition.function) - (#set! "definition.function.scope" "parent")) +(getter) @local.reference -;; Lambda +; Function Definition +((function_definition + (name) @local.definition.function) + (#set! "definition.function.scope" "parent")) +; Lambda ; lambda names are not accessible and are only for debugging. -(lambda (name) @local.definition.function) +(lambda + (name) @local.definition.function) -;; Source +; Source +(class_name_statement + (name) @local.definition.type) -(class_name_statement (name) @local.definition.type) +(source + (variable_statement + (name) @local.definition.field)) -(source (variable_statement (name) @local.definition.field)) -(source (onready_variable_statement (name) @local.definition.field)) -(source (export_variable_statement (name) @local.definition.field)) +(source + (onready_variable_statement + (name) @local.definition.field)) -;; Class +(source + (export_variable_statement + (name) @local.definition.field)) -((class_definition (name) @local.definition.type) - (#set! "definition.type.scope" "parent")) +; Class +((class_definition + (name) @local.definition.type) + (#set! "definition.type.scope" "parent")) (class_definition - (body (variable_statement (name) @local.definition.field))) + (body + (variable_statement + (name) @local.definition.field))) + (class_definition - (body (onready_variable_statement (name) @local.definition.field))) + (body + (onready_variable_statement + (name) @local.definition.field))) + (class_definition - (body (export_variable_statement (name) @local.definition.field))) + (body + (export_variable_statement + (name) @local.definition.field))) + (class_definition - (body (signal_statement (name) @local.definition.field))) + (body + (signal_statement + (name) @local.definition.field))) ; Although a script is also a class, let's only define functions in an inner class as ; methods. ((class_definition - (body (function_definition (name) @local.definition.method))) - (#set! "definition.method.scope" "parent")) - -;; Enum - -((enum_definition (name) @local.definition.enum)) - -;; Repeat - -(for_statement . (identifier) @local.definition.var) + (body + (function_definition + (name) @local.definition.method))) + (#set! "definition.method.scope" "parent")) -;; Match Statement +; Enum +((enum_definition + (name) @local.definition.enum)) -(pattern_binding (identifier) @local.definition.var) +; Repeat +(for_statement + . + (identifier) @local.definition.var) -;; References +; Match Statement +(pattern_binding + (identifier) @local.definition.var) +; References (identifier) @local.reference diff --git a/queries/git_config/folds.scm b/queries/git_config/folds.scm index e69de29bb..8b1378917 100644 --- a/queries/git_config/folds.scm +++ b/queries/git_config/folds.scm @@ -0,0 +1 @@ + diff --git a/queries/git_config/highlights.scm b/queries/git_config/highlights.scm index df1dde803..ebae70e51 100644 --- a/queries/git_config/highlights.scm +++ b/queries/git_config/highlights.scm @@ -1,26 +1,23 @@ ; Sections - (section_name) @type ((section_name) @keyword.import - (#eq? @keyword.import "include")) + (#eq? @keyword.import "include")) ((section_header - (section_name) @keyword.import - (subsection_name)) - (#eq? @keyword.import "includeIf")) + (section_name) @keyword.import + (subsection_name)) + (#eq? @keyword.import "includeIf")) -(variable (name) @property) +(variable + (name) @property) ; Operators - -[ - "=" -] @operator +"=" @operator ; Literals - (integer) @number + [ (true) (false) @@ -29,10 +26,10 @@ (string) @string ((string) @string.special.path - (#lua-match? @string.special.path "^[.]?[/]")) + (#lua-match? @string.special.path "^[.]?[/]")) ((string) @string.special.path - (#lua-match? @string.special.path "^[~]")) + (#lua-match? @string.special.path "^[~]")) (section_header [ @@ -41,9 +38,10 @@ ] @string.special) ; Punctuation - -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket ; Comments - (comment) @comment @spell diff --git a/queries/git_rebase/highlights.scm b/queries/git_rebase/highlights.scm index 9ace6be26..248366e24 100644 --- a/queries/git_rebase/highlights.scm +++ b/queries/git_rebase/highlights.scm @@ -5,4 +5,3 @@ (option) @operator (comment) @comment - diff --git a/queries/git_rebase/injections.scm b/queries/git_rebase/injections.scm index 8e6815a68..da2628667 100644 --- a/queries/git_rebase/injections.scm +++ b/queries/git_rebase/injections.scm @@ -1,6 +1,5 @@ ((operation - (command) @_command - (message) @injection.content) -(#set! injection.language "bash") -(#any-of? @_command "exec" "x")) - + (command) @_command + (message) @injection.content) + (#set! injection.language "bash") + (#any-of? @_command "exec" "x")) diff --git a/queries/gitattributes/highlights.scm b/queries/gitattributes/highlights.scm index 9f3c03dfb..bc2e02e88 100644 --- a/queries/gitattributes/highlights.scm +++ b/queries/gitattributes/highlights.scm @@ -6,7 +6,10 @@ (range_notation) @string.special (range_notation - [ "[" "]" ] @punctuation.bracket) + [ + "[" + "]" + ] @punctuation.bracket) (wildcard) @character.special @@ -14,7 +17,8 @@ (character_class) @constant -(class_range ("-" @operator)) +(class_range + ("-" @operator)) [ (ansi_c_escape) @@ -48,5 +52,4 @@ ; (redundant_escape) ; (trailing_slash) ; ] @error - (comment) @comment @spell diff --git a/queries/gitattributes/injections.scm b/queries/gitattributes/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/gitattributes/injections.scm +++ b/queries/gitattributes/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/gitattributes/locals.scm b/queries/gitattributes/locals.scm index 43082a43d..2471b8bc6 100644 --- a/queries/gitattributes/locals.scm +++ b/queries/gitattributes/locals.scm @@ -1,4 +1,8 @@ -(macro_def (attr_name) @local.definition.macro) +(macro_def + (attr_name) @local.definition.macro) -(attribute (attr_name) @local.reference) -(attribute (builtin_attr) @local.reference) +(attribute + (attr_name) @local.reference) + +(attribute + (builtin_attr) @local.reference) diff --git a/queries/gitcommit/highlights.scm b/queries/gitcommit/highlights.scm index d475021c2..880d05e01 100644 --- a/queries/gitcommit/highlights.scm +++ b/queries/gitcommit/highlights.scm @@ -1,32 +1,52 @@ (comment) @comment + (generated_comment) @comment + (title) @markup.heading + ; (text) @none (branch) @markup.link + (change) @keyword + (filepath) @string.special.url + (arrow) @punctuation.delimiter (subject) @markup.heading @spell -(subject (overflow) @none @spell) -(subject (subject_prefix) @function @nospell) -(prefix (type) @keyword @nospell) -(prefix (scope) @variable.parameter @nospell) -(prefix [ + +(subject + (overflow) @none @spell) + +(subject + (subject_prefix) @function @nospell) + +(prefix + (type) @keyword @nospell) + +(prefix + (scope) @variable.parameter @nospell) + +(prefix + [ "(" ")" ":" -] @punctuation.delimiter) -(prefix [ - "!" -] @punctuation.special) + ] @punctuation.delimiter) + +(prefix + "!" @punctuation.special) (message) @spell -(trailer (token) @label) +(trailer + (token) @label) + ; (trailer (value) @none) +(breaking_change + (token) @comment.warning) -(breaking_change (token) @comment.warning) -(breaking_change (value) @none @spell) +(breaking_change + (value) @none @spell) (scissor) @comment diff --git a/queries/gitcommit/injections.scm b/queries/gitcommit/injections.scm index 5e56dfa5f..5613d7e8e 100644 --- a/queries/gitcommit/injections.scm +++ b/queries/gitcommit/injections.scm @@ -1,5 +1,5 @@ ((diff) @injection.content - (#set! injection.language "diff")) + (#set! injection.language "diff")) -((rebase_command) @injection.content - (#set! injection.language "git_rebase")) +((rebase_command) @injection.content + (#set! injection.language "git_rebase")) diff --git a/queries/gitignore/highlights.scm b/queries/gitignore/highlights.scm index 6e83ea6f2..10ae3f309 100644 --- a/queries/gitignore/highlights.scm +++ b/queries/gitignore/highlights.scm @@ -19,13 +19,15 @@ (bracket_char_escaped) ] @string.escape -;; bracket expressions +; bracket expressions [ "[" "]" ] @punctuation.bracket (bracket_char) @constant -(bracket_range + +(bracket_range "-" @operator) + (bracket_char_class) @constant.builtin diff --git a/queries/gleam/folds.scm b/queries/gleam/folds.scm index 7c3b16741..b4cd225e7 100644 --- a/queries/gleam/folds.scm +++ b/queries/gleam/folds.scm @@ -1,7 +1,7 @@ ; Folds [ (case) - (function) + (function) (anonymous_function) (type_definition) ] @fold diff --git a/queries/gleam/highlights.scm b/queries/gleam/highlights.scm index f74f17ab7..5c34dde7a 100644 --- a/queries/gleam/highlights.scm +++ b/queries/gleam/highlights.scm @@ -9,14 +9,10 @@ ] @keyword ; Function Keywords -[ - "fn" -] @keyword.function +"fn" @keyword.function ; Imports -[ - "import" -] @keyword.import +"import" @keyword.import ; Conditionals [ @@ -25,9 +21,7 @@ ] @keyword.conditional ; Exceptions -[ - "assert" -] @keyword.exception +"assert" @keyword.exception ; Punctuation [ @@ -48,9 +42,7 @@ "->" ] @punctuation.delimiter -[ - "#" -] @punctuation.special +"#" @punctuation.special ; Operators [ @@ -83,9 +75,7 @@ (identifier) @variable ; Comments -[ - (comment) -] @comment @spell +(comment) @comment @spell [ (module_comment) @@ -100,9 +90,16 @@ ; Modules & Imports (module) @module -(import alias: ((identifier) @module)?) -(remote_type_identifier module: (identifier) @module) -(unqualified_import name: (identifier) @function) + +(import + alias: + ((identifier) @module)?) + +(remote_type_identifier + module: (identifier) @module) + +(unqualified_import + name: (identifier) @function) ; Strings (string) @string @@ -116,15 +113,35 @@ (float) @number.float ; Function Parameter Labels -(function_call arguments: (arguments (argument label: (label) @label))) -(function_parameter label: (label)? @label name: (identifier) @variable.parameter) +(function_call + arguments: + (arguments + (argument + label: (label) @label))) + +(function_parameter + label: (label)? @label + name: (identifier) @variable.parameter) ; Records -(record arguments: (arguments (argument label: (label) @property)?)) -(record_pattern_argument label: (label) @property) -(record_update_argument label: (label) @property) -(field_access record: (identifier) @variable field: (label) @property) -(data_constructor_argument (label) @property) +(record + arguments: + (arguments + (argument + label: (label) @property)?)) + +(record_pattern_argument + label: (label) @property) + +(record_update_argument + label: (label) @property) + +(field_access + record: (identifier) @variable + field: (label) @property) + +(data_constructor_argument + (label) @property) ; Types [ @@ -145,25 +162,44 @@ ] @type.qualifier ; Tuples -(tuple_access index: (integer) @operator) +(tuple_access + index: (integer) @operator) ; Functions -(function name: (identifier) @function) -(function_call function: (identifier) @function.call) -(function_call function: (field_access field: (label) @function.call)) +(function + name: (identifier) @function) + +(function_call + function: (identifier) @function.call) + +(function_call + function: + (field_access + field: (label) @function.call)) ; External Functions -(external_function name: (identifier) @function) -(external_function_body (string) @module . (string) @function) +(external_function + name: (identifier) @function) + +(external_function_body + (string) @module + . + (string) @function) ; Constructors (constructor_name) @type @constructor -([(type_identifier) (constructor_name)] @constant.builtin +([ + (type_identifier) + (constructor_name) +] @constant.builtin (#any-of? @constant.builtin "Ok" "Error")) ; Booleans -((constructor_name) @boolean (#any-of? @boolean "True" "False")) +((constructor_name) @boolean + (#any-of? @boolean "True" "False")) ; Pipe Operator -(binary_expression operator: "|>" right: (identifier) @function) +(binary_expression + operator: "|>" + right: (identifier) @function) diff --git a/queries/gleam/indents.scm b/queries/gleam/indents.scm index 37f88df66..c79854508 100644 --- a/queries/gleam/indents.scm +++ b/queries/gleam/indents.scm @@ -25,4 +25,6 @@ ] @indent.end @indent.branch ; Gleam pipelines are not indented, but other binary expression chains are -((binary_expression operator: _ @_operator) @indent.begin (#not-eq? @_operator "|>")) +((binary_expression + operator: _ @_operator) @indent.begin + (#not-eq? @_operator "|>")) diff --git a/queries/gleam/injections.scm b/queries/gleam/injections.scm index 378240e38..11d4f5d55 100644 --- a/queries/gleam/injections.scm +++ b/queries/gleam/injections.scm @@ -1,7 +1,7 @@ ; Comments ([ (module_comment) - (statement_comment) - (comment) - ] @injection.content - (#set! injection.language "comment")) + (statement_comment) + (comment) +] @injection.content + (#set! injection.language "comment")) diff --git a/queries/gleam/locals.scm b/queries/gleam/locals.scm index 43328ce1b..ba0632c0b 100644 --- a/queries/gleam/locals.scm +++ b/queries/gleam/locals.scm @@ -1,18 +1,25 @@ ; Let Binding Definition -(let pattern: (identifier) @local.definition) +(let + pattern: (identifier) @local.definition) ; List Pattern Definitions -(list_pattern (identifier) @local.definition) -(list_pattern assign: (identifier) @local.definition) +(list_pattern + (identifier) @local.definition) + +(list_pattern + assign: (identifier) @local.definition) ; Tuple Pattern Definition -(tuple_pattern (identifier) @local.definition) +(tuple_pattern + (identifier) @local.definition) ; Record Pattern Definition -(record_pattern_argument pattern: (identifier) @local.definition) +(record_pattern_argument + pattern: (identifier) @local.definition) ; Function Parameter Definition -(function_parameter name: (identifier) @local.definition) +(function_parameter + name: (identifier) @local.definition) ; References (identifier) @local.reference diff --git a/queries/glimmer/folds.scm b/queries/glimmer/folds.scm index cfe9d35b0..6502455d8 100644 --- a/queries/glimmer/folds.scm +++ b/queries/glimmer/folds.scm @@ -1,4 +1,5 @@ [ - (element_node (element_node_start)) - (block_statement) + (element_node + (element_node_start)) + (block_statement) ] @fold diff --git a/queries/glimmer/highlights.scm b/queries/glimmer/highlights.scm index 059a1069c..cfb1af15f 100644 --- a/queries/glimmer/highlights.scm +++ b/queries/glimmer/highlights.scm @@ -1,9 +1,9 @@ ; === Tag Names === - ; Tags that start with a lower case letter are HTML tags ; We'll also use this highlighting for named blocks (which start with `:`) ((tag_name) @tag (#lua-match? @tag "^:?[%l]")) + ; Tags that start with a capital letter are Glimmer components ((tag_name) @constructor (#lua-match? @constructor "^%u")) @@ -11,74 +11,106 @@ (attribute_name) @property (string_literal) @string + (number_literal) @number + (boolean_literal) @boolean (concat_statement) @string ; === Block Statements === - ; Highlight the brackets (block_statement_start) @tag.delimiter + (block_statement_end) @tag.delimiter ; Highlight `if`/`each`/`let` -(block_statement_start path: (identifier) @keyword.conditional) -(block_statement_end path: (identifier) @keyword.conditional) -((mustache_statement (identifier) @keyword.conditional) - (#lua-match? @keyword.conditional "else")) +(block_statement_start + path: (identifier) @keyword.conditional) -; == Mustache Statements === +(block_statement_end + path: (identifier) @keyword.conditional) + +((mustache_statement + (identifier) @keyword.conditional) + (#lua-match? @keyword.conditional "else")) +; == Mustache Statements === ; Highlight the whole statement, to color brackets and separators (mustache_statement) @tag.delimiter ; An identifier in a mustache expression is a variable -((mustache_statement [ - (path_expression (identifier) @variable) - (identifier) @variable +((mustache_statement + [ + (path_expression + (identifier) @variable) + (identifier) @variable ]) (#not-any-of? @variable "yield" "outlet" "this" "else")) + ; As are arguments in a block statement -(block_statement_start argument: [ - (path_expression (identifier) @variable) - (identifier) @variable - ]) +(block_statement_start + argument: + [ + (path_expression + (identifier) @variable) + (identifier) @variable + ]) + ; As is an identifier in a block param -(block_params (identifier) @variable) +(block_params + (identifier) @variable) + ; As are helper arguments -((helper_invocation argument: [ - (path_expression (identifier) @variable) - (identifier) @variable - ]) +((helper_invocation + argument: + [ + (path_expression + (identifier) @variable) + (identifier) @variable + ]) (#not-eq? @variable "this")) + ; `this` should be highlighted as a built-in variable ((identifier) @variable.builtin (#eq? @variable.builtin "this")) ; If the identifier is just "yield" or "outlet", it's a keyword -((mustache_statement (identifier) @keyword) +((mustache_statement + (identifier) @keyword) (#any-of? @keyword "yield" "outlet")) ; Helpers are functions -((helper_invocation helper: [ - (path_expression (identifier) @function) - (identifier) @function - ]) +((helper_invocation + helper: + [ + (path_expression + (identifier) @function) + (identifier) @function + ]) (#not-any-of? @function "if" "yield")) -((helper_invocation helper: (identifier) @keyword.conditional) + +((helper_invocation + helper: (identifier) @keyword.conditional) (#eq? @keyword.conditional "if")) -((helper_invocation helper: (identifier) @keyword) + +((helper_invocation + helper: (identifier) @keyword) (#eq? @keyword "yield")) -(hash_pair key: (identifier) @property) +(hash_pair + key: (identifier) @property) (comment_statement) @comment @spell -(attribute_node "=" @operator) +(attribute_node + "=" @operator) + +(block_params + "as" @keyword) -(block_params "as" @keyword) -(block_params "|" @operator) +(block_params + "|" @operator) [ "<" diff --git a/queries/glimmer/indents.scm b/queries/glimmer/indents.scm index 8bccf33fa..c1ef130c0 100644 --- a/queries/glimmer/indents.scm +++ b/queries/glimmer/indents.scm @@ -1,22 +1,34 @@ [ - (element_node (element_node_start)) + (element_node + (element_node_start)) (element_node_void) - (block_statement (block_statement_start)) + (block_statement + (block_statement_start)) (mustache_statement) ] @indent.begin -(element_node (element_node_end [">"] @indent.end)) -(element_node_void "/>" @indent.end) +(element_node + (element_node_end + ">" @indent.end)) + +(element_node_void + "/>" @indent.end) + [ - ">" - "/>" - "</" - "{{/" - "}}" + ">" + "/>" + "</" + "{{/" + "}}" ] @indent.branch (mustache_statement - (helper_invocation helper: (identifier) @_identifier (#eq? @_identifier "else")) - ) @indent.branch -(mustache_statement ((identifier) @_identifier (#eq? @_identifier "else"))) @indent.branch + (helper_invocation + helper: (identifier) @_identifier + (#eq? @_identifier "else"))) @indent.branch + +(mustache_statement + ((identifier) @_identifier + (#eq? @_identifier "else"))) @indent.branch + (comment_statement) @indent.ignore diff --git a/queries/glimmer/locals.scm b/queries/glimmer/locals.scm index 705382aa9..8fde3a297 100644 --- a/queries/glimmer/locals.scm +++ b/queries/glimmer/locals.scm @@ -1,7 +1,9 @@ [ - (element_node) - (block_statement) + (element_node) + (block_statement) ] @local.scope (identifier) @local.reference -(block_params (identifier) @local.definition.var) + +(block_params + (identifier) @local.definition.var) diff --git a/queries/glsl/highlights.scm b/queries/glsl/highlights.scm index 5825673c1..dbf3ed07b 100644 --- a/queries/glsl/highlights.scm +++ b/queries/glsl/highlights.scm @@ -1,5 +1,4 @@ ; inherits: c - [ "in" "out" @@ -32,4 +31,4 @@ (extension_storage_class) @keyword.storage ((identifier) @variable.builtin - (#lua-match? @variable.builtin "^gl_")) + (#lua-match? @variable.builtin "^gl_")) diff --git a/queries/glsl/injections.scm b/queries/glsl/injections.scm index 57b24fed5..90ca7b5d4 100644 --- a/queries/glsl/injections.scm +++ b/queries/glsl/injections.scm @@ -1,5 +1,5 @@ ((preproc_arg) @injection.content - (#set! injection.language "glsl")) + (#set! injection.language "glsl")) -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/gn/highlights.scm b/queries/gn/highlights.scm index 3b09a7753..7bd97ff38 100644 --- a/queries/gn/highlights.scm +++ b/queries/gn/highlights.scm @@ -1,20 +1,16 @@ ; Includes - "import" @keyword.import ; Conditionals - [ "if" "else" ] @keyword.conditional ; Repeats - "foreach" @keyword.repeat ; Operators - [ "=" "+=" @@ -33,19 +29,17 @@ ] @operator ; Variables - (identifier) @variable ; Functions - -(call_expression function: (identifier) @function.call) +(call_expression + function: (identifier) @function.call) ; Fields - -(scope_access field: (identifier) @variable.member) +(scope_access + field: (identifier) @variable.member) ; Literals - (string) @string (escape_sequence) @string.escape @@ -59,16 +53,26 @@ (boolean) @boolean ; Punctuation - -[ "{" "}" "[" "]" "(" ")" ] @punctuation.bracket +[ + "{" + "}" + "[" + "]" + "(" + ")" +] @punctuation.bracket [ "." "," ] @punctuation.delimiter -(expansion ["$" "${" "}"] @punctuation.special) +(expansion + [ + "$" + "${" + "}" + ] @punctuation.special) ; Comments - (comment) @comment diff --git a/queries/go/folds.scm b/queries/go/folds.scm index 2c0beb4f6..44b452de5 100644 --- a/queries/go/folds.scm +++ b/queries/go/folds.scm @@ -1,20 +1,19 @@ [ - (const_declaration) - (expression_switch_statement) - (expression_case) - (default_case) - (type_switch_statement) - (type_case) - (for_statement) - (func_literal) - (function_declaration) - (if_statement) - (import_declaration) - (method_declaration) - (type_declaration) - (var_declaration) - (composite_literal) - (literal_element) - (block) + (const_declaration) + (expression_switch_statement) + (expression_case) + (default_case) + (type_switch_statement) + (type_case) + (for_statement) + (func_literal) + (function_declaration) + (if_statement) + (import_declaration) + (method_declaration) + (type_declaration) + (var_declaration) + (composite_literal) + (literal_element) + (block) ] @fold - diff --git a/queries/go/highlights.scm b/queries/go/highlights.scm index 9c6fe1be8..d23ac6f73 100644 --- a/queries/go/highlights.scm +++ b/queries/go/highlights.scm @@ -1,17 +1,23 @@ -;; Forked from tree-sitter-go -;; Copyright (c) 2014 Max Brunsfeld (The MIT License) - -;; +; Forked from tree-sitter-go +; Copyright (c) 2014 Max Brunsfeld (The MIT License) +; ; Identifiers - (type_identifier) @type -(type_spec name: (type_identifier) @type.definition) + +(type_spec + name: (type_identifier) @type.definition) + (field_identifier) @property + (identifier) @variable + (package_identifier) @module -(parameter_declaration (identifier) @variable.parameter) -(variadic_parameter_declaration (identifier) @variable.parameter) +(parameter_declaration + (identifier) @variable.parameter) + +(variadic_parameter_declaration + (identifier) @variable.parameter) (label_name) @label @@ -19,16 +25,15 @@ name: (identifier) @constant) ; Function calls - (call_expression function: (identifier) @function.call) (call_expression - function: (selector_expression - field: (field_identifier) @function.method.call)) + function: + (selector_expression + field: (field_identifier) @function.method.call)) ; Function definitions - (function_declaration name: (identifier) @function) @@ -39,15 +44,15 @@ name: (field_identifier) @function.method) ; Constructors - -((call_expression (identifier) @constructor) +((call_expression + (identifier) @constructor) (#lua-match? @constructor "^[nN]ew.+$")) -((call_expression (identifier) @constructor) +((call_expression + (identifier) @constructor) (#lua-match? @constructor "^[mM]ake.+$")) ; Operators - [ "--" "-" @@ -91,7 +96,6 @@ ] @operator ; Keywords - [ "break" "const" @@ -109,7 +113,9 @@ ] @keyword "func" @keyword.function + "return" @keyword.return + "go" @keyword.coroutine "for" @keyword.repeat @@ -124,128 +130,103 @@ "case" "switch" "if" - ] @keyword.conditional - - -;; Builtin types +] @keyword.conditional -[ "chan" "map" ] @type.builtin +; Builtin types +[ + "chan" + "map" +] @type.builtin ((type_identifier) @type.builtin - (#any-of? @type.builtin - "any" - "bool" - "byte" - "comparable" - "complex128" - "complex64" - "error" - "float32" - "float64" - "int" - "int16" - "int32" - "int64" - "int8" - "rune" - "string" - "uint" - "uint16" - "uint32" - "uint64" - "uint8" - "uintptr")) - - -;; Builtin functions + (#any-of? @type.builtin "any" "bool" "byte" "comparable" "complex128" "complex64" "error" "float32" "float64" "int" "int16" "int32" "int64" "int8" "rune" "string" "uint" "uint16" "uint32" "uint64" "uint8" "uintptr")) +; Builtin functions ((identifier) @function.builtin - (#any-of? @function.builtin - "append" - "cap" - "clear" - "close" - "complex" - "copy" - "delete" - "imag" - "len" - "make" - "max" - "min" - "new" - "panic" - "print" - "println" - "real" - "recover")) - + (#any-of? @function.builtin "append" "cap" "clear" "close" "complex" "copy" "delete" "imag" "len" "make" "max" "min" "new" "panic" "print" "println" "real" "recover")) ; Delimiters - "." @punctuation.delimiter + "," @punctuation.delimiter + ":" @punctuation.delimiter + ";" @punctuation.delimiter "(" @punctuation.bracket + ")" @punctuation.bracket + "{" @punctuation.bracket + "}" @punctuation.bracket + "[" @punctuation.bracket -"]" @punctuation.bracket +"]" @punctuation.bracket ; Literals - (interpreted_string_literal) @string + (raw_string_literal) @string + (rune_literal) @string + (escape_sequence) @string.escape (int_literal) @number + (float_literal) @number.float + (imaginary_literal) @number [ - (true) - (false) + (true) + (false) ] @boolean [ - (nil) - (iota) + (nil) + (iota) ] @constant.builtin (keyed_element - . (literal_element (identifier) @variable.member)) -(field_declaration name: (field_identifier) @variable.member) + . + (literal_element + (identifier) @variable.member)) -; Comments +(field_declaration + name: (field_identifier) @variable.member) +; Comments (comment) @comment @spell -;; Doc Comments - -(source_file . (comment)+ @comment.documentation) +; Doc Comments +(source_file + . + (comment)+ @comment.documentation) (source_file (comment)+ @comment.documentation - . (const_declaration)) + . + (const_declaration)) (source_file (comment)+ @comment.documentation - . (function_declaration)) + . + (function_declaration)) (source_file (comment)+ @comment.documentation - . (type_declaration)) + . + (type_declaration)) (source_file (comment)+ @comment.documentation - . (var_declaration)) + . + (var_declaration)) ; Spell - ((interpreted_string_literal) @spell (#not-has-parent? @spell import_spec)) diff --git a/queries/go/indents.scm b/queries/go/indents.scm index 5f0039ac4..b26811c83 100644 --- a/queries/go/indents.scm +++ b/queries/go/indents.scm @@ -15,19 +15,23 @@ (struct_type) ] @indent.begin -[ - "}" -] @indent.branch +"}" @indent.branch + +(const_declaration + ")" @indent.branch) -(const_declaration ")" @indent.branch) -(import_spec_list ")" @indent.branch) -(var_declaration ")" @indent.branch) +(import_spec_list + ")" @indent.branch) + +(var_declaration + ")" @indent.branch) [ - "}" - ")" + "}" + ")" ] @indent.end -(parameter_list ")" @indent.branch) +(parameter_list + ")" @indent.branch) (comment) @indent.ignore diff --git a/queries/go/injections.scm b/queries/go/injections.scm index cf19ebac5..7d9166e33 100644 --- a/queries/go/injections.scm +++ b/queries/go/injections.scm @@ -1,38 +1,41 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) (call_expression - (selector_expression) @_function (#any-of? @_function - "regexp.Match" - "regexp.MatchReader" - "regexp.MatchString" - "regexp.Compile" - "regexp.CompilePOSIX" - "regexp.MustCompile" - "regexp.MustCompilePOSIX") + (selector_expression) @_function + (#any-of? @_function "regexp.Match" "regexp.MatchReader" "regexp.MatchString" "regexp.Compile" "regexp.CompilePOSIX" "regexp.MustCompile" "regexp.MustCompilePOSIX") (argument_list . [ - (raw_string_literal) - (interpreted_string_literal) + (raw_string_literal) + (interpreted_string_literal) ] @injection.content (#offset! @injection.content 0 1 0 -1) (#set! injection.language "regex"))) - ((comment) @injection.content (#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c") (#set! injection.language "re2c")) ((call_expression - function: (selector_expression field: (field_identifier) @_method) - arguments: (argument_list . (interpreted_string_literal) @injection.content)) - (#any-of? @_method "Printf" "Sprintf" "Fatalf" "Scanf") - (#set! injection.language "printf")) + function: + (selector_expression + field: (field_identifier) @_method) + arguments: + (argument_list + . + (interpreted_string_literal) @injection.content)) + (#any-of? @_method "Printf" "Sprintf" "Fatalf" "Scanf") + (#set! injection.language "printf")) ((call_expression - function: (selector_expression field: (field_identifier) @_method) - arguments: (argument_list (_) . (interpreted_string_literal) @injection.content)) - (#eq? @_method "Fprintf") - (#set! injection.language "printf")) - + function: + (selector_expression + field: (field_identifier) @_method) + arguments: + (argument_list + (_) + . + (interpreted_string_literal) @injection.content)) + (#eq? @_method "Fprintf") + (#set! injection.language "printf")) diff --git a/queries/go/locals.scm b/queries/go/locals.scm index 20d8cd618..a8325f97c 100644 --- a/queries/go/locals.scm +++ b/queries/go/locals.scm @@ -1,79 +1,93 @@ -( - (function_declaration - name: (identifier) @local.definition.function) ; @function -) +((function_declaration + name: (identifier) @local.definition.function) ; @function + ) -( - (method_declaration - name: (field_identifier) @local.definition.method) ; @function.method -) +((method_declaration + name: (field_identifier) @local.definition.method) ; @function.method + ) -(short_var_declaration - left: (expression_list - (identifier) @local.definition.var)) +(short_var_declaration + left: + (expression_list + (identifier) @local.definition.var)) -(var_spec +(var_spec name: (identifier) @local.definition.var) -(parameter_declaration (identifier) @local.definition.var) -(variadic_parameter_declaration (identifier) @local.definition.var) +(parameter_declaration + (identifier) @local.definition.var) + +(variadic_parameter_declaration + (identifier) @local.definition.var) (for_statement - (range_clause - left: (expression_list - (identifier) @local.definition.var))) + (range_clause + left: + (expression_list + (identifier) @local.definition.var))) (const_declaration - (const_spec - name: (identifier) @local.definition.var)) + (const_spec + name: (identifier) @local.definition.var)) -(type_declaration +(type_declaration (type_spec name: (type_identifier) @local.definition.type)) -;; reference +; reference (identifier) @local.reference + (type_identifier) @local.reference + (field_identifier) @local.reference + ((package_identifier) @local.reference (#set! reference.kind "namespace")) (package_clause - (package_identifier) @local.definition.namespace) + (package_identifier) @local.definition.namespace) (import_spec_list (import_spec name: (package_identifier) @local.definition.namespace)) -;; Call references +; Call references ((call_expression - function: (identifier) @local.reference) - (#set! reference.kind "call" )) + function: (identifier) @local.reference) + (#set! reference.kind "call")) ((call_expression - function: (selector_expression - field: (field_identifier) @local.reference)) - (#set! reference.kind "call" )) - + function: + (selector_expression + field: (field_identifier) @local.reference)) + (#set! reference.kind "call")) ((call_expression - function: (parenthesized_expression - (identifier) @local.reference)) - (#set! reference.kind "call" )) + function: + (parenthesized_expression + (identifier) @local.reference)) + (#set! reference.kind "call")) ((call_expression - function: (parenthesized_expression - (selector_expression - field: (field_identifier) @local.reference))) - (#set! reference.kind "call" )) - -;; Scopes + function: + (parenthesized_expression + (selector_expression + field: (field_identifier) @local.reference))) + (#set! reference.kind "call")) +; Scopes (func_literal) @local.scope + (source_file) @local.scope + (function_declaration) @local.scope + (if_statement) @local.scope + (block) @local.scope + (expression_switch_statement) @local.scope + (for_statement) @local.scope + (method_declaration) @local.scope diff --git a/queries/godot_resource/folds.scm b/queries/godot_resource/folds.scm index 943e0628f..911798f5a 100644 --- a/queries/godot_resource/folds.scm +++ b/queries/godot_resource/folds.scm @@ -1,3 +1 @@ -[ - (section) -] @fold +(section) @fold diff --git a/queries/godot_resource/highlights.scm b/queries/godot_resource/highlights.scm index f87f228d9..fbe297839 100644 --- a/queries/godot_resource/highlights.scm +++ b/queries/godot_resource/highlights.scm @@ -1,14 +1,22 @@ (identifier) @type.builtin -(attribute (identifier) @property) -(property (path) @property) -(constructor (identifier) @constructor) +(attribute + (identifier) @property) + +(property + (path) @property) + +(constructor + (identifier) @constructor) (string) @string + (integer) @number + (float) @number.float (true) @constant.builtin + (false) @constant.builtin [ diff --git a/queries/godot_resource/locals.scm b/queries/godot_resource/locals.scm index 53982b713..b946a5eec 100644 --- a/queries/godot_resource/locals.scm +++ b/queries/godot_resource/locals.scm @@ -1,3 +1 @@ -[ - (section) -] @local.scope +(section) @local.scope diff --git a/queries/gomod/highlights.scm b/queries/gomod/highlights.scm index 8e3906fc1..29cbe6574 100644 --- a/queries/gomod/highlights.scm +++ b/queries/gomod/highlights.scm @@ -11,9 +11,10 @@ "=>" @operator (comment) @comment @spell + (module_path) @string.special.url [ -(version) -(go_version) + (version) + (go_version) ] @string diff --git a/queries/gomod/injections.scm b/queries/gomod/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/gomod/injections.scm +++ b/queries/gomod/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/gosum/highlights.scm b/queries/gosum/highlights.scm index bd9595b2b..f20c5f176 100644 --- a/queries/gosum/highlights.scm +++ b/queries/gosum/highlights.scm @@ -7,17 +7,18 @@ "+incompatible" ] @keyword - (module_path) @string.special.url + (module_version) @string.special (hash_version) @attribute + (hash) @string.special.symbol [ - (number) - (number_with_decimal) - (hex_number) + (number) + (number_with_decimal) + (hex_number) ] @number (checksum diff --git a/queries/gowork/highlights.scm b/queries/gowork/highlights.scm index 0584f1a68..bca9a5f80 100644 --- a/queries/gowork/highlights.scm +++ b/queries/gowork/highlights.scm @@ -9,6 +9,6 @@ (comment) @comment @spell [ -(version) -(go_version) + (version) + (go_version) ] @string diff --git a/queries/gowork/injections.scm b/queries/gowork/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/gowork/injections.scm +++ b/queries/gowork/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/gpg/highlights.scm b/queries/gpg/highlights.scm index 1dac05562..09656b302 100644 --- a/queries/gpg/highlights.scm +++ b/queries/gpg/highlights.scm @@ -1,14 +1,17 @@ -(option . _ @keyword) +(option + . + _ @keyword) (option ("no-" @variable.parameter)? (name) @variable.parameter) -(string (content) @string) +(string + (content) @string) [ - (value) - "clear" + (value) + "clear" ] @string.special (url) @string.special.url @@ -16,9 +19,9 @@ (key) @constant [ - (number) - (expire_time) - (iso_time) + (number) + (expire_time) + (iso_time) ] @number (format) @character.special @@ -34,14 +37,18 @@ (filter_value) @string [ - (filter_op0) - (filter_op1) - (filter_lc) - "=" + (filter_op0) + (filter_op1) + (filter_lc) + "=" ] @operator "!" @punctuation.special -[ "\"" "'" "," ] @punctuation.delimiter +[ + "\"" + "'" + "," +] @punctuation.delimiter (comment) @comment @spell diff --git a/queries/gpg/injections.scm b/queries/gpg/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/gpg/injections.scm +++ b/queries/gpg/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/graphql/highlights.scm b/queries/graphql/highlights.scm index 136f287ee..24db06645 100644 --- a/queries/graphql/highlights.scm +++ b/queries/graphql/highlights.scm @@ -1,6 +1,5 @@ ; Types ;------ - (scalar_type_definition (name) @type) @@ -42,7 +41,6 @@ ; Directives ;----------- - (directive_definition "@" @attribute (name) @attribute) @@ -51,7 +49,6 @@ ; Properties ;----------- - (field (name) @property) @@ -69,9 +66,8 @@ (enum_value (name) @property) -; Variable Definitions and Arguments +; Variable Definitions and Arguments ;----------------------------------- - (operation_definition (name) @variable) @@ -98,7 +94,6 @@ ; Constants ;---------- - (string_value) @string (int_value) @number @@ -109,7 +104,6 @@ ; Literals ;--------- - (description (string_value) @string.documentation @spell) @@ -123,7 +117,6 @@ ; Keywords ;---------- - [ "query" "mutation" @@ -145,21 +138,23 @@ ; Punctuation ;------------ - [ - "(" - ")" - "[" - "]" - "{" - "}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket "=" @operator "|" @punctuation.delimiter + "&" @punctuation.delimiter + ":" @punctuation.delimiter "..." @punctuation.special + "!" @punctuation.special diff --git a/queries/graphql/injections.scm b/queries/graphql/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/graphql/injections.scm +++ b/queries/graphql/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/groovy/highlights.scm b/queries/groovy/highlights.scm index 25dcdb8ca..4306f17a3 100644 --- a/queries/groovy/highlights.scm +++ b/queries/groovy/highlights.scm @@ -1,5 +1,6 @@ (unit (identifier) @variable) + (string (identifier) @variable) @@ -24,52 +25,19 @@ (#eq? @constant.builtin "null")) ((identifier) @type - (#any-of? @type - "String" - "Map" - "Object" - "Boolean" - "Integer" - "List")) + (#any-of? @type "String" "Map" "Object" "Boolean" "Integer" "List")) ((identifier) @function.builtin - (#any-of? @function.builtin - "void" - "id" - "version" - "apply" - "implementation" - "testImplementation" - "androidTestImplementation" - "debugImplementation")) + (#any-of? @function.builtin "void" "id" "version" "apply" "implementation" "testImplementation" "androidTestImplementation" "debugImplementation")) ((identifier) @keyword - (#any-of? @keyword - "static" - "class" - "def" - "import" - "package" - "assert" - "extends" - "implements" - "instanceof" - "interface" - "new")) + (#any-of? @keyword "static" "class" "def" "import" "package" "assert" "extends" "implements" "instanceof" "interface" "new")) ((identifier) @type.qualifier - (#any-of? @type.qualifier - "abstract" - "protected" - "private" - "public")) + (#any-of? @type.qualifier "abstract" "protected" "private" "public")) ((identifier) @keyword.exception - (#any-of? @keyword.exception - "throw" - "finally" - "try" - "catch")) + (#any-of? @keyword.exception "throw" "finally" "try" "catch")) (string) @string @@ -92,4 +60,11 @@ (leading_key) ] @operator -["(" ")" "[" "]" "{" "}"] @punctuation.bracket +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket diff --git a/queries/groovy/injections.scm b/queries/groovy/injections.scm index 0f3127b6b..14a5d393e 100644 --- a/queries/groovy/injections.scm +++ b/queries/groovy/injections.scm @@ -1,5 +1,5 @@ -((line_comment) @injection.content - (#set! injection.language "comment")) - ((block_comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) + +((line_comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/gstlaunch/highlights.scm b/queries/gstlaunch/highlights.scm index 36118712e..90729f876 100644 --- a/queries/gstlaunch/highlights.scm +++ b/queries/gstlaunch/highlights.scm @@ -1,30 +1,35 @@ [ - "!" - "=" + "!" + "=" ] @operator [ - "," - "." - ";" - "/" + "," + "." + ";" + "/" ] @punctuation.delimiter [ - "(" - ")" + "(" + ")" ] @punctuation.bracket (property key: (identifier) @variable.member) + (value) @string + (string_literal) @string + (cap . (identifier) @string . (identifier) @string) + (simple_element type: (_) @type) + (bin type: (_) @type) diff --git a/queries/hack/highlights.scm b/queries/hack/highlights.scm index 91efe90b4..22fa7ea50 100644 --- a/queries/hack/highlights.scm +++ b/queries/hack/highlights.scm @@ -1,13 +1,15 @@ (variable) @variable + (identifier) @variable + ((variable) @variable.builtin - (#eq? @variable.builtin "$this")) + (#eq? @variable.builtin "$this")) (braced_expression) @none (scoped_identifier - (qualified_identifier - (identifier) @type)) + (qualified_identifier + (identifier) @type)) [ (comment) @@ -20,16 +22,16 @@ "function" @keyword.function [ - "type" - "interface" - "implements" - "class" - "using" - "namespace" - "attribute" - "const" - "extends" - "insteadof" + "type" + "interface" + "implements" + "class" + "using" + "namespace" + "attribute" + "const" + "extends" + "insteadof" ] @keyword [ @@ -38,11 +40,11 @@ ] @keyword.coroutine [ - "use" - "include" - "include_once" - "require" - "require_once" + "use" + "include" + "include_once" + "require" + "require_once" ] @keyword.import [ @@ -80,9 +82,7 @@ "noreturn" ] @type.builtin -[ - (null) -] @constant.builtin +(null) @constant.builtin [ (true) @@ -90,14 +90,23 @@ ] @boolean (type_specifier) @type + (new_expression (_) @type) -(alias_declaration "newtype" . (_) @type) -(alias_declaration "type" . (_) @type) +(alias_declaration + "newtype" + . + (_) @type) + +(alias_declaration + "type" + . + (_) @type) (class_declaration name: (identifier) @type) + (type_parameter name: (identifier) @type) @@ -106,8 +115,8 @@ (identifier) @type .)) [ - "@required" - "@lateinit" + "@required" + "@lateinit" (attribute_modifier) ] @attribute @@ -126,7 +135,6 @@ "/=" "%=" "**=" - "==>" "|>" "??" @@ -154,13 +162,10 @@ "/" "%" "**" - "++" "--" "!" - "?:" - "=" "??=" ".=" @@ -176,110 +181,156 @@ "%=" "**=" "=>" - - ;; type modifiers + ; type modifiers "@" "?" "~" ] @operator (integer) @number + (float) @number.float (parameter (variable) @variable.parameter) (call_expression - function: (qualified_identifier (identifier) @function.call .)) + function: + (qualified_identifier + (identifier) @function.call .)) (call_expression - function: (scoped_identifier (identifier) @function.call .)) + function: + (scoped_identifier + (identifier) @function.call .)) (call_expression - function: (selection_expression - (qualified_identifier (identifier) @function.method.call .))) + function: + (selection_expression + (qualified_identifier + (identifier) @function.method.call .))) (qualified_identifier - (_) @module . + (_) @module + . (_)) (use_statement (qualified_identifier - (_) @module .) + (_) @module .) (use_clause)) (use_statement - (use_type "namespace") + (use_type + "namespace") (use_clause (qualified_identifier - (identifier) @module .) + (identifier) @module .) alias: (identifier)? @module)) (use_statement - (use_type "const") + (use_type + "const") (use_clause (qualified_identifier - (identifier) @constant .) + (identifier) @constant .) alias: (identifier)? @constant)) (use_statement - (use_type "function") + (use_type + "function") (use_clause (qualified_identifier - (identifier) @function .) + (identifier) @function .) alias: (identifier)? @function)) (use_statement - (use_type "type") + (use_type + "type") (use_clause (qualified_identifier - (identifier) @type .) + (identifier) @type .) alias: (identifier)? @type)) (use_clause - (use_type "namespace") + (use_type + "namespace") (qualified_identifier - (_) @module .) + (_) @module .) alias: (identifier)? @module) (use_clause - (use_type "function") + (use_type + "function") (qualified_identifier - (_) @function .) + (_) @function .) alias: (identifier)? @function) (use_clause - (use_type "const") + (use_type + "const") (qualified_identifier - (_) @constant .) + (_) @constant .) alias: (identifier)? @constant) (use_clause - (use_type "type") + (use_type + "type") (qualified_identifier - (_) @type .) + (_) @type .) alias: (identifier)? @type) (function_declaration name: (identifier) @function) + (method_declaration name: (identifier) @function.method) (type_arguments - [ "<" ">" ] @punctuation.bracket) -[ "(" ")" "[" "]" "{" "}" "<<" ">>"] @punctuation.bracket + [ + "<" + ">" + ] @punctuation.bracket) + +[ + "(" + ")" + "[" + "]" + "{" + "}" + "<<" + ">>" +] @punctuation.bracket (xhp_open - [ "<" ">" ] @tag.delimiter) + [ + "<" + ">" + ] @tag.delimiter) + (xhp_close - [ "</" ">" ] @tag.delimiter) + [ + "</" + ">" + ] @tag.delimiter) + +[ + "." + ";" + "::" + ":" + "," +] @punctuation.delimiter -[ "." ";" "::" ":" "," ] @punctuation.delimiter (qualified_identifier "\\" @punctuation.delimiter) (ternary_expression - ["?" ":"] @keyword.conditional.ternary) + [ + "?" + ":" + ] @keyword.conditional.ternary) [ "if" @@ -305,11 +356,11 @@ ] @keyword.repeat [ - (string) - (xhp_string) + (string) + (xhp_string) ] @string [ - (xhp_open) - (xhp_close) + (xhp_open) + (xhp_close) ] @tag diff --git a/queries/hare/folds.scm b/queries/hare/folds.scm index 28f18b175..58b10bfdc 100644 --- a/queries/hare/folds.scm +++ b/queries/hare/folds.scm @@ -1,12 +1,10 @@ [ (imports) - (function_declaration) (enum_type) (struct_type) (tuple_type) (union_type) - (block) (if_statement) (for_statement) @@ -14,7 +12,6 @@ (switch_expression) (match_expression) (case) - (array_literal) (struct_literal) (tuple_literal) diff --git a/queries/hare/highlights.scm b/queries/hare/highlights.scm index fb9f3f158..817084886 100644 --- a/queries/hare/highlights.scm +++ b/queries/hare/highlights.scm @@ -1,44 +1,44 @@ ; Variables - (identifier) @variable ; Types - (type) @type (scoped_type_identifier - (identifier) . (identifier) @type) + (identifier) + . + (identifier) @type) (struct_literal - . (identifier) @type) + . + (identifier) @type) (builtin_type) @type.builtin ; Constants - ((identifier) @constant (#lua-match? @constant "^[A-Z_]+$")) ; Includes - -[ - "use" -] @keyword.import +"use" @keyword.import (use_statement (scoped_type_identifier (identifier) @module)) + (use_statement - (identifier) @module "{") + (identifier) @module + "{") + (use_statement - . (identifier) @module .) + . + (identifier) @module .) ((scoped_type_identifier path: (_) @module) (#set! "priority" 105)) ; Keywords - [ "def" "enum" @@ -49,9 +49,7 @@ "union" ] @keyword -[ - "fn" -] @keyword.function +"fn" @keyword.function [ "defer" @@ -65,12 +63,13 @@ ] @keyword.operator ; Typedefs - (type_declaration - "type" (identifier) @type.definition . "=") + "type" + (identifier) @type.definition + . + "=") ; Qualifiers - [ "const" "static" @@ -78,7 +77,6 @@ ] @type.qualifier ; Attributes - [ "@fini" "@init" @@ -89,62 +87,72 @@ ] @attribute ; Labels - ((label) @label (#set! "priority" 105)) ; Functions - (function_declaration - "fn" . (identifier) @function) + "fn" + . + (identifier) @function) (call_expression - . (identifier) @function.call) + . + (identifier) @function.call) (call_expression - . (scoped_type_identifier - . (identifier) . "::" . (identifier) @function.method.call)) + . + (scoped_type_identifier + . + (identifier) + . + "::" + . + (identifier) @function.method.call)) ((call_expression - . (identifier) @function.builtin) + . + (identifier) @function.builtin) (#any-of? @function.builtin "align" "assert" "free" "len" "offset" "size")) (size_expression "size" @function.builtin) ((function_declaration - "fn" . (identifier) @constructor) + "fn" + . + (identifier) @constructor) (#eq? @constructor "init")) ((call_expression - . (identifier) @constructor) + . + (identifier) @constructor) (#eq? @constructor "init")) ; Parameters - (parameter - (_) @variable.parameter . ":") + (_) @variable.parameter + . + ":") ; Fields - ((member_expression - "." (_) @variable.member) + "." + (_) @variable.member) (#set! "priority" 105)) (field - . (identifier) @variable.member) + . + (identifier) @variable.member) (field_assignment - . (identifier) @variable.member) + . + (identifier) @variable.member) ; Repeats - -[ - "for" -] @keyword.repeat +"for" @keyword.repeat ; Conditionals - [ "if" "else" @@ -155,7 +163,6 @@ ] @keyword.conditional ; Operators - [ "+" "-" @@ -196,12 +203,20 @@ ] @operator ; Punctuation +[ + "{" + "}" +] @punctuation.bracket -[ "{" "}" ] @punctuation.bracket - -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket [ ".." @@ -209,11 +224,14 @@ "_" ] @punctuation.special -(pointer_type "*" @punctuation.special) +(pointer_type + "*" @punctuation.special) -(slice_type "*" @punctuation.special) +(slice_type + "*" @punctuation.special) -(error_type "!" @punctuation.special) +(error_type + "!" @punctuation.special) [ "," @@ -225,7 +243,6 @@ ] @punctuation.delimiter ; Literals - [ (string) (raw_string) @@ -247,5 +264,4 @@ ] @constant.builtin ; Comments - (comment) @comment @spell diff --git a/queries/hare/indents.scm b/queries/hare/indents.scm index b3aadcd6e..d729663e1 100644 --- a/queries/hare/indents.scm +++ b/queries/hare/indents.scm @@ -3,19 +3,18 @@ (struct_type) (tuple_type) (union_type) - (block) (for_statement) (call_expression) (case) - (array_literal) (struct_literal) (tuple_literal) ] @indent.begin (if_statement - ("(" condition: (_) ")") @indent.begin) + ("(" + condition: (_)")") @indent.begin) [ "}" @@ -23,11 +22,20 @@ ")" ] @indent.end -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch [ (ERROR) diff --git a/queries/hare/injections.scm b/queries/hare/injections.scm index d3befb39b..88a3f1cdd 100644 --- a/queries/hare/injections.scm +++ b/queries/hare/injections.scm @@ -1,10 +1,18 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((call_expression - . (_) @_fnname - . "(" - . (_ [(string_content) (raw_string_content)] @injection.content) - . ")") + . + (_) @_fnname + . + "(" + . + (_ + [ + (string_content) + (raw_string_content) + ] @injection.content) + . + ")") (#any-of? @_fnname "compile" "regex::compile") (#set! injection.language "regex")) diff --git a/queries/hare/locals.scm b/queries/hare/locals.scm index bf606b9b1..b81ee5135 100644 --- a/queries/hare/locals.scm +++ b/queries/hare/locals.scm @@ -1,5 +1,4 @@ ; Scopes - [ (module) (function_declaration) @@ -10,38 +9,57 @@ ] @local.scope ; References - [ (identifier) (scoped_type_identifier) ] @local.reference ; Definitions - (global_binding - (identifier) @local.definition.constant . ":" (_)) + (identifier) @local.definition.constant + . + ":" + (_)) (const_declaration - "const" (identifier) @local.definition.constant . "=") + "const" + (identifier) @local.definition.constant + . + "=") (field - . (identifier) @local.definition.field) + . + (identifier) @local.definition.field) (field_assignment - . (identifier) @local.definition.field) + . + (identifier) @local.definition.field) (function_declaration - "fn" . (identifier) @local.definition.function) + "fn" + . + (identifier) @local.definition.function) (parameter - (_) @local.definition.parameter . ":") + (_) @local.definition.parameter + . + ":") (type_declaration - "type" (identifier) @local.definition.type . "=") + "type" + (identifier) @local.definition.type + . + "=") (type_declaration - "type" (identifier) @local.definition.enum . "=" (enum_type)) + "type" + (identifier) @local.definition.enum + . + "=" + (enum_type)) (let_declaration - "let" . (identifier) @local.definition.variable ","?) - + "let" + . + (identifier) @local.definition.variable + ","?) diff --git a/queries/haskell/folds.scm b/queries/haskell/folds.scm index 28eadf8f3..a1af2a169 100644 --- a/queries/haskell/folds.scm +++ b/queries/haskell/folds.scm @@ -1,5 +1,5 @@ [ - (exp_apply) - (exp_do) - (function) + (exp_apply) + (exp_do) + (function) ] @fold diff --git a/queries/haskell/highlights.scm b/queries/haskell/highlights.scm index 92b36434d..1a3cfd485 100644 --- a/queries/haskell/highlights.scm +++ b/queries/haskell/highlights.scm @@ -1,34 +1,44 @@ -;; ---------------------------------------------------------------------------- -;; Parameters and variables - -;; NOTE: These are at the top, so that they have low priority, -;; and don't override destructured parameters - +; ---------------------------------------------------------------------------- +; Parameters and variables +; NOTE: These are at the top, so that they have low priority, +; and don't override destructured parameters (variable) @variable + (pat_wildcard) @variable (function - patterns: (patterns (_) @variable.parameter)) + patterns: + (patterns + (_) @variable.parameter)) -(exp_lambda (_)+ @variable.parameter "->") +(exp_lambda + (_)+ @variable.parameter + "->") -(function - infix: (infix - lhs: (_) @variable.parameter)) -(function - infix: (infix - rhs: (_) @variable.parameter)) +(function + infix: + (infix + lhs: (_) @variable.parameter)) -;; ---------------------------------------------------------------------------- -;; Literals and comments +(function + infix: + (infix + rhs: (_) @variable.parameter)) +; ---------------------------------------------------------------------------- +; Literals and comments (integer) @number + (exp_negation) @number -(exp_literal (float)) @number.float + +(exp_literal + (float)) @number.float + (char) @character + (string) @string -(con_unit) @string.special.symbol ; unit, as in () +(con_unit) @string.special.symbol ; unit, as in () (comment) @comment @@ -37,30 +47,28 @@ ; ((comment) @_first . (comment)+ @comment.documentation) ; once https://github.com/neovim/neovim/pull/24738 has been merged. ; -; ((comment) @comment.documentation +; ((comment) @comment.documentation ; (#lua-match? @comment.documentation "^-- |")) ; -; ((comment) @_first @comment.documentation -; (comment) @comment.documentation +; ((comment) @_first @comment.documentation +; (comment) @comment.documentation ; (#lua-match? @_first "^-- |")) ; -; ((comment) @comment.documentation +; ((comment) @comment.documentation ; (#lua-match? @comment.documentation "^-- %^")) ; -; ((comment) @_first @comment.documentation -; (comment) @comment.documentation +; ((comment) @_first @comment.documentation +; (comment) @comment.documentation ; (#lua-match? @_first "^-- %^")) ; -; ((comment) @comment.documentation +; ((comment) @comment.documentation ; (#lua-match? @comment.documentation "^{-")) ; -; ((comment) @_first @comment.documentation -; (comment) @comment.documentation +; ((comment) @_first @comment.documentation +; (comment) @comment.documentation ; (#lua-match? @_first "^{-")) - -;; ---------------------------------------------------------------------------- -;; Punctuation - +; ---------------------------------------------------------------------------- +; Punctuation [ "(" ")" @@ -75,10 +83,8 @@ ";" ] @punctuation.delimiter - -;; ---------------------------------------------------------------------------- -;; Keywords, operators, includes - +; ---------------------------------------------------------------------------- +; Keywords, operators, includes [ "forall" "∀" @@ -105,7 +111,7 @@ (constructor_operator) (type_operator) (tycon_arrow) - (qualified_module) ; grabs the `.` (dot), ex: import System.IO + (qualified_module) ; grabs the `.` (dot), ex: import System.IO (qualified_type) (qualified_variable) (all_names) @@ -123,14 +129,26 @@ "@" ] @operator - (module) @module -((qualified_module (module) @constructor) - . (module)) -(qualified_type (module) @module) -(qualified_variable (module) @module) -(import (module) @module) -(import (module) @constructor . (module)) + +((qualified_module + (module) @constructor) + . + (module)) + +(qualified_type + (module) @module) + +(qualified_variable + (module) @module) + +(import + (module) @module) + +(import + (module) @constructor + . + (module)) [ (where) @@ -157,310 +175,449 @@ "infixr" ] @keyword +; ---------------------------------------------------------------------------- +; Functions and variables +(signature + name: (variable) @function) -;; ---------------------------------------------------------------------------- -;; Functions and variables - -(signature name: (variable) @function) - -(function name: (variable) @function) +(function + name: (variable) @function) -(function +(function name: (variable) @variable - rhs: [ - (exp_literal) - (exp_apply - (exp_name - [(constructor) - (variable) - (qualified_variable) - ])) - (quasiquote) - ((exp_name) . (operator)) - ]) + rhs: + [ + (exp_literal) + (exp_apply + (exp_name + [ + (constructor) + (variable) + (qualified_variable) + ])) + (quasiquote) + ((exp_name) + . + (operator)) + ]) -(function +(function name: (variable) @variable - rhs: (exp_infix [ - (exp_literal) - (exp_apply - (exp_name - [(constructor) - (variable) - (qualified_variable) - ])) - (quasiquote) - ((exp_name) . (operator)) - ])) + rhs: + (exp_infix + [ + (exp_literal) + (exp_apply + (exp_name + [ + (constructor) + (variable) + (qualified_variable) + ])) + (quasiquote) + ((exp_name) + . + (operator)) + ])) + +; Consider signatures (and accompanying functions) +; with only one value on the rhs as variables +(signature + . + (variable) @variable + . + (_) .) + +((signature + . + (variable) @_name + . + (_) .) + . + (function + name: (variable) @variable) + (#eq? @_name @variable)) -;; Consider signatures (and accompanying functions) -;; with only one value on the rhs as variables -(signature . (variable) @variable . (_) . ) -((signature . (variable) @_name . (_) . ) - . (function name: (variable) @variable) - (#eq? @_name @variable)) -;; but consider a type that involves 'IO' a function -(signature name: (variable) @function - . (type_apply (type_name) @_type) - (#eq? @_type "IO")) -((signature name: (variable) @_name - . (type_apply (type_name) @_type) - (#eq? @_type "IO")) - . (function name: (variable) @function) - (#eq? @_name @function)) +; but consider a type that involves 'IO' a function +(signature + name: (variable) @function + . + (type_apply + (type_name) @_type) + (#eq? @_type "IO")) + +((signature + name: (variable) @_name + . + (type_apply + (type_name) @_type) + (#eq? @_type "IO")) + . + (function + name: (variable) @function) + (#eq? @_name @function)) -;; functions with parameters -;; + accompanying signatures +; functions with parameters +; + accompanying signatures (function name: (variable) @function patterns: (patterns)) + ((signature) @function - . (function + . + (function name: (variable) @function patterns: (patterns))) + (function name: (variable) @function rhs: (exp_lambda)) ; view patterns -(pat_view (exp_name [ - ((variable) @function.call) - (qualified_variable (variable) @function.call) -])) +(pat_view + (exp_name + [ + ((variable) @function.call) + (qualified_variable + (variable) @function.call) + ])) ; consider infix functions as operators -(exp_infix [ - (variable) @operator - (qualified_variable (variable) @operator) -]) +(exp_infix + [ + (variable) @operator + (qualified_variable + (variable) @operator) + ]) + ; partially applied infix functions (sections) also get highlighted as operators -(exp_section_right [ - ((variable) @operator) - (qualified_variable (variable) @operator) -]) -(exp_section_left [ - ((variable) @operator) - (qualified_variable (variable) @operator) -]) +(exp_section_right + [ + ((variable) @operator) + (qualified_variable + (variable) @operator) + ]) + +(exp_section_left + [ + ((variable) @operator) + (qualified_variable + (variable) @operator) + ]) ; function calls with an infix operator ; e.g. func <$> a <*> b -(exp_infix - (exp_name +(exp_infix + (exp_name [ ((variable) @function.call) - (qualified_variable ( - (module) @module - (variable) @function.call)) + (qualified_variable + ((module) @module + (variable) @function.call)) ]) - . (operator)) + . + (operator)) + ; infix operators applied to variables -((exp_name (variable) @variable) . (operator)) -((operator) . (exp_name [ - ((variable) @variable) - (qualified_variable (variable) @variable) -])) +((exp_name + (variable) @variable) + . + (operator)) + +((operator) + . + (exp_name + [ + ((variable) @variable) + (qualified_variable + (variable) @variable) + ])) + ; function calls with infix operators -((exp_name [ +((exp_name + [ ((variable) @function.call) - (qualified_variable (variable) @function.call) - ]) . (operator) @_op - (#any-of? @_op "$" "<$>" ">>=" "=<<")) + (qualified_variable + (variable) @function.call) + ]) + . + (operator) @_op + (#any-of? @_op "$" "<$>" ">>=" "=<<")) + ; right hand side of infix operator -((exp_infix - [(operator)(variable)] ; infix or `func` - . (exp_name [ +((exp_infix + [ + (operator) + (variable) + ] ; infix or `func` + . + (exp_name + [ ((variable) @function.call) - (qualified_variable (variable) @function.call) - ])) . (operator) @_op - (#any-of? @_op "$" "<$>" "=<<")) + (qualified_variable + (variable) @function.call) + ])) + . + (operator) @_op + (#any-of? @_op "$" "<$>" "=<<")) + ; function composition, arrows, monadic composition (lhs) -((exp_name [ - ((variable) @function) - (qualified_variable (variable) @function) - ]) . (operator) @_op - (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) +((exp_name + [ + ((variable) @function) + (qualified_variable + (variable) @function) + ]) + . + (operator) @_op + (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) + ; right hand side of infix operator -((exp_infix - [(operator)(variable)] ; infix or `func` - . (exp_name [ +((exp_infix + [ + (operator) + (variable) + ] ; infix or `func` + . + (exp_name + [ ((variable) @function) - (qualified_variable (variable) @function) - ])) . (operator) @_op - (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) + (qualified_variable + (variable) @function) + ])) + . + (operator) @_op + (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) + ; function composition, arrows, monadic composition (rhs) -((operator) @_op . (exp_name [ - ((variable) @function) - (qualified_variable (variable) @function) - ]) - (#any-of? @_op "." ">>>" "***" ">=>" "<=<" )) - +((operator) @_op + . + (exp_name + [ + ((variable) @function) + (qualified_variable + (variable) @function) + ]) + (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) + ; function defined in terms of a function composition -(function +(function name: (variable) @function - rhs: (exp_infix (_) . (operator) @_op . (_) - (#any-of? @_op "." ">>>" "***" ">=>" "<=<"))) + rhs: + (exp_infix + (_) + . + (operator) @_op + . + (_) + (#any-of? @_op "." ">>>" "***" ">=>" "<=<"))) -(exp_apply (exp_name - [ - ((variable) @function.call) - (qualified_variable (variable) @function.call) - ])) +(exp_apply + (exp_name + [ + ((variable) @function.call) + (qualified_variable + (variable) @function.call) + ])) ; function compositions, in parentheses, applied ; lhs -(exp_apply - . (exp_parens (exp_infix - (exp_name [((variable) @function.call) (qualified_variable (variable) @function.call)]) - . (operator)))) +(exp_apply + . + (exp_parens + (exp_infix + (exp_name + [ + ((variable) @function.call) + (qualified_variable + (variable) @function.call) + ]) + . + (operator)))) + ; rhs -(exp_apply - . (exp_parens (exp_infix - (operator) - . (exp_name [((variable) @function.call) (qualified_variable (variable) @function.call)]))) - ) +(exp_apply + . + (exp_parens + (exp_infix + (operator) + . + (exp_name + [ + ((variable) @function.call) + (qualified_variable + (variable) @function.call) + ])))) -;; variables being passed to a function call -(exp_apply (_)+ - . (exp_name [ - ((variable) @variable) - (qualified_variable (variable) @variable) - ])) +; variables being passed to a function call +(exp_apply + (_)+ + . + (exp_name + [ + ((variable) @variable) + (qualified_variable + (variable) @variable) + ])) -;; Consider functions with only one value on the rhs -;; as variables, e.g. x = Rec {} or x = foo +; Consider functions with only one value on the rhs +; as variables, e.g. x = Rec {} or x = foo (function - . (variable) @variable - . [ - (exp_record) - (exp_name [(variable) (qualified_variable)]) - (exp_list) - (exp_tuple) - (exp_cond) - ] . ) + . + (variable) @variable + . + [ + (exp_record) + (exp_name + [ + (variable) + (qualified_variable) + ]) + (exp_list) + (exp_tuple) + (exp_cond) + ] .) -;; main is always a function -;; (this prevents `main = undefined` from being highlighted as a variable) -(function name: (variable) @function (#eq? @function "main")) +; main is always a function +; (this prevents `main = undefined` from being highlighted as a variable) +(function + name: (variable) @function + (#eq? @function "main")) -;; scoped function types (func :: a -> b) -(pat_typed - pattern: (pat_name (variable) @function) +; scoped function types (func :: a -> b) +(pat_typed + pattern: + (pat_name + (variable) @function) type: (fun)) -;; signatures that have a function type -;; + functions that follow them -((signature (variable) @function (fun))) -((signature (variable) @_type (fun)) . (function (variable) @function) (#eq? @function @_type)) -((signature (variable) @function (context (fun)))) -((signature (variable) @_type (context (fun))) . (function (variable) @function) (#eq? @function @_type)) -((signature (variable) @function (forall (context (fun)))) . (function (variable))) -((signature (variable) @_type (forall (context (fun)))) . (function (variable) @function) (#eq? @function @_type)) +; signatures that have a function type +; + functions that follow them +((signature + (variable) @function + (fun))) + +((signature + (variable) @_type + (fun)) + . + (function + (variable) @function) + (#eq? @function @_type)) + +((signature + (variable) @function + (context + (fun)))) + +((signature + (variable) @_type + (context + (fun))) + . + (function + (variable) @function) + (#eq? @function @_type)) + +((signature + (variable) @function + (forall + (context + (fun)))) + . + (function + (variable))) -;; ---------------------------------------------------------------------------- -;; Types +((signature + (variable) @_type + (forall + (context + (fun)))) + . + (function + (variable) @function) + (#eq? @function @_type)) +; ---------------------------------------------------------------------------- +; Types (type) @type + (type_star) @type + (type_variable) @type (constructor) @constructor ; True or False -((constructor) @boolean (#any-of? @boolean "True" "False")) +((constructor) @boolean + (#any-of? @boolean "True" "False")) + ; otherwise (= True) ((variable) @boolean (#eq? @boolean "otherwise")) -;; ---------------------------------------------------------------------------- -;; Quasi-quotes - +; ---------------------------------------------------------------------------- +; Quasi-quotes (quoter) @function.call -(quasiquote +(quasiquote [ - (quoter) @_name - (_ (variable) @_name) - ](#eq? @_name "qq") + (quoter) @_name + (_ + (variable) @_name) + ] + (#eq? @_name "qq") (quasiquote_body) @string) -(quasiquote - ((_ (variable) @_name)) (#eq? @_name "qq") +(quasiquote + ((_ + (variable) @_name)) + (#eq? @_name "qq") (quasiquote_body) @string) -;; namespaced quasi-quoter +; namespaced quasi-quoter (quasiquote (_ (module) @module - . (variable) @function.call - )) + . + (variable) @function.call)) ; Highlighting of quasiquote_body for other languages is handled by injections.scm - -;; ---------------------------------------------------------------------------- -;; Exceptions/error handling - +; ---------------------------------------------------------------------------- +; Exceptions/error handling ((variable) @keyword.exception - (#any-of? @keyword.exception - "error" - "undefined" - "try" - "tryJust" - "tryAny" - "catch" - "catches" - "catchJust" - "handle" - "handleJust" - "throw" - "throwIO" - "throwTo" - "throwError" - "ioError" - "mask" - "mask_" - "uninterruptibleMask" - "uninterruptibleMask_" - "bracket" - "bracket_" - "bracketOnErrorSource" - "finally" - "fail" - "onException" - "expectationFailure")) + (#any-of? @keyword.exception "error" "undefined" "try" "tryJust" "tryAny" "catch" "catches" "catchJust" "handle" "handleJust" "throw" "throwIO" "throwTo" "throwError" "ioError" "mask" "mask_" "uninterruptibleMask" "uninterruptibleMask_" "bracket" "bracket_" "bracketOnErrorSource" "finally" "fail" "onException" "expectationFailure")) -;; ---------------------------------------------------------------------------- -;; Debugging +; ---------------------------------------------------------------------------- +; Debugging ((variable) @keyword.debug - (#any-of? @keyword.debug - "trace" - "traceId" - "traceShow" - "traceShowId" - "traceWith" - "traceShowWith" - "traceStack" - "traceIO" - "traceM" - "traceShowM" - "traceEvent" - "traceEventWith" - "traceEventIO" - "flushEventLog" - "traceMarker" - "traceMarkerIO")) + (#any-of? @keyword.debug "trace" "traceId" "traceShow" "traceShowId" "traceWith" "traceShowWith" "traceStack" "traceIO" "traceM" "traceShowM" "traceEvent" "traceEventWith" "traceEventIO" "flushEventLog" "traceMarker" "traceMarkerIO")) + +; ---------------------------------------------------------------------------- +; Fields +(field + (variable) @variable.member) +(pat_field + (variable) @variable.member) -;; ---------------------------------------------------------------------------- -;; Fields -(field (variable) @variable.member) -(pat_field (variable) @variable.member) -(exp_projection field: (variable) @variable.member) -(import_item (type) . (import_con_names (variable) @variable.member)) -(exp_field field: [((variable) @variable.member) (qualified_variable (variable) @variable.member)]) +(exp_projection + field: (variable) @variable.member) +(import_item + (type) + . + (import_con_names + (variable) @variable.member)) -;; ---------------------------------------------------------------------------- -;; Spell checking +(exp_field + field: + [ + ((variable) @variable.member) + (qualified_variable + (variable) @variable.member) + ]) +; ---------------------------------------------------------------------------- +; Spell checking (comment) @spell diff --git a/queries/haskell/injections.scm b/queries/haskell/injections.scm index bc70e012f..d1c8fe5fb 100644 --- a/queries/haskell/injections.scm +++ b/queries/haskell/injections.scm @@ -1,18 +1,15 @@ -;; ----------------------------------------------------------------------------- -;; General language injection - +; ----------------------------------------------------------------------------- +; General language injection (quasiquote - ((quoter) @injection.language) - ((quasiquote_body) @injection.content) -) + ((quoter) @injection.language) + ((quasiquote_body) @injection.content)) ((comment) @injection.content - (#set! injection.language "comment")) - -;; ----------------------------------------------------------------------------- -;; shakespeare library -;; NOTE: doesn't support templating + (#set! injection.language "comment")) +; ----------------------------------------------------------------------------- +; shakespeare library +; NOTE: doesn't support templating ; TODO: add once CoffeeScript parser is added ; ; CoffeeScript: Text.Coffee ; (quasiquote @@ -20,58 +17,52 @@ ; (#eq? @_name "coffee") ; ((quasiquote_body) @injection.content ; (#set! injection.language "coffeescript"))) - ; CSS: Text.Cassius, Text.Lucius (quasiquote - (quoter) @_name - (#any-of? @_name "cassius" "lucius") - ((quasiquote_body) @injection.content) - (#set! injection.language "css")) + (quoter) @_name + (#any-of? @_name "cassius" "lucius") + ((quasiquote_body) @injection.content) + (#set! injection.language "css")) ; HTML: Text.Hamlet (quasiquote - (quoter) @_name - (#any-of? @_name "shamlet" "xshamlet" "hamlet" "xhamlet" "ihamlet") - ((quasiquote_body) @injection.content) - (#set! injection.language "html")) + (quoter) @_name + (#any-of? @_name "shamlet" "xshamlet" "hamlet" "xhamlet" "ihamlet") + ((quasiquote_body) @injection.content) + (#set! injection.language "html")) ; JS: Text.Julius (quasiquote - (quoter) @_name - (#any-of? @_name "js" "julius") - ((quasiquote_body) @injection.content) - (#set! injection.language "javascript")) + (quoter) @_name + (#any-of? @_name "js" "julius") + ((quasiquote_body) @injection.content) + (#set! injection.language "javascript")) ; TS: Text.TypeScript (quasiquote - (quoter) @_name - (#any-of? @_name "tsc" "tscJSX") - ((quasiquote_body) @injection.content) - (#set! injection.language "typescript")) - - -;; ----------------------------------------------------------------------------- -;; HSX + (quoter) @_name + (#any-of? @_name "tsc" "tscJSX") + ((quasiquote_body) @injection.content) + (#set! injection.language "typescript")) +; ----------------------------------------------------------------------------- +; HSX (quasiquote - (quoter) @_name - (#eq? @_name "hsx") - ((quasiquote_body) @injection.content) - (#set! injection.language "html")) - -;; ----------------------------------------------------------------------------- -;; Inline JSON from aeson + (quoter) @_name + (#eq? @_name "hsx") + ((quasiquote_body) @injection.content) + (#set! injection.language "html")) +; ----------------------------------------------------------------------------- +; Inline JSON from aeson (quasiquote (quoter) @_name (#eq? @_name "aesonQQ") ((quasiquote_body) @injection.content) (#set! injection.language "json")) - -;; ----------------------------------------------------------------------------- -;; SQL - +; ----------------------------------------------------------------------------- +; SQL ; postgresql-simple (quasiquote (quoter) @injection.language diff --git a/queries/haskell_persistent/folds.scm b/queries/haskell_persistent/folds.scm index 2bdffd177..dd34d9f15 100644 --- a/queries/haskell_persistent/folds.scm +++ b/queries/haskell_persistent/folds.scm @@ -1,3 +1 @@ -[ - (entity_definition) -] @fold +(entity_definition) @fold diff --git a/queries/haskell_persistent/highlights.scm b/queries/haskell_persistent/highlights.scm index e806befcf..22cbf5cb3 100644 --- a/queries/haskell_persistent/highlights.scm +++ b/queries/haskell_persistent/highlights.scm @@ -1,20 +1,23 @@ -;; ---------------------------------------------------------------------------- -;; Literals and comments - +; ---------------------------------------------------------------------------- +; Literals and comments (integer) @number + (float) @number.float + (char) @character + (string) @string + (attribute_name) @attribute + (attribute_exclamation_mark) @attribute -(con_unit) @string.special.symbol ; unit, as in () +(con_unit) @string.special.symbol ; unit, as in () (comment) @comment @spell -;; ---------------------------------------------------------------------------- -;; Keywords, operators, includes - +; ---------------------------------------------------------------------------- +; Keywords, operators, includes [ "Id" "Primary" @@ -24,15 +27,12 @@ "=" @operator - -;; ---------------------------------------------------------------------------- -;; Functions and variables - +; ---------------------------------------------------------------------------- +; Functions and variables (variable) @variable -;; ---------------------------------------------------------------------------- -;; Types - +; ---------------------------------------------------------------------------- +; Types (type) @type (constructor) @constructor diff --git a/queries/hcl/folds.scm b/queries/hcl/folds.scm index cb20b2aa8..e0c5313a2 100644 --- a/queries/hcl/folds.scm +++ b/queries/hcl/folds.scm @@ -1,6 +1,6 @@ [ - (comment) - (block) - (heredoc_template) - (object) + (comment) + (block) + (heredoc_template) + (object) ] @fold diff --git a/queries/hcl/highlights.scm b/queries/hcl/highlights.scm index 7aa8b86fe..45a120dff 100644 --- a/queries/hcl/highlights.scm +++ b/queries/hcl/highlights.scm @@ -1,5 +1,4 @@ ; highlights.scm - [ "!" "\*" @@ -76,22 +75,45 @@ ] @punctuation.special (numeric_lit) @number + (bool_lit) @boolean + (null_lit) @constant + (comment) @comment @spell + (identifier) @variable -(body (block (identifier) @keyword)) -(body (block (body (block (identifier) @type)))) -(function_call (identifier) @function) -(attribute (identifier) @variable.member) +(body + (block + (identifier) @keyword)) + +(body + (block + (body + (block + (identifier) @type)))) + +(function_call + (identifier) @function) + +(attribute + (identifier) @variable.member) ; { key: val } ; ; highlight identifier keys as though they were block attributes -(object_elem key: (expression (variable_expr (identifier) @variable.member))) +(object_elem + key: + (expression + (variable_expr + (identifier) @variable.member))) ; var.foo, data.bar ; ; first element in get_attr is a variable.builtin or a reference to a variable.builtin -(expression (variable_expr (identifier) @variable.builtin) (get_attr (identifier) @variable.member)) +(expression + (variable_expr + (identifier) @variable.builtin) + (get_attr + (identifier) @variable.member)) diff --git a/queries/hcl/indents.scm b/queries/hcl/indents.scm index 93264de9d..1d7dc49d9 100644 --- a/queries/hcl/indents.scm +++ b/queries/hcl/indents.scm @@ -12,4 +12,5 @@ ] @indent.branch @indent.end (comment) @indent.auto + (ERROR) @indent.auto diff --git a/queries/hcl/injections.scm b/queries/hcl/injections.scm index fd881d503..b68f4caea 100644 --- a/queries/hcl/injections.scm +++ b/queries/hcl/injections.scm @@ -1,5 +1,5 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) (heredoc_template (template_literal) @injection.content diff --git a/queries/heex/highlights.scm b/queries/heex/highlights.scm index f13e5d04f..e2fb01880 100644 --- a/queries/heex/highlights.scm +++ b/queries/heex/highlights.scm @@ -31,23 +31,24 @@ ; HEEx text content is treated as markup ; (text) @none - ; HEEx tags and slots are highlighted as HTML [ - (tag_name) - (slot_name) + (tag_name) + (slot_name) ] @tag ; HEEx attributes are highlighted as HTML attributes (attribute_name) @tag.attribute + [ (attribute_value) (quoted_attribute_value) ] @string ; HEEx components are highlighted as modules and function calls -(component_name [ - (module) @type - (function) @function - "." @punctuation.delimiter -]) +(component_name + [ + (module) @type + (function) @function + "." @punctuation.delimiter + ]) diff --git a/queries/heex/injections.scm b/queries/heex/injections.scm index d8ae03caa..4f179ee80 100644 --- a/queries/heex/injections.scm +++ b/queries/heex/injections.scm @@ -27,4 +27,4 @@ ; HEEx comments ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/hjson/highlights.scm b/queries/hjson/highlights.scm index 6e092fa14..8333d8fe5 100644 --- a/queries/hjson/highlights.scm +++ b/queries/hjson/highlights.scm @@ -1,15 +1,28 @@ (true) @boolean + (false) @boolean + (null) @constant.builtin + (number) @number -(pair key: (string) @label) -(pair value: (string) @string) -(array (string) @string) + +(pair + key: (string) @label) + +(pair + value: (string) @string) + +(array + (string) @string) + ; (string_content (escape_sequence) @string.escape) ; "," @punctuation.delimiter "[" @punctuation.bracket + "]" @punctuation.bracket + "{" @punctuation.bracket + "}" @punctuation.bracket (comment) @comment @spell diff --git a/queries/hjson/indents.scm b/queries/hjson/indents.scm index 3b01ca999..350f670a0 100644 --- a/queries/hjson/indents.scm +++ b/queries/hjson/indents.scm @@ -1,3 +1,2 @@ ; inherits: json - (comment) @indent.ignore diff --git a/queries/hjson/injections.scm b/queries/hjson/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/hjson/injections.scm +++ b/queries/hjson/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/hlsl/highlights.scm b/queries/hlsl/highlights.scm index 68e9e44bd..b85c1a7fd 100644 --- a/queries/hlsl/highlights.scm +++ b/queries/hlsl/highlights.scm @@ -1,5 +1,4 @@ ; inherits: cpp - [ "in" "out" @@ -26,10 +25,13 @@ "triangle" ] @type.qualifier -( - (identifier) @variable.builtin - (#lua-match? @variable.builtin "^SV_") -) +((identifier) @variable.builtin + (#lua-match? @variable.builtin "^SV_")) (hlsl_attribute) @attribute -(hlsl_attribute ["[" "]"] @attribute) + +(hlsl_attribute + [ + "[" + "]" + ] @attribute) diff --git a/queries/hlsl/injections.scm b/queries/hlsl/injections.scm index 29222ee01..c2fca7121 100644 --- a/queries/hlsl/injections.scm +++ b/queries/hlsl/injections.scm @@ -1,5 +1,5 @@ ((preproc_arg) @injection.content - (#set! injection.language "hlsl")) + (#set! injection.language "hlsl")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/hocon/highlights.scm b/queries/hocon/highlights.scm index f0cc498b4..0eb94e6dd 100644 --- a/queries/hocon/highlights.scm +++ b/queries/hocon/highlights.scm @@ -1,37 +1,65 @@ (comment) @comment @spell (null) @constant.builtin -[ (true) (false) ] @boolean + +[ + (true) + (false) +] @boolean + (number) @number + (unit) @keyword + (string) @string + (multiline_string) @string -(string (escape_sequence) @string.escape) + +(string + (escape_sequence) @string.escape) + (unquoted_string) @string -[ "url" +[ + "url" "file" "classpath" "required" ] @keyword -(include "include" @keyword.import) +(include + "include" @keyword.import) + +(substitution + [ + "${" + "${?" + "}" + ] @punctuation.special) + +(substitution + (_) @variable.member) -(substitution ["${" "${?" "}"] @punctuation.special) -(substitution (_) @variable.member) +(path + (_) @variable.member) -(path (_) @variable.member) -(value [":" "=" "+=" ] @operator) +(value + [ + ":" + "=" + "+=" + ] @operator) [ - "(" - ")" - "[" - "]" - "{" - "}" -] @punctuation.bracket + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket -[ "," ] @punctuation.delimiter -(unquoted_path "." @punctuation.delimiter) +"," @punctuation.delimiter +(unquoted_path + "." @punctuation.delimiter) diff --git a/queries/hocon/injections.scm b/queries/hocon/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/hocon/injections.scm +++ b/queries/hocon/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/hoon/folds.scm b/queries/hoon/folds.scm index 93d1386e7..cfb4b6d0c 100644 --- a/queries/hoon/folds.scm +++ b/queries/hoon/folds.scm @@ -1,6 +1,6 @@ [ - (bartisTall) - (luslusTall) - (lusbucTall) - (barcenTall) - ] @fold + (bartisTall) + (luslusTall) + (lusbucTall) + (barcenTall) +] @fold diff --git a/queries/hoon/highlights.scm b/queries/hoon/highlights.scm index 029d20c1e..767b0dd22 100644 --- a/queries/hoon/highlights.scm +++ b/queries/hoon/highlights.scm @@ -7,14 +7,13 @@ ")" "[" "]" -] @punctuation.bracket +] @punctuation.bracket [ (coreTerminator) (seriesTerminator) ] @punctuation.delimiter - (rune) @operator (term) @constant @@ -28,6 +27,9 @@ (date) @string.special (mold) @string.special.symbol + (specialIndex) @number.builtin + (lark) @operator + (fullContext) @string.special.symbol diff --git a/queries/hoon/locals.scm b/queries/hoon/locals.scm index f8cb5f857..fd7cc026d 100644 --- a/queries/hoon/locals.scm +++ b/queries/hoon/locals.scm @@ -1,4 +1,4 @@ (tisfasTall name: (name) @local.definition.var) - + (name) @local.reference diff --git a/queries/html/highlights.scm b/queries/html/highlights.scm index 4e2371d64..ae4e396c0 100644 --- a/queries/html/highlights.scm +++ b/queries/html/highlights.scm @@ -1,5 +1,4 @@ ; inherits: html_tags - (doctype) @constant "<!" @tag.delimiter diff --git a/queries/html/injections.scm b/queries/html/injections.scm index 7087abc73..adb067d15 100644 --- a/queries/html/injections.scm +++ b/queries/html/injections.scm @@ -1,5 +1,4 @@ ; inherits html_tags - (element (start_tag (tag_name) @_py_script) @@ -10,12 +9,12 @@ (script_element (start_tag (attribute - (attribute_name) @_attr - (quoted_attribute_value + (attribute_name) @_attr + (quoted_attribute_value (attribute_value) @_type))) (raw_text) @injection.content (#eq? @_attr "type") - ; not adding type="py" here as it's handled by html_tags + ; not adding type="py" here as it's handled by html_tags (#any-of? @_type "pyscript" "py-script") (#set! injection.language "python")) diff --git a/queries/html_tags/highlights.scm b/queries/html_tags/highlights.scm index 44626caac..9b84fbf8b 100644 --- a/queries/html_tags/highlights.scm +++ b/queries/html_tags/highlights.scm @@ -1,61 +1,104 @@ (tag_name) @tag ; (erroneous_end_tag_name) @error ; we do not lint syntax errors (comment) @comment @spell + (attribute_name) @tag.attribute + ((attribute (quoted_attribute_value) @string) - (#set! "priority" 99)) + (#set! "priority" 99)) + (text) @none @spell -((element (start_tag (tag_name) @_tag) (text) @markup.heading) - (#eq? @_tag "title")) +((element + (start_tag + (tag_name) @_tag) + (text) @markup.heading) + (#eq? @_tag "title")) -((element (start_tag (tag_name) @_tag) (text) @markup.heading.1) - (#eq? @_tag "h1")) +((element + (start_tag + (tag_name) @_tag) + (text) @markup.heading.1) + (#eq? @_tag "h1")) -((element (start_tag (tag_name) @_tag) (text) @markup.heading.2) - (#eq? @_tag "h2")) +((element + (start_tag + (tag_name) @_tag) + (text) @markup.heading.2) + (#eq? @_tag "h2")) -((element (start_tag (tag_name) @_tag) (text) @markup.heading.3) - (#eq? @_tag "h3")) +((element + (start_tag + (tag_name) @_tag) + (text) @markup.heading.3) + (#eq? @_tag "h3")) -((element (start_tag (tag_name) @_tag) (text) @markup.heading.4) - (#eq? @_tag "h4")) +((element + (start_tag + (tag_name) @_tag) + (text) @markup.heading.4) + (#eq? @_tag "h4")) -((element (start_tag (tag_name) @_tag) (text) @markup.heading.5) - (#eq? @_tag "h5")) +((element + (start_tag + (tag_name) @_tag) + (text) @markup.heading.5) + (#eq? @_tag "h5")) -((element (start_tag (tag_name) @_tag) (text) @markup.heading.6) - (#eq? @_tag "h6")) +((element + (start_tag + (tag_name) @_tag) + (text) @markup.heading.6) + (#eq? @_tag "h6")) -((element (start_tag (tag_name) @_tag) (text) @markup.strong) - (#any-of? @_tag "strong" "b")) +((element + (start_tag + (tag_name) @_tag) + (text) @markup.strong) + (#any-of? @_tag "strong" "b")) -((element (start_tag (tag_name) @_tag) (text) @markup.italic) - (#any-of? @_tag "em" "i")) +((element + (start_tag + (tag_name) @_tag) + (text) @markup.italic) + (#any-of? @_tag "em" "i")) -((element (start_tag (tag_name) @_tag) (text) @markup.strikethrough) - (#any-of? @_tag "s" "del")) +((element + (start_tag + (tag_name) @_tag) + (text) @markup.strikethrough) + (#any-of? @_tag "s" "del")) -((element (start_tag (tag_name) @_tag) (text) @markup.underline) - (#eq? @_tag "u")) +((element + (start_tag + (tag_name) @_tag) + (text) @markup.underline) + (#eq? @_tag "u")) -((element (start_tag (tag_name) @_tag) (text) @markup.raw) - (#any-of? @_tag "code" "kbd")) +((element + (start_tag + (tag_name) @_tag) + (text) @markup.raw) + (#any-of? @_tag "code" "kbd")) -((element (start_tag (tag_name) @_tag) (text) @string.special.url) - (#eq? @_tag "a")) +((element + (start_tag + (tag_name) @_tag) + (text) @string.special.url) + (#eq? @_tag "a")) ((attribute - (attribute_name) @_attr - (quoted_attribute_value (attribute_value) @string.special.url)) - (#any-of? @_attr "href" "src")) + (attribute_name) @_attr + (quoted_attribute_value + (attribute_value) @string.special.url)) + (#any-of? @_attr "href" "src")) [ - "<" - ">" - "</" - "/>" + "<" + ">" + "</" + "/>" ] @tag.delimiter "=" @operator diff --git a/queries/html_tags/indents.scm b/queries/html_tags/indents.scm index 2d9fd3864..59448d2fc 100644 --- a/queries/html_tags/indents.scm +++ b/queries/html_tags/indents.scm @@ -1,31 +1,32 @@ [ - ( - (element - (start_tag - (tag_name) @_not_special) - ) - (#not-any-of? @_not_special "meta" "link") - ) - (element (self_closing_tag)) + ((element + (start_tag + (tag_name) @_not_special)) + (#not-any-of? @_not_special "meta" "link")) + (element + (self_closing_tag)) ] @indent.begin - ; These tags are usually written one-lined and doesn't use self-closing tags so special-cased them ; but add indent to the tag to make sure attributes inside them are still indented if written multi-lined -( - (start_tag - (tag_name) @_special) - (#any-of? @_special "meta" "link") -) @indent.begin - +((start_tag + (tag_name) @_special) + (#any-of? @_special "meta" "link")) @indent.begin ; These are the nodes that will be captured when we do `normal o` ; But last element has already been ended, so capturing this ; to mark end of last element -(element (end_tag [">"] @indent.end)) -(element (self_closing_tag "/>" @indent.end)) +(element + (end_tag + ">" @indent.end)) + +(element + (self_closing_tag + "/>" @indent.end)) ; Script/style elements aren't indented, so only branch the end tag of other elements -(element (end_tag) @indent.branch) +(element + (end_tag) @indent.branch) + [ ">" "/>" diff --git a/queries/html_tags/injections.scm b/queries/html_tags/injections.scm index cef63ad8d..8cfcddf29 100644 --- a/queries/html_tags/injections.scm +++ b/queries/html_tags/injections.scm @@ -3,51 +3,57 @@ ; Add "lang" to predicate check so that vue/svelte can inherit this ; without having this element being captured twice ((style_element - (start_tag) @_no_type_lang - (raw_text) @injection.content) + (start_tag) @_no_type_lang + (raw_text) @injection.content) (#not-lua-match? @_no_type_lang "%slang%s*=") (#not-lua-match? @_no_type_lang "%stype%s*=") (#set! injection.language "css")) ((style_element - (start_tag - (attribute - (attribute_name) @_type - (quoted_attribute_value (attribute_value) @_css))) - (raw_text) @injection.content) - (#eq? @_type "type") - (#eq? @_css "text/css") - (#set! injection.language "css")) + (start_tag + (attribute + (attribute_name) @_type + (quoted_attribute_value + (attribute_value) @_css))) + (raw_text) @injection.content) + (#eq? @_type "type") + (#eq? @_css "text/css") + (#set! injection.language "css")) ; <script>...</script> ; <script defer>...</script> ((script_element - (start_tag) @_no_type_lang - (raw_text) @injection.content) - (#not-lua-match? @_no_type_lang "%slang%s*=") - (#not-lua-match? @_no_type_lang "%stype%s*=") - (#set! injection.language "javascript")) + (start_tag) @_no_type_lang + (raw_text) @injection.content) + (#not-lua-match? @_no_type_lang "%slang%s*=") + (#not-lua-match? @_no_type_lang "%stype%s*=") + (#set! injection.language "javascript")) ; <script type="mimetype-or-well-known-script-type"> (script_element (start_tag ((attribute - (attribute_name) @_attr (#eq? @_attr "type") - (quoted_attribute_value (attribute_value) @_type)))) - (raw_text) @injection.content (#set-lang-from-mimetype! @_type)) + (attribute_name) @_attr + (#eq? @_attr "type") + (quoted_attribute_value + (attribute_value) @_type)))) + (raw_text) @injection.content + (#set-lang-from-mimetype! @_type)) ; <a style="/* css */"> ((attribute - (attribute_name) @_attr - (quoted_attribute_value (attribute_value) @injection.content)) - (#eq? @_attr "style") - (#set! injection.language "css")) + (attribute_name) @_attr + (quoted_attribute_value + (attribute_value) @injection.content)) + (#eq? @_attr "style") + (#set! injection.language "css")) ; lit-html style template interpolation ; <a @click=${e => console.log(e)}> ; <a @click="${e => console.log(e)}"> ((attribute - (quoted_attribute_value (attribute_value) @injection.content)) + (quoted_attribute_value + (attribute_value) @injection.content)) (#lua-match? @injection.content "%${") (#offset! @injection.content 0 2 0 -1) (#set! injection.language "javascript")) @@ -59,39 +65,44 @@ (#set! injection.language "javascript")) ; <input pattern="[0-9]"> or <input pattern=[0-9]> -(element (_ - (tag_name) @_tagname (#eq? @_tagname "input") - ((attribute - (attribute_name) @_attr [ - (quoted_attribute_value (attribute_value) @injection.content) - (attribute_value) @injection.content - ] (#eq? @_attr "pattern"))) - (#set! injection.language "regex"))) +(element + (_ + (tag_name) @_tagname + (#eq? @_tagname "input") + ((attribute + (attribute_name) @_attr + [ + (quoted_attribute_value + (attribute_value) @injection.content) + (attribute_value) @injection.content + ] + (#eq? @_attr "pattern"))) + (#set! injection.language "regex"))) ; <input type="checkbox" onchange="this.closest('form').elements.output.value = this.checked"> (attribute (attribute_name) @_name (#lua-match? @_name "^on[a-z]+$") - (quoted_attribute_value (attribute_value) @injection.content) + (quoted_attribute_value + (attribute_value) @injection.content) (#set! injection.language "javascript")) (attribute ((attribute_name) @_name - (#lua-match? @_name "[%[%(].*[%)%]]")) + (#lua-match? @_name "[%[%(].*[%)%]]")) (quoted_attribute_value (attribute_value) @injection.content) (#set! injection.language "angular")) (attribute ((attribute_name) @_name - (#lua-match? @_name "^%*")) + (#lua-match? @_name "^%*")) (quoted_attribute_value ((attribute_value) @injection.content)) (#set! injection.language "angular")) (element ((text) @injection.content - (#lua-match? @injection.content "%{%{.*%}%}") - (#offset! @injection.content 0 2 0 -2)) + (#lua-match? @injection.content "%{%{.*%}%}") + (#offset! @injection.content 0 2 0 -2)) (#set! injection.language "angular")) - diff --git a/queries/htmldjango/highlights.scm b/queries/htmldjango/highlights.scm index 214dbb36f..5bbc4211b 100644 --- a/queries/htmldjango/highlights.scm +++ b/queries/htmldjango/highlights.scm @@ -1,45 +1,59 @@ ; adapted from https://github.com/interdependence/tree-sitter-htmldjango - [ (unpaired_comment) (paired_comment) ] @comment @spell [ - "{{" "}}" - "{%" "%}" + "{{" + "}}" + "{%" + "%}" (end_paired_statement) ] @punctuation.bracket [ - "end" - (tag_name) + "end" + (tag_name) ] @function (variable_name) @variable (filter_name) @function.method + (filter_argument) @variable.parameter (keyword) @keyword [ - "|" - "=" - (operator) + "|" + "=" + (operator) ] @operator + (keyword_operator) @keyword.operator (string) @string -(filter [ "'" "\"" ] . (filter_argument) @string) + +(filter + [ + "'" + "\"" + ] + . + (filter_argument) @string) (number) @number -((filter (filter_argument) @number) - (#lua-match? @number "^%d+$")) + +((filter + (filter_argument) @number) + (#lua-match? @number "^%d+$")) (boolean) @boolean -((filter (filter_argument) @boolean) - (#any-of? @boolean "True" "False")) + +((filter + (filter_argument) @boolean) + (#any-of? @boolean "True" "False")) [ ":" diff --git a/queries/htmldjango/indents.scm b/queries/htmldjango/indents.scm index fd3d86502..d671f045d 100644 --- a/queries/htmldjango/indents.scm +++ b/queries/htmldjango/indents.scm @@ -1,3 +1,5 @@ (paired_statement) @indent.begin + (end_paired_statement) @indent.end + (branch_statement) @indent.branch diff --git a/queries/htmldjango/injections.scm b/queries/htmldjango/injections.scm index f08227342..c475757bf 100644 --- a/queries/htmldjango/injections.scm +++ b/queries/htmldjango/injections.scm @@ -1,3 +1,3 @@ ((content) @injection.content - (#set! injection.language "html") - (#set! injection.combined)) + (#set! injection.language "html") + (#set! injection.combined)) diff --git a/queries/http/highlights.scm b/queries/http/highlights.scm index c5af93714..d1396ff63 100644 --- a/queries/http/highlights.scm +++ b/queries/http/highlights.scm @@ -1,29 +1,24 @@ ; Keywords - (scheme) @keyword ; Methods - (method) @function.method ; Constants - (const_spec) @constant ; Variables - (identifier) @variable ; Fields - -(pair name: (identifier) @variable.member) +(pair + name: (identifier) @variable.member) ; Parameters - -(query_param (key) @variable.parameter) +(query_param + (key) @variable.parameter) ; Operators - [ "=" "?" @@ -32,7 +27,6 @@ ] @operator ; Literals - (string) @string (target_url) @string.special.url @@ -40,17 +34,15 @@ (number) @number ; (boolean) @boolean - (null) @constant.builtin ; Punctuation - -[ "{{" "}}" ] @punctuation.bracket - [ - ":" -] @punctuation.delimiter + "{{" + "}}" +] @punctuation.bracket -; Comments +":" @punctuation.delimiter +; Comments (comment) @comment @spell diff --git a/queries/http/injections.scm b/queries/http/injections.scm index cc17373dc..a0cc1b4e9 100644 --- a/queries/http/injections.scm +++ b/queries/http/injections.scm @@ -1,11 +1,11 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) ((json_body) @injection.content - (#set! injection.language "json")) + (#set! injection.language "json")) ((xml_body) @injection.content - (#set! injection.language "xml")) + (#set! injection.language "xml")) -; ((graphql_body) @injection.content +; ((graphql_body) @injection.content ; (#set! injection.language "graphql")) ; Not used as of now.. diff --git a/queries/hurl/folds.scm b/queries/hurl/folds.scm index d7b8cd6cd..a0edfa930 100644 --- a/queries/hurl/folds.scm +++ b/queries/hurl/folds.scm @@ -1,5 +1,4 @@ ; fold.scm - [ (comment) (entry) diff --git a/queries/hurl/highlights.scm b/queries/hurl/highlights.scm index d43c172b8..9ccaa2ee7 100644 --- a/queries/hurl/highlights.scm +++ b/queries/hurl/highlights.scm @@ -1,6 +1,5 @@ ; highlights.scm - -[ +[ "[QueryStringParams]" "[FormParams]" "[MultipartFormData]" @@ -13,7 +12,7 @@ (json_key_string) ] @property -[ +[ "\\" (regex_escaped_char) (quoted_string_escaped_char) @@ -53,7 +52,8 @@ "retry" "retry-interval" "retry-max-count" - (variable_option "variable") + (variable_option + "variable") "verbose" "very-verbose" ] @constant.builtin @@ -102,17 +102,26 @@ (json_number) ] @number.float -[ ":" "," ] @punctuation.delimiter +[ + ":" + "," +] @punctuation.delimiter -[ "[" "]" "{" "}" "{{" "}}" ] @punctuation.bracket +[ + "[" + "]" + "{" + "}" + "{{" + "}}" +] @punctuation.bracket -[ +[ (value_string) (quoted_string) (json_string) ] @string - [ "base64," "hex," @@ -133,4 +142,3 @@ (filter) @attribute (method) @type.builtin - diff --git a/queries/hurl/indents.scm b/queries/hurl/indents.scm index 232cfc01a..af6fdfa4e 100644 --- a/queries/hurl/indents.scm +++ b/queries/hurl/indents.scm @@ -1,5 +1,4 @@ ; indents.scm - [ (json_object) (json_array) @@ -11,4 +10,5 @@ ] @indent.branch (xml_tag) @indent.begin + (xml_close_tag) @indent.branch diff --git a/queries/hurl/injections.scm b/queries/hurl/injections.scm index 1a099e186..ea62b8f5f 100644 --- a/queries/hurl/injections.scm +++ b/queries/hurl/injections.scm @@ -1,9 +1,9 @@ ; injections.scm ((json_value) @injection.content - (#set! injection.language "json")) + (#set! injection.language "json")) ((xml) @injection.content - (#set! injection.language "xml")) + (#set! injection.language "xml")) (multiline_string (multiline_string_type) @_lang diff --git a/queries/ini/highlights.scm b/queries/ini/highlights.scm index d431a78b5..4da3c7b4c 100644 --- a/queries/ini/highlights.scm +++ b/queries/ini/highlights.scm @@ -1,15 +1,16 @@ (section_name (text) @type) ; consistency with toml + (comment) @comment @spell [ - "[" - "]" + "[" + "]" ] @punctuation.bracket -[ - "=" -] @operator +"=" @operator + +(setting + (setting_name) @property) -(setting (setting_name) @property) ; (setting_value) @none ; grammar does not support subtypes diff --git a/queries/ispc/folds.scm b/queries/ispc/folds.scm index 45d0ba131..331c70345 100644 --- a/queries/ispc/folds.scm +++ b/queries/ispc/folds.scm @@ -1,5 +1,4 @@ ; inherits: c - [ (foreach_statement) (foreach_instance_statement) diff --git a/queries/ispc/highlights.scm b/queries/ispc/highlights.scm index 6b1d2bd96..3877bafa3 100644 --- a/queries/ispc/highlights.scm +++ b/queries/ispc/highlights.scm @@ -1,5 +1,4 @@ ; inherits: c - [ "soa" "task" @@ -26,9 +25,7 @@ "foreach_unique" ] @keyword.repeat -[ - "cif" -] @keyword.conditional +"cif" @keyword.conditional [ "varying" @@ -37,56 +34,45 @@ "__regcall" @attribute -(overload_declarator name: _ @function) -(foreach_statement range_operator: _ @operator) +(overload_declarator + name: _ @function) + +(foreach_statement + range_operator: _ @operator) + +(short_vector + [ + "<" + ">" + ] @punctuation.bracket) + +(soa_qualifier + [ + "<" + ">" + ] @punctuation.bracket) + +(template_argument_list + [ + "<" + ">" + ] @punctuation.bracket) -(short_vector ["<" ">"] @punctuation.bracket) -(soa_qualifier ["<" ">"] @punctuation.bracket) -(template_argument_list ["<" ">"] @punctuation.bracket) -(template_parameter_list ["<" ">"] @punctuation.bracket) +(template_parameter_list + [ + "<" + ">" + ] @punctuation.bracket) (llvm_identifier) @function.builtin ; built-in variables ((identifier) @variable.builtin - (#any-of? @variable.builtin - "programCount" - "programIndex" - "taskCount" - "taskCount0" - "taskCount1" - "taskCount2" - "taskIndex" - "taskIndex0" - "taskIndex1" - "taskIndex2" - "threadCount" - "threadIndex" - )) + (#any-of? @variable.builtin "programCount" "programIndex" "taskCount" "taskCount0" "taskCount1" "taskCount2" "taskIndex" "taskIndex0" "taskIndex1" "taskIndex2" "threadCount" "threadIndex")) ; preprocessor constants ((identifier) @constant.builtin - (#any-of? @constant.builtin - "ISPC" - "ISPC_FP16_SUPPORTED" - "ISPC_FP64_SUPPORTED" - "ISPC_LLVM_INTRINSICS_ENABLED" - "ISPC_MAJOR_VERSION" - "ISPC_MINOR_VERSION" - "ISPC_POINTER_SIZE" - "ISPC_TARGET_AVX" - "ISPC_TARGET_AVX2" - "ISPC_TARGET_AVX512KNL" - "ISPC_TARGET_AVX512SKX" - "ISPC_TARGET_AVX512SPR" - "ISPC_TARGET_NEON" - "ISPC_TARGET_SSE2" - "ISPC_TARGET_SSE4" - "ISPC_UINT_IS_DEFINED" - "PI" - "TARGET_ELEMENT_WIDTH" - "TARGET_WIDTH" - )) + (#any-of? @constant.builtin "ISPC" "ISPC_FP16_SUPPORTED" "ISPC_FP64_SUPPORTED" "ISPC_LLVM_INTRINSICS_ENABLED" "ISPC_MAJOR_VERSION" "ISPC_MINOR_VERSION" "ISPC_POINTER_SIZE" "ISPC_TARGET_AVX" "ISPC_TARGET_AVX2" "ISPC_TARGET_AVX512KNL" "ISPC_TARGET_AVX512SKX" "ISPC_TARGET_AVX512SPR" "ISPC_TARGET_NEON" "ISPC_TARGET_SSE2" "ISPC_TARGET_SSE4" "ISPC_UINT_IS_DEFINED" "PI" "TARGET_ELEMENT_WIDTH" "TARGET_WIDTH")) ; standard library built-in ((type_identifier) @type.builtin diff --git a/queries/ispc/indents.scm b/queries/ispc/indents.scm index cc0829d5c..bf64a963b 100644 --- a/queries/ispc/indents.scm +++ b/queries/ispc/indents.scm @@ -1,7 +1,8 @@ ; inherits: c +((foreach_statement + body: (_) @_body) @indent.begin + (#not-has-type? @_body compound_statement)) -((foreach_statement body: (_) @_body) @indent.begin - (#not-has-type? @_body compound_statement)) - -((foreach_instance_statement body: (_) @_body) @indent.begin - (#not-has-type? @_body compound_statement)) +((foreach_instance_statement + body: (_) @_body) @indent.begin + (#not-has-type? @_body compound_statement)) diff --git a/queries/ispc/locals.scm b/queries/ispc/locals.scm index e2e5a9663..54e328083 100644 --- a/queries/ispc/locals.scm +++ b/queries/ispc/locals.scm @@ -1,17 +1,17 @@ ; inherits: c - (reference_declarator (identifier) @local.definition.var) (type_parameter_declaration (type_identifier) @local.definition.type) + (template_declaration) @local.scope (template_function name: (identifier) @local.definition.function) @local.scope [ - (foreach_statement) - (foreach_instance_statement) - (unmasked_statement) + (foreach_statement) + (foreach_instance_statement) + (unmasked_statement) ] @local.scope diff --git a/queries/janet_simple/folds.scm b/queries/janet_simple/folds.scm index 901641099..e316af4d5 100644 --- a/queries/janet_simple/folds.scm +++ b/queries/janet_simple/folds.scm @@ -1 +1,2 @@ -(source (par_tup_lit) @fold) +(source + (par_tup_lit) @fold) diff --git a/queries/janet_simple/highlights.scm b/queries/janet_simple/highlights.scm index c1408ec68..94614c7a2 100644 --- a/queries/janet_simple/highlights.scm +++ b/queries/janet_simple/highlights.scm @@ -1,61 +1,71 @@ -;; >> Literals - +; >> Literals (kwd_lit) @string.special.symbol + (str_lit) @string + (long_str_lit) @string + (buf_lit) @string + (long_buf_lit) @string + (num_lit) @number + (bool_lit) @boolean + (nil_lit) @constant.builtin -(comment) @comment @spell -["{" "@{" "}" - "[" "@[" "]" - "(" "@(" ")"] @punctuation.bracket +(comment) @comment @spell -;; >> Symbols +[ + "{" + "@{" + "}" + "[" + "@[" + "]" + "(" + "@(" + ")" +] @punctuation.bracket -;; General symbol highlighting +; >> Symbols +; General symbol highlighting (sym_lit) @variable -;; General function calls +; General function calls (par_tup_lit - . - (sym_lit) @function.call) + . + (sym_lit) @function.call) (short_fn_lit - . - (sym_lit) @function.call) - -;; Quoted symbols + . + (sym_lit) @function.call) +; Quoted symbols (quote_lit - (sym_lit) @string.special.symbol) + (sym_lit) @string.special.symbol) (qq_lit - (sym_lit) @string.special.symbol) - -;; Dynamic variables + (sym_lit) @string.special.symbol) +; Dynamic variables ((sym_lit) @variable.builtin - (#lua-match? @variable.builtin "^[*].+[*]$")) - -;; Comment + (#lua-match? @variable.builtin "^[*].+[*]$")) +; Comment ((sym_lit) @comment - (#any-of? @comment "comment")) - -;; Special forms and builtin macros -;; -;; # special forms were manually added at the beginning -;; -;; # for macros -;; (each name (all-bindings) -;; (when-let [info (dyn (symbol name))] -;; (when (info :macro) -;; (print name)))) + (#any-of? @comment "comment")) +; Special forms and builtin macros +; +; # special forms were manually added at the beginning +; +; # for macros +; (each name (all-bindings) +; (when-let [info (dyn (symbol name))] +; (when (info :macro) +; (print name)))) ((sym_lit) @function.macro ; format-ignore (#any-of? @function.macro @@ -105,15 +115,14 @@ "when" "when-let" "when-with" "with" "with-dyns" "with-syms" "with-vars")) -;; All builtin functions -;; -;; (each name (all-bindings) -;; (when-let [info (dyn (symbol name))] -;; (when (and (nil? (info :macro)) -;; (or (function? (info :value)) -;; (cfunction? (info :value)))) -;; (print name)))) - +; All builtin functions +; +; (each name (all-bindings) +; (when-let [info (dyn (symbol name))] +; (when (and (nil? (info :macro)) +; (or (function? (info :value)) +; (cfunction? (info :value)))) +; (print name)))) ((sym_lit) @function.builtin ; format-ignore (#any-of? @function.builtin @@ -301,4 +310,3 @@ "xprin" "xprinf" "xprint" "xprintf" "yield" "zero?" "zipcoll")) - diff --git a/queries/janet_simple/injections.scm b/queries/janet_simple/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/janet_simple/injections.scm +++ b/queries/janet_simple/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/java/highlights.scm b/queries/java/highlights.scm index 4ff56641d..ee36bf0bf 100644 --- a/queries/java/highlights.scm +++ b/queries/java/highlights.scm @@ -1,20 +1,17 @@ ; CREDITS @maxbrunsfeld (maxbrunsfeld@gmail.com) - ; Variables - (identifier) @variable ; Methods - (method_declaration name: (identifier) @function.method) + (method_invocation name: (identifier) @function.method.call) (super) @function.builtin ; Parameters - (formal_parameter name: (identifier) @variable.parameter) @@ -22,18 +19,17 @@ name: (identifier) @variable.parameter) (spread_parameter - (variable_declarator - name: (identifier) @variable.parameter)) ; int... foo + (variable_declarator + name: (identifier) @variable.parameter)) ; int... foo -;; Lambda parameter - -(inferred_parameters (identifier) @variable.parameter) ; (x,y) -> ... +; Lambda parameter +(inferred_parameters + (identifier) @variable.parameter) ; (x,y) -> ... (lambda_expression - parameters: (identifier) @variable.parameter) ; x -> ... + parameters: (identifier) @variable.parameter) ; x -> ... ; Operators - [ "+" ":" @@ -73,41 +69,51 @@ ] @operator ; Types - (interface_declaration name: (identifier) @type) + (annotation_type_declaration name: (identifier) @type) + (class_declaration name: (identifier) @type) + (record_declaration name: (identifier) @type) + (enum_declaration name: (identifier) @type) + (constructor_declaration name: (identifier) @type) + (type_identifier) @type + ((type_identifier) @type.builtin (#eq? @type.builtin "var")) + ((method_invocation object: (identifier) @type) - (#lua-match? @type "^[A-Z]")) + (#lua-match? @type "^[A-Z]")) + ((method_reference - . (identifier) @type) - (#lua-match? @type "^[A-Z]")) + . + (identifier) @type) + (#lua-match? @type "^[A-Z]")) ((field_access object: (identifier) @type) (#lua-match? @type "^[A-Z]")) + (scoped_identifier (identifier) @type (#lua-match? @type "^[A-Z]")) ; Fields - (field_declaration - declarator: (variable_declarator - name: (identifier) @variable.member)) + declarator: + (variable_declarator + name: (identifier) @variable.member)) (field_access field: (identifier) @variable.member) @@ -120,23 +126,21 @@ ] @type.builtin ; Variables - ((identifier) @constant (#lua-match? @constant "^[A-Z_][A-Z%d_]+$")) (this) @variable.builtin ; Annotations - (annotation "@" @attribute name: (identifier) @attribute) + (marker_annotation "@" @attribute name: (identifier) @attribute) ; Literals - (string_literal) @string (escape_sequence) @string.escape @@ -163,7 +167,6 @@ (null_literal) @constant.builtin ; Keywords - [ "assert" "class" @@ -211,12 +214,9 @@ "yield" ] @keyword.return -[ - "new" -] @keyword.operator +"new" @keyword.operator ; Conditionals - [ "if" "else" @@ -224,10 +224,13 @@ "case" ] @keyword.conditional -(ternary_expression ["?" ":"] @keyword.conditional.ternary) +(ternary_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) ; Loops - [ "for" "while" @@ -237,7 +240,6 @@ ] @keyword.repeat ; Includes - [ "exports" "import" @@ -250,7 +252,6 @@ ] @keyword.import ; Punctuation - [ ";" "." @@ -258,19 +259,40 @@ "," ] @punctuation.delimiter -[ "{" "}" ] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -(type_arguments [ "<" ">" ] @punctuation.bracket) -(type_parameters [ "<" ">" ] @punctuation.bracket) +(type_arguments + [ + "<" + ">" + ] @punctuation.bracket) -(string_interpolation [ "\\{" "}" ] @punctuation.special) +(type_parameters + [ + "<" + ">" + ] @punctuation.bracket) -; Exceptions +(string_interpolation + [ + "\\{" + "}" + ] @punctuation.special) +; Exceptions [ "throw" "throws" @@ -280,12 +302,10 @@ ] @keyword.exception ; Labels - (labeled_statement (identifier) @label) ; Comments - [ (line_comment) (block_comment) diff --git a/queries/java/indents.scm b/queries/java/indents.scm index 8ce928eb8..9e4d0a5e1 100644 --- a/queries/java/indents.scm +++ b/queries/java/indents.scm @@ -15,7 +15,8 @@ (element_value_array_initializer) ; { a, b } inside @Annotation() ] @indent.begin -(expression_statement (method_invocation) @indent.begin) +(expression_statement + (method_invocation) @indent.begin) [ "(" @@ -26,7 +27,9 @@ "]" ] @indent.branch -(annotation_argument_list ")" @indent.end) ; This should be a special cased as `()` here doesn't have ending `;` +(annotation_argument_list + ")" @indent.end) ; This should be a special cased as `()` here doesn't have ending `;` + "}" @indent.end (line_comment) @indent.ignore @@ -35,4 +38,3 @@ (ERROR) (block_comment) ] @indent.auto - diff --git a/queries/java/injections.scm b/queries/java/injections.scm index 8696c16ff..59e1be02b 100644 --- a/queries/java/injections.scm +++ b/queries/java/injections.scm @@ -1,8 +1,8 @@ ([ (block_comment) (line_comment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) ((block_comment) @injection.content (#lua-match? @injection.content "/[*][!<*][^a-zA-Z]") @@ -10,7 +10,11 @@ ((method_invocation name: (identifier) @_method - arguments: (argument_list - . (string_literal . (_) @injection.content))) - (#any-of? @_method "format" "printf") - (#set! injection.language "printf")) + arguments: + (argument_list + . + (string_literal + . + (_) @injection.content))) + (#any-of? @_method "format" "printf") + (#set! injection.language "printf")) diff --git a/queries/java/locals.scm b/queries/java/locals.scm index 5de5f5ff5..ac0715c93 100644 --- a/queries/java/locals.scm +++ b/queries/java/locals.scm @@ -1,56 +1,62 @@ -;; SCOPES - +; SCOPES ; declarations - (program) @local.scope + (class_declaration body: (_) @local.scope) + (record_declaration body: (_) @local.scope) + (enum_declaration body: (_) @local.scope) + (lambda_expression) @local.scope + (enhanced_for_statement) @local.scope ; block - (block) @local.scope ; if/else - (if_statement) @local.scope ; if+else + (if_statement consequence: (_) @local.scope) ; if body in case there are no braces + (if_statement alternative: (_) @local.scope) ; else body in case there are no braces ; try/catch - (try_statement) @local.scope ; covers try+catch, individual try and catch are covered by (block) + (catch_clause) @local.scope ; needed because `Exception` variable ; loops - (for_statement) @local.scope ; whole for_statement because loop iterator variable -(for_statement ; "for" body in case there are no braces + +(for_statement + ; "for" body in case there are no braces body: (_) @local.scope) + (do_statement body: (_) @local.scope) + (while_statement body: (_) @local.scope) ; Functions - (constructor_declaration) @local.scope -(method_declaration) @local.scope -;; DEFINITIONS +(method_declaration) @local.scope +; DEFINITIONS (package_declaration (identifier) @local.definition.namespace) (class_declaration name: (identifier) @local.definition.type) + (record_declaration name: (identifier) @local.definition.type) @@ -61,30 +67,36 @@ name: (identifier) @local.definition.method) (local_variable_declaration - declarator: (variable_declarator - name: (identifier) @local.definition.var)) -(enhanced_for_statement ; for (var item : items) { + declarator: + (variable_declarator + name: (identifier) @local.definition.var)) + +(enhanced_for_statement + ; for (var item : items) { name: (identifier) @local.definition.var) (formal_parameter name: (identifier) @local.definition.parameter) + (catch_formal_parameter name: (identifier) @local.definition.parameter) -(inferred_parameters (identifier) @local.definition.parameter) ; (x,y) -> ... +(inferred_parameters + (identifier) @local.definition.parameter) ; (x,y) -> ... + (lambda_expression - parameters: (identifier) @local.definition.parameter) ; x -> ... + parameters: (identifier) @local.definition.parameter) ; x -> ... ((scoped_identifier (identifier) @local.definition.import) - (#has-ancestor? @local.definition.import import_declaration)) + (#has-ancestor? @local.definition.import import_declaration)) (field_declaration - declarator: (variable_declarator - name: (identifier) @local.definition.field)) - -;; REFERENCES + declarator: + (variable_declarator + name: (identifier) @local.definition.field)) +; REFERENCES (identifier) @local.reference (type_identifier) @local.reference diff --git a/queries/javascript/highlights.scm b/queries/javascript/highlights.scm index e757dd2bd..9b166d1fd 100644 --- a/queries/javascript/highlights.scm +++ b/queries/javascript/highlights.scm @@ -1,55 +1,55 @@ ; inherits: ecma,jsx - -;;; Parameters -(formal_parameters (identifier) @variable.parameter) +; Parameters +(formal_parameters + (identifier) @variable.parameter) (formal_parameters (rest_pattern (identifier) @variable.parameter)) -;; ({ a }) => null +; ({ a }) => null (formal_parameters (object_pattern (shorthand_property_identifier_pattern) @variable.parameter)) -;; ({ a = b }) => null +; ({ a = b }) => null (formal_parameters (object_pattern (object_assignment_pattern (shorthand_property_identifier_pattern) @variable.parameter))) -;; ({ a: b }) => null +; ({ a: b }) => null (formal_parameters (object_pattern (pair_pattern value: (identifier) @variable.parameter))) -;; ([ a ]) => null +; ([ a ]) => null (formal_parameters (array_pattern (identifier) @variable.parameter)) -;; ({ a } = { a }) => null +; ({ a } = { a }) => null (formal_parameters (assignment_pattern (object_pattern (shorthand_property_identifier_pattern) @variable.parameter))) -;; ({ a = b } = { a }) => null +; ({ a = b } = { a }) => null (formal_parameters (assignment_pattern (object_pattern (object_assignment_pattern (shorthand_property_identifier_pattern) @variable.parameter)))) -;; a => null +; a => null (arrow_function parameter: (identifier) @variable.parameter) -;; optional parameters +; optional parameters (formal_parameters (assignment_pattern left: (identifier) @variable.parameter)) -;; punctuation +; punctuation (optional_chain) @punctuation.delimiter diff --git a/queries/javascript/locals.scm b/queries/javascript/locals.scm index 278702dfc..8c8d82363 100644 --- a/queries/javascript/locals.scm +++ b/queries/javascript/locals.scm @@ -1,19 +1,23 @@ ; inherits: ecma,jsx - ; Both properties are matched here. ; ; class Foo { ; this.#bar = "baz"; ; this.quuz = "qux"; ; } -(field_definition - property: [(property_identifier) (private_property_identifier)] @local.definition.var) +(field_definition + property: + [ + (property_identifier) + (private_property_identifier) + ] @local.definition.var) ; this.foo = "bar" (assignment_expression - left: (member_expression - object: (this) - property: (property_identifier) @local.definition.var)) + left: + (member_expression + object: (this) + property: (property_identifier) @local.definition.var)) (formal_parameters (identifier) @local.definition.parameter) @@ -27,18 +31,18 @@ (arrow_function parameter: (identifier) @local.definition.parameter) -;; ({ a }) => null +; ({ a }) => null (formal_parameters (object_pattern (shorthand_property_identifier_pattern) @local.definition.parameter)) -;; ({ a: b }) => null +; ({ a: b }) => null (formal_parameters (object_pattern (pair_pattern value: (identifier) @local.definition.parameter))) -;; ([ a ]) => null +; ([ a ]) => null (formal_parameters (array_pattern (identifier) @local.definition.parameter)) @@ -54,8 +58,11 @@ ; baz(y) { y } ; } (method_definition - ([(property_identifier) (private_property_identifier)] @local.definition.function) - (#set! definition.var.scope parent)) + ([ + (property_identifier) + (private_property_identifier) + ] @local.definition.function) + (#set! definition.var.scope parent)) ; this.foo() (member_expression diff --git a/queries/jq/highlights.scm b/queries/jq/highlights.scm index 968ba87a0..d7c42a96c 100644 --- a/queries/jq/highlights.scm +++ b/queries/jq/highlights.scm @@ -1,61 +1,59 @@ ; Variables - (variable) @variable ((variable) @constant.builtin - (#eq? @constant.builtin "$ENV")) + (#eq? @constant.builtin "$ENV")) ((variable) @constant.macro - (#eq? @constant.macro "$__loc__")) + (#eq? @constant.macro "$__loc__")) ; Properties - (index - (identifier) @property) + (identifier) @property) ; Labels - (query - label: (variable) @label) + label: (variable) @label) (query - break_statement: (variable) @label) + break_statement: (variable) @label) ; Literals - (number) @number (string) @string [ - "true" - "false" + "true" + "false" ] @boolean ("null") @type.builtin ; Interpolation - -["\\(" ")"] @character.special +[ + "\\(" + ")" +] @character.special ; Format - (format) @attribute ; Functions - (funcdef - (identifier) @function) + (identifier) @function) (funcdefargs - (identifier) @variable.parameter) + (identifier) @variable.parameter) [ "reduce" "foreach" ] @function.builtin -((funcname) @function.call . "(") +((funcname) @function.call + . + "(") ; jq -n 'builtins | map(split("/")[0]) | unique | .[]' ((funcname) @function.builtin @@ -251,9 +249,7 @@ "y0" "y1" "yn")) - ; Keywords - [ "def" "as" @@ -286,7 +282,6 @@ ] @keyword.operator ; Operators - [ "." "==" @@ -315,7 +310,6 @@ ] @operator ; Punctuation - [ ";" "," @@ -323,11 +317,13 @@ ] @punctuation.delimiter [ - "[" "]" - "{" "}" - "(" ")" + "[" + "]" + "{" + "}" + "(" + ")" ] @punctuation.bracket ; Comments - (comment) @comment @spell diff --git a/queries/jq/injections.scm b/queries/jq/injections.scm index 072d38e24..740af735e 100644 --- a/queries/jq/injections.scm +++ b/queries/jq/injections.scm @@ -1,36 +1,22 @@ -((comment) @injection.content (#set! injection.language "comment")) - +((comment) @injection.content + (#set! injection.language "comment")) ; test(val) (query ((funcname) @_function - (#any-of? @_function - "test" - "match" - "capture" - "scan" - "split" - "splits" - "sub" - "gsub")) - (args . - (query + (#any-of? @_function "test" "match" "capture" "scan" "split" "splits" "sub" "gsub")) + (args + . + (query (string) @injection.content (#set! injection.language "regex")))) - ; test(regex; flags) (query ((funcname) @_function - (#any-of? @_function - "test" - "match" - "capture" - "scan" - "split" - "splits" - "sub" - "gsub")) - (args . (args - (query - (string) @injection.content - (#set! injection.language "regex"))))) + (#any-of? @_function "test" "match" "capture" "scan" "split" "splits" "sub" "gsub")) + (args + . + (args + (query + (string) @injection.content + (#set! injection.language "regex"))))) diff --git a/queries/jq/locals.scm b/queries/jq/locals.scm index 369bcb4eb..0b8a0997d 100644 --- a/queries/jq/locals.scm +++ b/queries/jq/locals.scm @@ -1,7 +1,10 @@ -(funcdef (identifier) @local.definition.function) +(funcdef + (identifier) @local.definition.function) -(funcdefargs (identifier) @local.definition.parameter) +(funcdefargs + (identifier) @local.definition.parameter) (funcname) @local.reference -(index (identifier) @local.reference) +(index + (identifier) @local.reference) diff --git a/queries/jsdoc/highlights.scm b/queries/jsdoc/highlights.scm index 4b4266c9f..fcba0c188 100644 --- a/queries/jsdoc/highlights.scm +++ b/queries/jsdoc/highlights.scm @@ -1,2 +1,3 @@ (tag_name) @keyword + (type) @type diff --git a/queries/json/highlights.scm b/queries/json/highlights.scm index 36c8f7a10..17365ed34 100644 --- a/queries/json/highlights.scm +++ b/queries/json/highlights.scm @@ -1,28 +1,38 @@ [ - (true) - (false) + (true) + (false) ] @boolean (null) @constant.builtin (number) @number -(pair key: (string) @label) -(pair value: (string) @string) +(pair + key: (string) @label) -(array (string) @string) +(pair + value: (string) @string) -["," ":"] @punctuation.delimiter +(array + (string) @string) [ - "[" "]" - "{" "}" + "," + ":" +] @punctuation.delimiter + +[ + "[" + "]" + "{" + "}" ] @punctuation.bracket (("\"" @conceal) - (#set! conceal "")) + (#set! conceal "")) (escape_sequence) @string.escape + ((escape_sequence) @conceal - (#eq? @conceal "\\\"") - (#set! conceal "\"")) + (#eq? @conceal "\\\"") + (#set! conceal "\"")) diff --git a/queries/json5/highlights.scm b/queries/json5/highlights.scm index 6d53c7bfc..4ffe311c4 100644 --- a/queries/json5/highlights.scm +++ b/queries/json5/highlights.scm @@ -12,4 +12,4 @@ (comment) @comment @spell (member - name: (_) @keyword) + name: (_) @keyword) diff --git a/queries/json5/injections.scm b/queries/json5/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/json5/injections.scm +++ b/queries/json5/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/jsonc/highlights.scm b/queries/jsonc/highlights.scm index e50112155..763cd5998 100644 --- a/queries/jsonc/highlights.scm +++ b/queries/jsonc/highlights.scm @@ -1,3 +1,2 @@ ; inherits: json - (comment) @comment @spell diff --git a/queries/jsonc/indents.scm b/queries/jsonc/indents.scm index 3b01ca999..350f670a0 100644 --- a/queries/jsonc/indents.scm +++ b/queries/jsonc/indents.scm @@ -1,3 +1,2 @@ ; inherits: json - (comment) @indent.ignore diff --git a/queries/jsonc/injections.scm b/queries/jsonc/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/jsonc/injections.scm +++ b/queries/jsonc/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/jsonnet/folds.scm b/queries/jsonnet/folds.scm index 9243ccfde..91257a790 100644 --- a/queries/jsonnet/folds.scm +++ b/queries/jsonnet/folds.scm @@ -1,10 +1,10 @@ [ - (field) - (object) - (array) - (parenthesis) - (bind) -; (params) -; (args) -; (conditional) + (field) + (object) + (array) + (parenthesis) + (bind) + ; (params) + ; (args) + ; (conditional) ] @fold diff --git a/queries/jsonnet/highlights.scm b/queries/jsonnet/highlights.scm index c8eb38fcc..acd838cbe 100644 --- a/queries/jsonnet/highlights.scm +++ b/queries/jsonnet/highlights.scm @@ -1,10 +1,14 @@ (id) @variable + (comment) @comment @spell ; Literals (null) @constant.builtin + (string) @string + (number) @number + [ (true) (false) @@ -12,7 +16,9 @@ ; Keywords "for" @keyword.repeat + "in" @keyword.operator + "function" @keyword.function [ @@ -37,8 +43,9 @@ (self) (super) ] @variable.builtin + ((id) @variable.builtin - (#eq? @variable.builtin "std")) + (#eq? @variable.builtin "std")) ; Operators [ @@ -78,7 +85,8 @@ ] @punctuation.special (field - (fieldname) "+" @punctuation.special) + (fieldname) + "+" @punctuation.special) ; Imports [ @@ -87,21 +95,33 @@ ] @keyword.import ; Fields +(fieldname + (id) @variable.member) -(fieldname (id) @variable.member) -(fieldname (string (string_content) @variable.member)) +(fieldname + (string + (string_content) @variable.member)) ; Functions (field - function: (fieldname (id) @function)) + function: + (fieldname + (id) @function)) + (field - function: (fieldname - (string (string_content) @function))) + function: + (fieldname + (string + (string_content) @function))) + (param identifier: (id) @variable.parameter) -(bind (id) @variable.local) -(bind function: (id) @function) +(bind + (id) @variable.local) + +(bind + function: (id) @function) ; Function call (functioncall @@ -113,6 +133,5 @@ "(" (args (named_argument - (id) @variable.parameter - ))? + (id) @variable.parameter))? ")") diff --git a/queries/jsonnet/locals.scm b/queries/jsonnet/locals.scm index 583c89e03..ca03ef077 100644 --- a/queries/jsonnet/locals.scm +++ b/queries/jsonnet/locals.scm @@ -1,17 +1,28 @@ (parenthesis) @local.scope + (anonymous_function) @local.scope + (object) @local.scope + (field) @local.scope + (local_bind) @local.scope (field - function: (fieldname (id) @local.definition.function) + function: + (fieldname + (id) @local.definition.function) (#set! "definition.function.scope" "parent")) -(bind (id) @local.definition.var) -(bind function: (id) @local.definition.function) +(bind + (id) @local.definition.var) + +(bind + function: (id) @local.definition.function) -(param (id) @local.definition.parameter) +(param + (id) @local.definition.parameter) (id) @local.reference + ;(fieldname (id) (#is-not? local)) ; (#is-not?) not supported yet diff --git a/queries/jsx/highlights.scm b/queries/jsx/highlights.scm index 718add87f..d99ae62ec 100644 --- a/queries/jsx/highlights.scm +++ b/queries/jsx/highlights.scm @@ -1,9 +1,27 @@ (jsx_element - open_tag: (jsx_opening_element ["<" ">"] @tag.delimiter)) + open_tag: + (jsx_opening_element + [ + "<" + ">" + ] @tag.delimiter)) + (jsx_element - close_tag: (jsx_closing_element ["</" ">"] @tag.delimiter)) -(jsx_self_closing_element ["<" "/>"] @tag.delimiter) -(jsx_attribute (property_identifier) @tag.attribute) + close_tag: + (jsx_closing_element + [ + "</" + ">" + ] @tag.delimiter)) + +(jsx_self_closing_element + [ + "<" + "/>" + ] @tag.delimiter) + +(jsx_attribute + (property_identifier) @tag.attribute) (jsx_opening_element name: (identifier) @tag) @@ -14,22 +32,34 @@ (jsx_self_closing_element name: (identifier) @tag) -(jsx_opening_element ((identifier) @constructor - (#lua-match? @constructor "^[A-Z]"))) +(jsx_opening_element + ((identifier) @constructor + (#lua-match? @constructor "^[A-Z]"))) ; Handle the dot operator effectively - <My.Component> -(jsx_opening_element ((member_expression (identifier) @tag (property_identifier) @constructor))) +(jsx_opening_element + ((member_expression + (identifier) @tag + (property_identifier) @constructor))) -(jsx_closing_element ((identifier) @constructor - (#lua-match? @constructor "^[A-Z]"))) +(jsx_closing_element + ((identifier) @constructor + (#lua-match? @constructor "^[A-Z]"))) ; Handle the dot operator effectively - </My.Component> -(jsx_closing_element ((member_expression (identifier) @tag (property_identifier) @constructor))) +(jsx_closing_element + ((member_expression + (identifier) @tag + (property_identifier) @constructor))) -(jsx_self_closing_element ((identifier) @constructor - (#lua-match? @constructor "^[A-Z]"))) +(jsx_self_closing_element + ((identifier) @constructor + (#lua-match? @constructor "^[A-Z]"))) ; Handle the dot operator effectively - <My.Component /> -(jsx_self_closing_element ((member_expression (identifier) @tag (property_identifier) @constructor))) +(jsx_self_closing_element + ((member_expression + (identifier) @tag + (property_identifier) @constructor))) (jsx_text) @none diff --git a/queries/jsx/indents.scm b/queries/jsx/indents.scm index c0dd53281..eed9afeba 100644 --- a/queries/jsx/indents.scm +++ b/queries/jsx/indents.scm @@ -4,13 +4,18 @@ (jsx_expression) ] @indent.begin -(jsx_closing_element (">" @indent.end)) -(jsx_self_closing_element "/>" @indent.end) +(jsx_closing_element + (">" @indent.end)) + +(jsx_self_closing_element + "/>" @indent.end) [ (jsx_closing_element) ">" ] @indent.branch + ; <button ; /> -(jsx_self_closing_element "/>" @indent.branch) +(jsx_self_closing_element + "/>" @indent.branch) diff --git a/queries/jsx/injections.scm b/queries/jsx/injections.scm index e20408a66..269ee3fff 100644 --- a/queries/jsx/injections.scm +++ b/queries/jsx/injections.scm @@ -1,9 +1,11 @@ ; Styled Jsx <style jsx> (jsx_element (jsx_opening_element - (identifier) @_name (#eq? @_name "style") - (jsx_attribute) @_attr (#eq? @_attr "jsx")) - (jsx_expression - ((template_string) @injection.content - (#set! injection.language "css")) - (#offset! @injection.content 0 1 0 -1))) + (identifier) @_name + (#eq? @_name "style") + (jsx_attribute) @_attr + (#eq? @_attr "jsx")) + (jsx_expression + ((template_string) @injection.content + (#set! injection.language "css")) + (#offset! @injection.content 0 1 0 -1))) diff --git a/queries/julia/folds.scm b/queries/julia/folds.scm index 617182155..2cbdc2815 100644 --- a/queries/julia/folds.scm +++ b/queries/julia/folds.scm @@ -3,15 +3,12 @@ (struct_definition) (macro_definition) (function_definition) - (if_statement) (try_statement) (for_statement) (while_statement) (let_statement) (quote_statement) - (do_clause) (compound_statement) ] @fold - diff --git a/queries/julia/highlights.scm b/queries/julia/highlights.scm index 21ae1adb0..74b2b8fca 100644 --- a/queries/julia/highlights.scm +++ b/queries/julia/highlights.scm @@ -1,12 +1,11 @@ -;;; Identifiers - +; Identifiers (identifier) @variable ; ;; If you want type highlighting based on Julia naming conventions (this might collide with mathematical notation) ; ((identifier) @type ; (match? @type "^[A-Z][^_]")) ; exception: Highlight `A_foo` sort of identifiers as variables - (macro_identifier) @function.macro + (macro_identifier (identifier) @function.macro) ; for any one using the variable highlight @@ -15,37 +14,46 @@ (quote_expression ":" @string.special.symbol - [(identifier) (operator)] @string.special.symbol) + [ + (identifier) + (operator) + ] @string.special.symbol) (field_expression (identifier) @variable.member .) - -;;; Function names - -;; Definitions - +; Function names +; Definitions (function_definition name: (identifier) @function) + (short_function_definition name: (identifier) @function) (function_definition - name: (field_expression (identifier) @function .)) -(short_function_definition - name: (field_expression (identifier) @function .)) + name: + (field_expression + (identifier) @function .)) -;; calls +(short_function_definition + name: + (field_expression + (identifier) @function .)) +; calls (call_expression (identifier) @function.call) + (call_expression - (field_expression (identifier) @function.call .)) + (field_expression + (identifier) @function.call .)) (broadcast_call_expression (identifier) @function.call) + (broadcast_call_expression - (field_expression (identifier) @function.call .)) + (field_expression + (identifier) @function.call .)) (binary_expression (_) @@ -53,24 +61,18 @@ (identifier) @function.call (#eq? @_pipe "|>")) -;; Builtins - +; Builtins ((identifier) @function.builtin - (#any-of? @function.builtin - "_abstracttype" "_apply_iterate" "_apply_pure" "_call_in_world" "_call_in_world_total" - "_call_latest" "_equiv_typedef" "_expr" "_primitivetype" "_setsuper!" "_structtype" - "_typebody!" "_typevar" "applicable" "apply_type" "arrayref" "arrayset" "arraysize" - "const_arrayref" "donotdelete" "fieldtype" "get_binding_type" "getfield" "ifelse" "invoke" "isa" - "isdefined" "modifyfield!" "nfields" "replacefield!" "set_binding_type!" "setfield!" "sizeof" - "svec" "swapfield!" "throw" "tuple" "typeassert" "typeof")) - - -;;; Parameters + (#any-of? @function.builtin "_abstracttype" "_apply_iterate" "_apply_pure" "_call_in_world" "_call_in_world_total" "_call_latest" "_equiv_typedef" "_expr" "_primitivetype" "_setsuper!" "_structtype" "_typebody!" "_typevar" "applicable" "apply_type" "arrayref" "arrayset" "arraysize" "const_arrayref" "donotdelete" "fieldtype" "get_binding_type" "getfield" "ifelse" "invoke" "isa" "isdefined" "modifyfield!" "nfields" "replacefield!" "set_binding_type!" "setfield!" "sizeof" "svec" "swapfield!" "throw" "tuple" "typeassert" "typeof")) +; Parameters (parameter_list (identifier) @variable.parameter) -(optional_parameter . + +(optional_parameter + . (identifier) @variable.parameter) + (slurp_parameter (identifier) @variable.parameter) @@ -79,28 +81,32 @@ type: (_) @type) (function_expression - . (identifier) @variable.parameter) ; Single parameter arrow functions - - -;;; Types - -;; Definitions + . + (identifier) @variable.parameter) ; Single parameter arrow functions +; Types +; Definitions (abstract_definition name: (identifier) @type.definition) @keyword + (primitive_definition name: (identifier) @type.definition) @keyword + (struct_definition name: (identifier) @type) -(type_clause - [(identifier) @type - (field_expression (identifier) @type .)]) -;; Annotations +(type_clause + [ + (identifier) @type + (field_expression + (identifier) @type .) + ]) +; Annotations (parametrized_type_expression (_) @type - (curly_expression (_) @type)) + (curly_expression + (_) @type)) (type_parameter_list (identifier) @type) @@ -110,22 +116,24 @@ (function_definition return_type: (identifier) @type) + (short_function_definition return_type: (identifier) @type) (where_clause (identifier) @type) -(where_clause - (curly_expression (_) @type)) -;; Builtins +(where_clause + (curly_expression + (_) @type)) -;; This list was generated with: -;; -;; istype(x) = typeof(x) === DataType || typeof(x) === UnionAll -;; get_types(m) = filter(x -> istype(Base.eval(m, x)), names(m)) -;; type_names = sort(union(get_types(Core), get_types(Base))) -;; +; Builtins +; This list was generated with: +; +; istype(x) = typeof(x) === DataType || typeof(x) === UnionAll +; get_types(m) = filter(x -> istype(Base.eval(m, x)), names(m)) +; type_names = sort(union(get_types(Core), get_types(Base))) +; ((identifier) @type.builtin ; format-ignore (#any-of? @type.builtin @@ -347,71 +355,129 @@ (#any-of? @variable.builtin "begin" "end") (#has-ancestor? @variable.builtin range_expression)) -;;; Keywords - +; Keywords [ "global" "local" ] @keyword - (compound_statement - ["begin" "end"] @keyword) + [ + "begin" + "end" + ] @keyword) + (quote_statement - ["quote" "end"] @keyword) + [ + "quote" + "end" + ] @keyword) + (let_statement - ["let" "end"] @keyword) + [ + "let" + "end" + ] @keyword) (if_statement - ["if" "end"] @keyword.conditional) + [ + "if" + "end" + ] @keyword.conditional) + (elseif_clause "elseif" @keyword.conditional) + (else_clause "else" @keyword.conditional) + (if_clause "if" @keyword.conditional) ; `if` clause in comprehensions + (ternary_expression - ["?" ":"] @keyword.conditional.ternary) + [ + "?" + ":" + ] @keyword.conditional.ternary) (try_statement - ["try" "end"] @keyword.exception) + [ + "try" + "end" + ] @keyword.exception) + (finally_clause "finally" @keyword.exception) + (catch_clause "catch" @keyword.exception) (for_statement - ["for" "end"] @keyword.repeat) + [ + "for" + "end" + ] @keyword.repeat) + (while_statement - ["while" "end"] @keyword.repeat) + [ + "while" + "end" + ] @keyword.repeat) + (for_clause "for" @keyword.repeat) + [ (break_statement) (continue_statement) ] @keyword.repeat (module_definition - ["module" "baremodule" "end"] @keyword.import) + [ + "module" + "baremodule" + "end" + ] @keyword.import) + (import_statement - ["import" "using"] @keyword.import) + [ + "import" + "using" + ] @keyword.import) + (import_alias "as" @keyword.import) + (export_statement "export" @keyword.import) + (selected_import ":" @punctuation.delimiter) (struct_definition - ["struct" "end"] @keyword) + [ + "struct" + "end" + ] @keyword) (macro_definition - ["macro" "end"] @keyword) + [ + "macro" + "end" + ] @keyword) (function_definition - ["function" "end"] @keyword.function) + [ + "function" + "end" + ] @keyword.function) + (do_clause - ["do" "end"] @keyword.function) + [ + "do" + "end" + ] @keyword.function) + (return_statement "return" @keyword.return) @@ -420,25 +486,30 @@ "mutable" ] @type.qualifier - -;;; Operators & Punctuation - +; Operators & Punctuation [ "=" "∈" (operator) ] @operator -(adjoint_expression "'" @operator) -(range_expression ":" @operator) +(adjoint_expression + "'" @operator) + +(range_expression + ":" @operator) ((operator) @keyword.operator (#any-of? @keyword.operator "in" "isa")) -(for_binding "in" @keyword.operator) +(for_binding + "in" @keyword.operator) + +(where_clause + "where" @keyword.operator) -(where_clause "where" @keyword.operator) -(where_expression "where" @keyword.operator) +(where_expression + "where" @keyword.operator) [ "," @@ -448,50 +519,57 @@ "->" ] @punctuation.delimiter -[ - "..." -] @punctuation.special - -["(" ")" "[" "]" "{" "}"] @punctuation.bracket - +"..." @punctuation.special -;;; Literals +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket +; Literals (boolean_literal) @boolean + (integer_literal) @number + (float_literal) @number.float ((identifier) @number.float - (#any-of? @number.float "NaN" "NaN16" "NaN32" - "Inf" "Inf16" "Inf32")) + (#any-of? @number.float "NaN" "NaN16" "NaN32" "Inf" "Inf16" "Inf32")) ((identifier) @constant.builtin (#any-of? @constant.builtin "nothing" "missing")) (character_literal) @character + (escape_sequence) @string.escape (string_literal) @string + (prefixed_string_literal prefix: (identifier) @function.macro) @string (command_literal) @string.special + (prefixed_command_literal prefix: (identifier) @function.macro) @string.special ((string_literal) @string.documentation @spell - . [ - (module_definition) - (abstract_definition) - (struct_definition) - (function_definition) - (short_function_definition) - (assignment) - (const_statement) - ]) + . + [ + (module_definition) + (abstract_definition) + (struct_definition) + (function_definition) + (short_function_definition) + (assignment) + (const_statement) + ]) [ (line_comment) (block_comment) ] @comment @spell - diff --git a/queries/julia/indents.scm b/queries/julia/indents.scm index e1ea1f719..bf4932ec3 100644 --- a/queries/julia/indents.scm +++ b/queries/julia/indents.scm @@ -2,7 +2,6 @@ (struct_definition) (macro_definition) (function_definition) - (compound_statement) (if_statement) (try_statement) @@ -11,13 +10,10 @@ (let_statement) (quote_statement) (do_clause) - (assignment) (for_binding) - (call_expression) (parenthesized_expression) - (tuple_expression) (comprehension_expression) (matrix_expression) diff --git a/queries/julia/injections.scm b/queries/julia/injections.scm index 82e1503fc..07af15a11 100644 --- a/queries/julia/injections.scm +++ b/queries/julia/injections.scm @@ -1,6 +1,7 @@ -;; Inject markdown in docstrings +; Inject markdown in docstrings ((string_literal) @injection.content - . [ + . + [ (module_definition) (abstract_definition) (struct_definition) @@ -9,18 +10,18 @@ (assignment) (const_statement) ] - (#lua-match? @injection.content "^\"\"\"") - (#set! injection.language "markdown") - (#offset! @injection.content 0 3 0 -3)) + (#lua-match? @injection.content "^\"\"\"") + (#set! injection.language "markdown") + (#offset! @injection.content 0 3 0 -3)) ([ (line_comment) (block_comment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) ((prefixed_string_literal - prefix: (identifier) @_prefix) @injection.content - (#eq? @_prefix "r") - (#set! injection.language "regex") - (#offset! @injection.content 0 2 0 -1)) + prefix: (identifier) @_prefix) @injection.content + (#eq? @_prefix "r") + (#set! injection.language "regex") + (#offset! @injection.content 0 2 0 -1)) diff --git a/queries/julia/locals.scm b/queries/julia/locals.scm index 9e607cfd1..3e7654b06 100644 --- a/queries/julia/locals.scm +++ b/queries/julia/locals.scm @@ -1,50 +1,52 @@ -;;; Variables +; Variables (assignment (identifier) @local.definition.var) + (assignment (tuple_expression (identifier) @local.definition.var)) -;;; let/const bindings -(let_binding - (identifier) @local.definition.var) +; let/const bindings (let_binding - (tuple_expression - (identifier) @local.definition.var)) + (identifier) @local.definition.var) +(let_binding + (tuple_expression + (identifier) @local.definition.var)) -;;; For bindings +; For bindings (for_binding (identifier) @local.definition.var) + (for_binding (tuple_expression (identifier) @local.definition.var)) - -;;; Types - +; Types (struct_definition name: (identifier) @local.definition.type) + (abstract_definition name: (identifier) @local.definition.type) + (abstract_definition name: (identifier) @local.definition.type) (type_parameter_list (identifier) @local.definition.type) -;;; Module imports - +; Module imports (import_statement (identifier) @local.definition.import) - -;;; Parameters - +; Parameters (parameter_list (identifier) @local.definition.parameter) -(optional_parameter . + +(optional_parameter + . (identifier) @local.definition.parameter) + (slurp_parameter (identifier) @local.definition.parameter) @@ -52,18 +54,19 @@ parameter: (identifier) @local.definition.parameter (_)) -;; Single parameter arrow function +; Single parameter arrow function (function_expression - . (identifier) @local.definition.parameter) - - -;;; Function/macro definitions + . + (identifier) @local.definition.parameter) +; Function/macro definitions (function_definition name: (identifier) @local.definition.function) @local.scope + (short_function_definition name: (identifier) @local.definition.function) @local.scope -(macro_definition + +(macro_definition name: (identifier) @local.definition.macro) @local.scope (identifier) @local.reference diff --git a/queries/kconfig/highlights.scm b/queries/kconfig/highlights.scm index d2db087ce..1cea0832c 100644 --- a/queries/kconfig/highlights.scm +++ b/queries/kconfig/highlights.scm @@ -51,9 +51,16 @@ "string" ] @type.builtin -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -(macro_variable ["$(" ")"] @punctuation.special) +(macro_variable + [ + "$(" + ")" + ] @punctuation.special) (symbol) @variable @@ -63,17 +70,28 @@ (text) ] @string -(config name: (symbol) @constant) -(menuconfig name: (symbol) @constant) -(choice name: (symbol) @constant) +(config + name: (symbol) @constant) + +(menuconfig + name: (symbol) @constant) + +(choice + name: (symbol) @constant) ((symbol) @constant (#lua-match? @constant "[A-Z0-9]+")) -(mainmenu name: (prompt) @markup.heading) -(comment_entry name: (prompt) @markup.heading) -(menu name: (prompt) @markup.heading) +(mainmenu + name: (prompt) @markup.heading) + +(comment_entry + name: (prompt) @markup.heading) + +(menu + name: (prompt) @markup.heading) -(source (prompt) @string.special.url) +(source + (prompt) @string.special.url) (comment) @comment @spell diff --git a/queries/kconfig/indents.scm b/queries/kconfig/indents.scm index 77f02e1f6..faa83602f 100644 --- a/queries/kconfig/indents.scm +++ b/queries/kconfig/indents.scm @@ -1,4 +1,5 @@ -(help_text (text) @indent.auto) +(help_text + (text) @indent.auto) [ (config) diff --git a/queries/kconfig/locals.scm b/queries/kconfig/locals.scm index cce3a7f0e..1fc1b30a7 100644 --- a/queries/kconfig/locals.scm +++ b/queries/kconfig/locals.scm @@ -12,6 +12,13 @@ (if) ] @local.scope -(type_definition (prompt) @local.definition.var) -(type_definition (input_prompt (prompt) @local.definition.var)) -(type_definition_default (expression (prompt) @local.definition.var)) +(type_definition + (prompt) @local.definition.var) + +(type_definition + (input_prompt + (prompt) @local.definition.var)) + +(type_definition_default + (expression + (prompt) @local.definition.var)) diff --git a/queries/kdl/folds.scm b/queries/kdl/folds.scm index 81acf643e..c96619b14 100644 --- a/queries/kdl/folds.scm +++ b/queries/kdl/folds.scm @@ -1,5 +1,4 @@ ; Folds - [ (node) (node_children) diff --git a/queries/kdl/highlights.scm b/queries/kdl/highlights.scm index 5aafdeca3..d15845e13 100644 --- a/queries/kdl/highlights.scm +++ b/queries/kdl/highlights.scm @@ -1,58 +1,70 @@ ; Types - -(node (identifier) @type) +(node + (identifier) @type) (type) @type (annotation_type) @type.builtin ; Properties - -(prop (identifier) @property) +(prop + (identifier) @property) ; Variables - (identifier) @variable ; Operators [ - "=" - "+" - "-" + "=" + "+" + "-" ] @operator ; Literals - (string) @string (escape) @string.escape (number) @number -(number (decimal) @number.float) -(number (exponent) @number.float) +(number + (decimal) @number.float) + +(number + (exponent) @number.float) (boolean) @boolean "null" @constant.builtin ; Punctuation - -["{" "}"] @punctuation.bracket - -["(" ")"] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket [ - ";" -] @punctuation.delimiter + "(" + ")" +] @punctuation.bracket -; Comments +";" @punctuation.delimiter +; Comments [ (single_line_comment) (multi_line_comment) ] @comment @spell -(node (node_comment) (#set! "priority" 105)) @comment -(node (node_field (node_field_comment) (#set! "priority" 105)) @comment) -(node_children (node_children_comment) (#set! "priority" 105)) @comment +(node + (node_comment) + (#set! "priority" 105)) @comment + +(node + (node_field + (node_field_comment) + (#set! "priority" 105)) @comment) + +(node_children + (node_children_comment) + (#set! "priority" 105)) @comment diff --git a/queries/kdl/indents.scm b/queries/kdl/indents.scm index c14fec5cb..6d16efd2d 100644 --- a/queries/kdl/indents.scm +++ b/queries/kdl/indents.scm @@ -1,7 +1,14 @@ -(node (node_children) @indent.begin) +(node + (node_children) @indent.begin) "}" @indent.end -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch diff --git a/queries/kdl/injections.scm b/queries/kdl/injections.scm index 46674768d..81d7734cb 100644 --- a/queries/kdl/injections.scm +++ b/queries/kdl/injections.scm @@ -1,5 +1,5 @@ ([ (single_line_comment) (multi_line_comment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) diff --git a/queries/kdl/locals.scm b/queries/kdl/locals.scm index 2c7ec5150..14b0af23e 100644 --- a/queries/kdl/locals.scm +++ b/queries/kdl/locals.scm @@ -1,10 +1,16 @@ (document) @local.scope -(node (node_children) @local.scope) -(node_children (node) @local.scope) + +(node + (node_children) @local.scope) + +(node_children + (node) @local.scope) (identifier) @local.reference (node_field) @local.definition.field -(node (identifier) @local.definition.type) +(node + (identifier) @local.definition.type) + (type) @local.definition.type diff --git a/queries/kotlin/folds.scm b/queries/kotlin/folds.scm index 768972b8b..eb4becc5f 100644 --- a/queries/kotlin/folds.scm +++ b/queries/kotlin/folds.scm @@ -1,17 +1,13 @@ [ - (import_list) - - (when_expression) - (control_structure_body) - - (lambda_literal) - (function_body) - (primary_constructor) - (secondary_constructor) - (anonymous_initializer) - - (class_body) - (enum_class_body) - - (interpolated_expression) + (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 diff --git a/queries/kotlin/highlights.scm b/queries/kotlin/highlights.scm index 1ce0c5430..2e5c349d2 100644 --- a/queries/kotlin/highlights.scm +++ b/queries/kotlin/highlights.scm @@ -1,53 +1,53 @@ -;;; Identifiers - +; Identifiers (simple_identifier) @variable ; `it` keyword inside lambdas ; FIXME: This will highlight the keyword outside of lambdas since tree-sitter ; does not allow us to check for arbitrary nestation ((simple_identifier) @variable.builtin -(#eq? @variable.builtin "it")) + (#eq? @variable.builtin "it")) ; `field` keyword inside property getter/setter ; FIXME: This will highlight the keyword outside of getters and setters ; since tree-sitter does not allow us to check for arbitrary nestation ((simple_identifier) @variable.builtin -(#eq? @variable.builtin "field")) + (#eq? @variable.builtin "field")) [ - "this" - "super" - "this@" - "super@" + "this" + "super" + "this@" + "super@" ] @variable.builtin ; NOTE: for consistency with "super@" -(super_expression "@" @variable.builtin) +(super_expression + "@" @variable.builtin) (class_parameter - (simple_identifier) @property) + (simple_identifier) @property) (class_body - (property_declaration - (variable_declaration - (simple_identifier) @property))) + (property_declaration + (variable_declaration + (simple_identifier) @property))) ; id_1.id_2.id_3: `id_2` and `id_3` are assumed as object properties (_ - (navigation_suffix - (simple_identifier) @property)) + (navigation_suffix + (simple_identifier) @property)) ; SCREAMING CASE identifiers are assumed to be constants ((simple_identifier) @constant -(#lua-match? @constant "^[A-Z][A-Z0-9_]*$")) + (#lua-match? @constant "^[A-Z][A-Z0-9_]*$")) (_ - (navigation_suffix - (simple_identifier) @constant - (#lua-match? @constant "^[A-Z][A-Z0-9_]*$"))) + (navigation_suffix + (simple_identifier) @constant + (#lua-match? @constant "^[A-Z][A-Z0-9_]*$"))) (enum_entry - (simple_identifier) @constant) + (simple_identifier) @constant) (type_identifier) @type @@ -55,170 +55,95 @@ (nullable_type) @punctuation.special (type_alias - (type_identifier) @type.definition) + (type_identifier) @type.definition) ((type_identifier) @type.builtin - (#any-of? @type.builtin - "Byte" - "Short" - "Int" - "Long" - "UByte" - "UShort" - "UInt" - "ULong" - "Float" - "Double" - "Boolean" - "Char" - "String" - "Array" - "ByteArray" - "ShortArray" - "IntArray" - "LongArray" - "UByteArray" - "UShortArray" - "UIntArray" - "ULongArray" - "FloatArray" - "DoubleArray" - "BooleanArray" - "CharArray" - "Map" - "Set" - "List" - "EmptyMap" - "EmptySet" - "EmptyList" - "MutableMap" - "MutableSet" - "MutableList" -)) + (#any-of? @type.builtin "Byte" "Short" "Int" "Long" "UByte" "UShort" "UInt" "ULong" "Float" "Double" "Boolean" "Char" "String" "Array" "ByteArray" "ShortArray" "IntArray" "LongArray" "UByteArray" "UShortArray" "UIntArray" "ULongArray" "FloatArray" "DoubleArray" "BooleanArray" "CharArray" "Map" "Set" "List" "EmptyMap" "EmptySet" "EmptyList" "MutableMap" "MutableSet" "MutableList")) -(package_header "package" @keyword - . (identifier (simple_identifier) @module)) +(package_header + "package" @keyword + . + (identifier + (simple_identifier) @module)) (import_header - "import" @keyword.import) + "import" @keyword.import) ; The last `simple_identifier` in a `import_header` will always either be a function ; or a type. Classes can appear anywhere in the import path, unlike functions (import_header - (identifier - (simple_identifier) @type @_import) - (import_alias - (type_identifier) @type.definition)? - (#lua-match? @_import "^[A-Z]")) + (identifier + (simple_identifier) @type @_import) + (import_alias + (type_identifier) @type.definition)? + (#lua-match? @_import "^[A-Z]")) (import_header - (identifier - (simple_identifier) @function @_import .) - (import_alias - (type_identifier) @function)? - (#lua-match? @_import "^[a-z]")) + (identifier + (simple_identifier) @function @_import .) + (import_alias + (type_identifier) @function)? + (#lua-match? @_import "^[a-z]")) (label) @label -;;; Function definitions - +; Function definitions (function_declaration - (simple_identifier) @function) + (simple_identifier) @function) (getter - ("get") @function.builtin) + ("get") @function.builtin) + (setter - ("set") @function.builtin) + ("set") @function.builtin) (primary_constructor) @constructor + (secondary_constructor - ("constructor") @constructor) + ("constructor") @constructor) (constructor_invocation - (user_type - (type_identifier) @constructor)) + (user_type + (type_identifier) @constructor)) (anonymous_initializer - ("init") @constructor) + ("init") @constructor) (parameter - (simple_identifier) @variable.parameter) + (simple_identifier) @variable.parameter) (parameter_with_optional_type - (simple_identifier) @variable.parameter) + (simple_identifier) @variable.parameter) ; lambda parameters (lambda_literal - (lambda_parameters - (variable_declaration - (simple_identifier) @variable.parameter))) - -;;; Function calls + (lambda_parameters + (variable_declaration + (simple_identifier) @variable.parameter))) +; Function calls ; function() (call_expression - . (simple_identifier) @function.call) + . + (simple_identifier) @function.call) ; ::function (callable_reference - . (simple_identifier) @function.call) + . + (simple_identifier) @function.call) ; object.function() or object.property.function() (call_expression - (navigation_expression - (navigation_suffix - (simple_identifier) @function.call) . )) + (navigation_expression + (navigation_suffix + (simple_identifier) @function.call) .)) (call_expression - . (simple_identifier) @function.builtin - (#any-of? @function.builtin - "arrayOf" - "arrayOfNulls" - "byteArrayOf" - "shortArrayOf" - "intArrayOf" - "longArrayOf" - "ubyteArrayOf" - "ushortArrayOf" - "uintArrayOf" - "ulongArrayOf" - "floatArrayOf" - "doubleArrayOf" - "booleanArrayOf" - "charArrayOf" - "emptyArray" - "mapOf" - "setOf" - "listOf" - "emptyMap" - "emptySet" - "emptyList" - "mutableMapOf" - "mutableSetOf" - "mutableListOf" - "print" - "println" - "error" - "TODO" - "run" - "runCatching" - "repeat" - "lazy" - "lazyOf" - "enumValues" - "enumValueOf" - "assert" - "check" - "checkNotNull" - "require" - "requireNotNull" - "with" - "suspend" - "synchronized" -)) - -;;; Literals + . + (simple_identifier) @function.builtin + (#any-of? @function.builtin "arrayOf" "arrayOfNulls" "byteArrayOf" "shortArrayOf" "intArrayOf" "longArrayOf" "ubyteArrayOf" "ushortArrayOf" "uintArrayOf" "ulongArrayOf" "floatArrayOf" "doubleArrayOf" "booleanArrayOf" "charArrayOf" "emptyArray" "mapOf" "setOf" "listOf" "emptyMap" "emptySet" "emptyList" "mutableMapOf" "mutableSetOf" "mutableListOf" "print" "println" "error" "TODO" "run" "runCatching" "repeat" "lazy" "lazyOf" "enumValues" "enumValueOf" "assert" "check" "checkNotNull" "require" "requireNotNull" "with" "suspend" "synchronized")) +; Literals [ (line_comment) (multiline_comment) @@ -230,17 +155,19 @@ (shebang_line) @keyword.directive (real_literal) @number.float + [ - (integer_literal) - (long_literal) - (hex_literal) - (bin_literal) - (unsigned_literal) + (integer_literal) + (long_literal) + (hex_literal) + (bin_literal) + (unsigned_literal) ] @number [ - "null" ; should be highlighted the same as booleans - (boolean_literal) + "null" + ; should be highlighted the same as booleans + (boolean_literal) ] @boolean (character_literal) @character @@ -248,71 +175,73 @@ (string_literal) @string ; NOTE: Escapes not allowed in multi-line strings -(character_literal (character_escape_seq) @string.escape) +(character_literal + (character_escape_seq) @string.escape) ; There are 3 ways to define a regex ; - "[abc]?".toRegex() (call_expression - (navigation_expression - ((string_literal) @string.regexp) - (navigation_suffix - ((simple_identifier) @_function - (#eq? @_function "toRegex"))))) + (navigation_expression + ((string_literal) @string.regexp) + (navigation_suffix + ((simple_identifier) @_function + (#eq? @_function "toRegex"))))) ; - Regex("[abc]?") (call_expression - ((simple_identifier) @_function - (#eq? @_function "Regex")) - (call_suffix - (value_arguments - (value_argument - (string_literal) @string.regexp)))) + ((simple_identifier) @_function + (#eq? @_function "Regex")) + (call_suffix + (value_arguments + (value_argument + (string_literal) @string.regexp)))) ; - Regex.fromLiteral("[abc]?") (call_expression - (navigation_expression - ((simple_identifier) @_class - (#eq? @_class "Regex")) - (navigation_suffix - ((simple_identifier) @_function - (#eq? @_function "fromLiteral")))) - (call_suffix - (value_arguments - (value_argument - (string_literal) @string.regexp)))) + (navigation_expression + ((simple_identifier) @_class + (#eq? @_class "Regex")) + (navigation_suffix + ((simple_identifier) @_function + (#eq? @_function "fromLiteral")))) + (call_suffix + (value_arguments + (value_argument + (string_literal) @string.regexp)))) -;;; Keywords - -(type_alias "typealias" @keyword) +; Keywords +(type_alias + "typealias" @keyword) -(companion_object "companion" @keyword) +(companion_object + "companion" @keyword) [ - (class_modifier) - (member_modifier) - (function_modifier) - (property_modifier) - (platform_modifier) - (variance_modifier) - (parameter_modifier) - (visibility_modifier) - (reification_modifier) - (inheritance_modifier) + (class_modifier) + (member_modifier) + (function_modifier) + (property_modifier) + (platform_modifier) + (variance_modifier) + (parameter_modifier) + (visibility_modifier) + (reification_modifier) + (inheritance_modifier) ] @type.qualifier [ - "val" - "var" - "enum" - "class" - "object" - "interface" -; "typeof" ; NOTE: It is reserved for future use + "val" + "var" + "enum" + "class" + "object" + "interface" + ; "typeof" ; NOTE: It is reserved for future use ] @keyword [ - "return" - "return@" + "return" + "return@" ] @keyword.return "suspend" @keyword.coroutine @@ -320,112 +249,135 @@ "fun" @keyword.function [ - "if" - "else" - "when" + "if" + "else" + "when" ] @keyword.conditional [ - "for" - "do" - "while" - "continue" - "continue@" - "break" - "break@" + "for" + "do" + "while" + "continue" + "continue@" + "break" + "break@" ] @keyword.repeat [ - "try" - "catch" - "throw" - "finally" + "try" + "catch" + "throw" + "finally" ] @keyword.exception - (annotation - "@" @attribute (use_site_target)? @attribute) + "@" @attribute + (use_site_target)? @attribute) + (annotation - (user_type - (type_identifier) @attribute)) + (user_type + (type_identifier) @attribute)) + (annotation - (constructor_invocation - (user_type - (type_identifier) @attribute))) + (constructor_invocation + (user_type + (type_identifier) @attribute))) (file_annotation - "@" @attribute "file" @attribute ":" @attribute) -(file_annotation - (user_type - (type_identifier) @attribute)) + "@" @attribute + "file" @attribute + ":" @attribute) + (file_annotation - (constructor_invocation - (user_type - (type_identifier) @attribute))) + (user_type + (type_identifier) @attribute)) -;;; Operators & Punctuation +(file_annotation + (constructor_invocation + (user_type + (type_identifier) @attribute))) +; Operators & Punctuation [ - "!" - "!=" - "!==" - "=" - "==" - "===" - ">" - ">=" - "<" - "<=" - "||" - "&&" - "+" - "++" - "+=" - "-" - "--" - "-=" - "*" - "*=" - "/" - "/=" - "%" - "%=" - "?." - "?:" - "!!" - "is" - "!is" - "in" - "!in" - "as" - "as?" - ".." - "->" + "!" + "!=" + "!==" + "=" + "==" + "===" + ">" + ">=" + "<" + "<=" + "||" + "&&" + "+" + "++" + "+=" + "-" + "--" + "-=" + "*" + "*=" + "/" + "/=" + "%" + "%=" + "?." + "?:" + "!!" + "is" + "!is" + "in" + "!in" + "as" + "as?" + ".." + "->" ] @operator [ - "(" ")" - "[" "]" - "{" "}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket [ - "." - "," - ";" - ":" - "::" + "." + "," + ";" + ":" + "::" ] @punctuation.delimiter -(super_expression [ "<" ">" ] @punctuation.delimiter) -(type_arguments [ "<" ">" ] @punctuation.delimiter) -(type_parameters [ "<" ">" ] @punctuation.delimiter) +(super_expression + [ + "<" + ">" + ] @punctuation.delimiter) + +(type_arguments + [ + "<" + ">" + ] @punctuation.delimiter) + +(type_parameters + [ + "<" + ">" + ] @punctuation.delimiter) ; NOTE: `interpolated_identifier`s can be highlighted in any way (string_literal - "$" @punctuation.special - (interpolated_identifier) @none @variable) + "$" @punctuation.special + (interpolated_identifier) @none @variable) + (string_literal - "${" @punctuation.special - (interpolated_expression) @none - "}" @punctuation.special) + "${" @punctuation.special + (interpolated_expression) @none + "}" @punctuation.special) diff --git a/queries/kotlin/injections.scm b/queries/kotlin/injections.scm index 8ac2eba60..335938309 100644 --- a/queries/kotlin/injections.scm +++ b/queries/kotlin/injections.scm @@ -1,17 +1,17 @@ ([ (line_comment) (multiline_comment) - ] @injection.content - (#set! injection.language "comment")) - +] @injection.content + (#set! injection.language "comment")) ; There are 3 ways to define a regex ; - "[abc]?".toRegex() (call_expression (navigation_expression - ((string_literal) @injection.content (#set! injection.language "regex")) - (navigation_suffix - ((simple_identifier) @_function - (#eq? @_function "toRegex"))))) + ((string_literal) @injection.content + (#set! injection.language "regex")) + (navigation_suffix + ((simple_identifier) @_function + (#eq? @_function "toRegex"))))) ; - Regex("[abc]?") (call_expression @@ -20,25 +20,28 @@ (call_suffix (value_arguments (value_argument - (string_literal) @injection.content (#set! injection.language "regex"))))) + (string_literal) @injection.content + (#set! injection.language "regex"))))) ; - Regex.fromLiteral("[abc]?") (call_expression (navigation_expression ((simple_identifier) @_class - (#eq? @_class "Regex")) + (#eq? @_class "Regex")) (navigation_suffix ((simple_identifier) @_function - (#eq? @_function "fromLiteral")))) + (#eq? @_function "fromLiteral")))) (call_suffix (value_arguments (value_argument - (string_literal) @injection.content (#set! injection.language "regex"))))) + (string_literal) @injection.content + (#set! injection.language "regex"))))) ; "pi = %.2f".format(3.14159) ((call_expression (navigation_expression (string_literal) @injection.content - (navigation_suffix (simple_identifier) @_method))) - (#eq? @_method "format") - (#set! injection.language "printf")) + (navigation_suffix + (simple_identifier) @_method))) + (#eq? @_method "format") + (#set! injection.language "printf")) diff --git a/queries/kotlin/locals.scm b/queries/kotlin/locals.scm index 0f95d65c6..1bc044e85 100644 --- a/queries/kotlin/locals.scm +++ b/queries/kotlin/locals.scm @@ -1,84 +1,78 @@ -;;; Imports - +; Imports (package_header - . (identifier) @local.definition.namespace) + . + (identifier) @local.definition.namespace) (import_header - (identifier - (simple_identifier) @local.definition.import .) - (import_alias - (type_identifier) @local.definition.import)?) - -;;; Functions + (identifier + (simple_identifier) @local.definition.import .) + (import_alias + (type_identifier) @local.definition.import)?) +; Functions (function_declaration - . (simple_identifier) @local.definition.function - (#set! "definition.function.scope" "parent")) + . + (simple_identifier) @local.definition.function + (#set! "definition.function.scope" "parent")) (class_body - (function_declaration - . (simple_identifier) @local.definition.method) - (#set! "definition.method.scope" "parent")) - -;;; Variables + (function_declaration + . + (simple_identifier) @local.definition.method) + (#set! "definition.method.scope" "parent")) +; Variables (function_declaration - (function_value_parameters - (parameter - (simple_identifier) @local.definition.parameter))) + (function_value_parameters + (parameter + (simple_identifier) @local.definition.parameter))) (lambda_literal - (lambda_parameters - (variable_declaration - (simple_identifier) @local.definition.parameter))) + (lambda_parameters + (variable_declaration + (simple_identifier) @local.definition.parameter))) (class_body - (property_declaration - (variable_declaration - (simple_identifier) @local.definition.field))) + (property_declaration + (variable_declaration + (simple_identifier) @local.definition.field))) (class_declaration - (primary_constructor - (class_parameter - (simple_identifier) @local.definition.field))) + (primary_constructor + (class_parameter + (simple_identifier) @local.definition.field))) (enum_class_body - (enum_entry - (simple_identifier) @local.definition.field)) + (enum_entry + (simple_identifier) @local.definition.field)) (variable_declaration - (simple_identifier) @local.definition.var) - -;;; Types + (simple_identifier) @local.definition.var) +; Types (class_declaration - (type_identifier) @local.definition.type - (#set! "definition.type.scope" "parent")) + (type_identifier) @local.definition.type + (#set! "definition.type.scope" "parent")) (type_alias - (type_identifier) @local.definition.type - (#set! "definition.type.scope" "parent")) - -;;; Scopes + (type_identifier) @local.definition.type + (#set! "definition.type.scope" "parent")) +; Scopes [ - (if_expression) - (when_expression) - (when_entry) - - (for_statement) - (while_statement) - (do_while_statement) - - (lambda_literal) - (function_declaration) - (primary_constructor) - (secondary_constructor) - (anonymous_initializer) - - (class_declaration) - (enum_class_body) - (enum_entry) - - (interpolated_expression) + (if_expression) + (when_expression) + (when_entry) + (for_statement) + (while_statement) + (do_while_statement) + (lambda_literal) + (function_declaration) + (primary_constructor) + (secondary_constructor) + (anonymous_initializer) + (class_declaration) + (enum_class_body) + (enum_entry) + (interpolated_expression) ] @local.scope diff --git a/queries/kusto/highlights.scm b/queries/kusto/highlights.scm index a0ad0a895..00bf4b067 100644 --- a/queries/kusto/highlights.scm +++ b/queries/kusto/highlights.scm @@ -4,6 +4,7 @@ (function_call (identifier) @function.call) + [ (type_cast_function) (to_scalar_function) @@ -13,7 +14,9 @@ (typed_parameter (identifier) @variable.parameter) -(function_arguments (identifier) @variable.parameter) + +(function_arguments + (identifier) @variable.parameter) [ (binary_operator) @@ -28,12 +31,17 @@ ] @keyword.operator (string) @string + (number) @number + (bool) @boolean + (null) @constant.builtin + (comment) @comment @spell (type) @type + (join_types) @type.qualifier [ diff --git a/queries/kusto/injections.scm b/queries/kusto/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/kusto/injections.scm +++ b/queries/kusto/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/lalrpop/highlights.scm b/queries/lalrpop/highlights.scm index c0c1a3a81..450e657b4 100644 --- a/queries/lalrpop/highlights.scm +++ b/queries/lalrpop/highlights.scm @@ -13,23 +13,32 @@ ] @keyword.conditional [ - "+" - "*" - "?" - ; TODO: inaccessible node - ; => - "=>@L" - "=>@R" + "+" + "*" + "?" + ; TODO: inaccessible node + ; => + "=>@L" + "=>@R" ] @operator (grammar_type_params - ["<" ">"] @punctuation.bracket) + [ + "<" + ">" + ] @punctuation.bracket) (symbol - ["<" ">"] @punctuation.bracket) + [ + "<" + ">" + ] @punctuation.bracket) (binding_symbol - ["<" ">"] @punctuation.bracket) + [ + "<" + ">" + ] @punctuation.bracket) (binding_symbol name: (identifier) @variable.parameter) @@ -50,11 +59,21 @@ (nonterminal (type_ref) @type.builtin) -["(" ")" "[" "]"] @punctuation.bracket +[ + "(" + ")" + "[" + "]" +] @punctuation.bracket -[";" ":"] @punctuation.delimiter +[ + ";" + ":" +] @punctuation.delimiter -(lifetime (identifier) @keyword.storage) +(lifetime + (identifier) @keyword.storage) (string_literal) @string + (regex_literal) @string diff --git a/queries/lalrpop/injections.scm b/queries/lalrpop/injections.scm index 41bde7e39..b0c83a11a 100644 --- a/queries/lalrpop/injections.scm +++ b/queries/lalrpop/injections.scm @@ -1,11 +1,12 @@ ([ (normal_action) (failible_action) - ] @injection.content - (#set! injection.language "rust")) +] @injection.content + (#set! injection.language "rust")) -((use) @injection.content (#set! injection.language "rust")) +((use) @injection.content + (#set! injection.language "rust")) ((regex_literal) @injection.content - (#set! injection.language "regex") - (#offset! @injection.content 0 2 0 -1)) + (#set! injection.language "regex") + (#offset! @injection.content 0 2 0 -1)) diff --git a/queries/lalrpop/locals.scm b/queries/lalrpop/locals.scm index bd44c897c..ceeac965b 100644 --- a/queries/lalrpop/locals.scm +++ b/queries/lalrpop/locals.scm @@ -1,4 +1,4 @@ -(nonterminal_name +(nonterminal_name (macro_id) @local.definition.function) (nonterminal_name diff --git a/queries/latex/folds.scm b/queries/latex/folds.scm index 07505c375..f00289493 100644 --- a/queries/latex/folds.scm +++ b/queries/latex/folds.scm @@ -6,7 +6,6 @@ (subsubsection) (paragraph) (subparagraph) - (generic_environment) (math_environment) (comment_environment) diff --git a/queries/latex/highlights.scm b/queries/latex/highlights.scm index 5ccc2b8fe..47c923ee6 100644 --- a/queries/latex/highlights.scm +++ b/queries/latex/highlights.scm @@ -1,7 +1,9 @@ -;; General syntax - +; General syntax (command_name) @function -(text_mode "\\text" @function) + +(text_mode + "\\text" @function) + (caption command: _ @function) @@ -10,206 +12,306 @@ value: (_)) [ - (line_comment) - (block_comment) - (comment_environment) + (line_comment) + (block_comment) + (comment_environment) ] @comment @spell ((line_comment) @keyword.directive (#lua-match? @keyword.directive "^%% !TeX")) [ - (brack_group) - (brack_group_argc) + (brack_group) + (brack_group_argc) ] @variable.parameter -[(operator) "="] @operator +[ + (operator) + "=" +] @operator "\\item" @punctuation.special ((word) @punctuation.delimiter -(#eq? @punctuation.delimiter "&")) + (#eq? @punctuation.delimiter "&")) -["[" "]" "{" "}"] @punctuation.bracket ; "(" ")" has no syntactical meaning in LaTeX +[ + "[" + "]" + "{" + "}" +] @punctuation.bracket ; "(" ")" has no syntactical meaning in LaTeX -;; General environments +; General environments (begin - command: _ @markup.environment - name: (curly_group_text (text) @markup.environment.name)) + command: _ @markup.environment + name: + (curly_group_text + (text) @markup.environment.name)) (end - command: _ @markup.environment - name: (curly_group_text (text) @markup.environment.name)) + command: _ @markup.environment + name: + (curly_group_text + (text) @markup.environment.name)) -;; Definitions and references +; Definitions and references (new_command_definition - command: _ @function.macro - declaration: (curly_group_command_name (_) @function)) + command: _ @function.macro + declaration: + (curly_group_command_name + (_) @function)) + (old_command_definition - command: _ @function.macro - declaration: (_) @function) + command: _ @function.macro + declaration: (_) @function) + (let_command_definition - command: _ @function.macro - declaration: (_) @function) + command: _ @function.macro + declaration: (_) @function) (environment_definition - command: _ @function.macro - name: (curly_group_text (_) @markup.link)) + command: _ @function.macro + name: + (curly_group_text + (_) @markup.link)) (theorem_definition - command: _ @function.macro - name: (curly_group_text (_) @markup.environment.name)) + command: _ @function.macro + name: + (curly_group_text + (_) @markup.environment.name)) (paired_delimiter_definition - command: _ @function.macro - declaration: (curly_group_command_name (_) @function)) + command: _ @function.macro + declaration: + (curly_group_command_name + (_) @function)) (label_definition - command: _ @function.macro - name: (curly_group_text (_) @markup.link)) + command: _ @function.macro + name: + (curly_group_text + (_) @markup.link)) + (label_reference_range - command: _ @function.macro - from: (curly_group_text (_) @markup.link) - to: (curly_group_text (_) @markup.link)) + command: _ @function.macro + from: + (curly_group_text + (_) @markup.link) + to: + (curly_group_text + (_) @markup.link)) + (label_reference - command: _ @function.macro - names: (curly_group_text_list (_) @markup.link)) + command: _ @function.macro + names: + (curly_group_text_list + (_) @markup.link)) + (label_number - command: _ @function.macro - name: (curly_group_text (_) @markup.link) - number: (_) @markup.link) + command: _ @function.macro + name: + (curly_group_text + (_) @markup.link) + number: (_) @markup.link) (citation - command: _ @function.macro - keys: (curly_group_text_list) @markup.link) + command: _ @function.macro + keys: (curly_group_text_list) @markup.link) (glossary_entry_definition - command: _ @function.macro - name: (curly_group_text (_) @markup.link)) + command: _ @function.macro + name: + (curly_group_text + (_) @markup.link)) + (glossary_entry_reference - command: _ @function.macro - name: (curly_group_text (_) @markup.link)) + command: _ @function.macro + name: + (curly_group_text + (_) @markup.link)) (acronym_definition - command: _ @function.macro - name: (curly_group_text (_) @markup.link)) + command: _ @function.macro + name: + (curly_group_text + (_) @markup.link)) + (acronym_reference - command: _ @function.macro - name: (curly_group_text (_) @markup.link)) + command: _ @function.macro + name: + (curly_group_text + (_) @markup.link)) (color_definition - command: _ @function.macro - name: (curly_group_text (_) @markup.link)) + command: _ @function.macro + name: + (curly_group_text + (_) @markup.link)) + (color_reference - command: _ @function.macro - name: (curly_group_text (_) @markup.link)) + command: _ @function.macro + name: + (curly_group_text + (_) @markup.link)) -;; Math +; Math [ - (displayed_equation) - (inline_formula) + (displayed_equation) + (inline_formula) ] @markup.math (math_environment (begin - command: _ @markup.math - name: (curly_group_text (text) @markup.math))) + command: _ @markup.math + name: + (curly_group_text + (text) @markup.math))) (math_environment (text) @markup.math) (math_environment (end - command: _ @markup.math - name: (curly_group_text (text) @markup.math))) + command: _ @markup.math + name: + (curly_group_text + (text) @markup.math))) -;; Sectioning +; Sectioning (title_declaration command: _ @module - options: (brack_group (_) @markup.heading.1)? - text: (curly_group (_) @markup.heading.1)) + options: + (brack_group + (_) @markup.heading.1)? + text: + (curly_group + (_) @markup.heading.1)) (author_declaration command: _ @module - authors: (curly_group_author_list - ((author)+ @markup.heading.1))) + authors: + (curly_group_author_list + ((author)+ @markup.heading.1))) (chapter command: _ @module - toc: (brack_group (_) @markup.heading.2)? - text: (curly_group (_) @markup.heading.2)) + toc: + (brack_group + (_) @markup.heading.2)? + text: + (curly_group + (_) @markup.heading.2)) (part command: _ @module - toc: (brack_group (_) @markup.heading.2)? - text: (curly_group (_) @markup.heading.2)) + toc: + (brack_group + (_) @markup.heading.2)? + text: + (curly_group + (_) @markup.heading.2)) (section command: _ @module - toc: (brack_group (_) @markup.heading.3)? - text: (curly_group (_) @markup.heading.3)) + toc: + (brack_group + (_) @markup.heading.3)? + text: + (curly_group + (_) @markup.heading.3)) (subsection command: _ @module - toc: (brack_group (_) @markup.heading.4)? - text: (curly_group (_) @markup.heading.4)) + toc: + (brack_group + (_) @markup.heading.4)? + text: + (curly_group + (_) @markup.heading.4)) (subsubsection command: _ @module - toc: (brack_group (_) @markup.heading.5)? - text: (curly_group (_) @markup.heading.5)) + toc: + (brack_group + (_) @markup.heading.5)? + text: + (curly_group + (_) @markup.heading.5)) (paragraph command: _ @module - toc: (brack_group (_) @markup.heading.6)? - text: (curly_group (_) @markup.heading.6)) + toc: + (brack_group + (_) @markup.heading.6)? + text: + (curly_group + (_) @markup.heading.6)) (subparagraph command: _ @module - toc: (brack_group (_) @markup.heading.6)? - text: (curly_group (_) @markup.heading.6)) + toc: + (brack_group + (_) @markup.heading.6)? + text: + (curly_group + (_) @markup.heading.6)) -;; Beamer frames +; Beamer frames (generic_environment (begin - name: (curly_group_text - (text) @markup.environment.name) + name: + (curly_group_text + (text) @markup.environment.name) (#any-of? @markup.environment.name "frame")) . - (curly_group (_) @markup.heading)) + (curly_group + (_) @markup.heading)) ((generic_command command: (command_name) @_name - arg: (curly_group - (text) @markup.heading)) - (#eq? @_name "\\frametitle")) + arg: + (curly_group + (text) @markup.heading)) + (#eq? @_name "\\frametitle")) -;; Formatting +; Formatting (text_mode - content: (curly_group (_) @none @spell)) + content: + (curly_group + (_) @none @spell)) ((generic_command command: (command_name) @_name - arg: (curly_group (_) @markup.italic)) + arg: + (curly_group + (_) @markup.italic)) (#eq? @_name "\\emph")) ((generic_command command: (command_name) @_name - arg: (curly_group (_) @markup.italic)) - (#any-of? @_name "\\textit" "\\mathit")) + arg: + (curly_group + (_) @markup.italic)) + (#any-of? @_name "\\textit" "\\mathit")) ((generic_command command: (command_name) @_name - arg: (curly_group (_) @markup.strong)) - (#any-of? @_name "\\textbf" "\\mathbf")) + arg: + (curly_group + (_) @markup.strong)) + (#any-of? @_name "\\textbf" "\\mathbf")) ((generic_command command: (command_name) @_name . - arg: (curly_group (_) @markup.link.url)) - (#any-of? @_name "\\url" "\\href")) + arg: + (curly_group + (_) @markup.link.url)) + (#any-of? @_name "\\url" "\\href")) -;; File inclusion commands +; File inclusion commands (class_include command: _ @keyword.import path: (curly_group_path) @string) @@ -221,6 +323,7 @@ (latex_include command: _ @keyword.import path: (curly_group_path) @string) + (import_include command: _ @keyword.import directory: (curly_group_path) @string @@ -229,6 +332,7 @@ (bibtex_include command: _ @keyword.import path: (curly_group_path) @string) + (biblatex_include "\\addbibresource" @keyword.import glob: (curly_group_glob_pattern) @string.regexp) @@ -236,20 +340,30 @@ (graphics_include command: _ @keyword.import path: (curly_group_path) @string) + (tikz_library_import command: _ @keyword.import paths: (curly_group_path_list) @string) (text) @spell + (inline_formula) @nospell + (displayed_equation) @nospell + (key_value_pair) @nospell + (generic_environment begin: _ @nospell end: _ @nospell) + (citation keys: _ @nospell) + (command_name) @nospell + (label_definition) @nospell + (label_reference) @nospell + (label_reference_range) @nospell diff --git a/queries/latex/injections.scm b/queries/latex/injections.scm index a35fcb150..189987a38 100644 --- a/queries/latex/injections.scm +++ b/queries/latex/injections.scm @@ -2,34 +2,32 @@ (line_comment) (block_comment) (comment_environment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) (pycode_environment - code: - (source_code) @injection.content + code: (source_code) @injection.content (#set! injection.language "python")) (sagesilent_environment - code: - (source_code) @injection.content + code: (source_code) @injection.content (#set! injection.language "python")) (sageblock_environment - code: - (source_code) @injection.content + code: (source_code) @injection.content (#set! injection.language "python")) (minted_environment (begin - language: (curly_group_text - (text) @injection.language)) + language: + (curly_group_text + (text) @injection.language)) (source_code) @injection.content) ((generic_environment (begin - name: (curly_group_text - (text) @_env))) @injection.content - (#set! injection.language "c") - (#any-of? @_env "asy" "asydef")) - + name: + (curly_group_text + (text) @_env))) @injection.content + (#set! injection.language "c") + (#any-of? @_env "asy" "asydef")) diff --git a/queries/ledger/folds.scm b/queries/ledger/folds.scm index d807fc35e..8b5736819 100644 --- a/queries/ledger/folds.scm +++ b/queries/ledger/folds.scm @@ -1,3 +1 @@ -[ - (xact) -] @fold +(xact) @fold diff --git a/queries/ledger/highlights.scm b/queries/ledger/highlights.scm index 8194b50ad..cdf8f6bb9 100644 --- a/queries/ledger/highlights.scm +++ b/queries/ledger/highlights.scm @@ -1,28 +1,28 @@ [ - (block_comment) - (comment) - (note) - (test) + (block_comment) + (comment) + (note) + (test) ] @comment @spell [ - (quantity) - (negative_quantity) + (quantity) + (negative_quantity) ] @number [ - (date) - (effective_date) - (time) - (interval) + (date) + (effective_date) + (time) + (interval) ] @string.special [ - (commodity) - (option) - (option_value) - (check_in) - (check_out) + (commodity) + (option) + (option_value) + (check_in) + (check_out) ] @markup.raw ((account) @variable.member) @@ -30,25 +30,25 @@ "include" @keyword.import [ - "account" - "alias" - "assert" - "check" - "commodity" - "comment" - "def" - "default" - "end" - "eval" - "format" - "nomarket" - "note" - "payee" - "test" - "A" - "Y" - "N" - "D" - "C" - "P" + "account" + "alias" + "assert" + "check" + "commodity" + "comment" + "def" + "default" + "end" + "eval" + "format" + "nomarket" + "note" + "payee" + "test" + "A" + "Y" + "N" + "D" + "C" + "P" ] @keyword diff --git a/queries/ledger/indents.scm b/queries/ledger/indents.scm index 31e7f56df..9697c9cfa 100644 --- a/queries/ledger/indents.scm +++ b/queries/ledger/indents.scm @@ -1,3 +1 @@ -[ - (journal_item) -] @indent.begin +(journal_item) @indent.begin diff --git a/queries/ledger/injections.scm b/queries/ledger/injections.scm index ad62013f5..35fb57eef 100644 --- a/queries/ledger/injections.scm +++ b/queries/ledger/injections.scm @@ -1,5 +1,5 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((note) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/leo/highlights.scm b/queries/leo/highlights.scm index 11c2d67e4..c4500ddf3 100644 --- a/queries/leo/highlights.scm +++ b/queries/leo/highlights.scm @@ -1,37 +1,38 @@ (variable_identifier) @variable + (constant_identifier) @constant [ - "assert" - "assert_eq" - "assert_neq" - "block" - "console" - "const" - "let" - "mapping" - "program" - "record" - "self" - "struct" - "then" + "assert" + "assert_eq" + "assert_neq" + "block" + "console" + "const" + "let" + "mapping" + "program" + "record" + "self" + "struct" + "then" ] @keyword - "in" @keyword.operator +"in" @keyword.operator [ - "constant" - "private" - "public" - ] @type.qualifier + "constant" + "private" + "public" +] @type.qualifier "self" @variable.builtin [ - "finalize" - "function" - "inline" - "transition" + "finalize" + "function" + "inline" + "transition" ] @keyword.function "import" @keyword.import @@ -42,86 +43,86 @@ "for" @keyword.repeat -[ +[ "else" "if" ] @keyword.conditional [ - (ternary_if) - (ternary_else) + (ternary_if) + (ternary_else) ] @keyword.conditional.ternary -[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket - -[ ";" "," "::"] @punctuation.delimiter - [ -"!" - -"&&" -"||" - -"==" -"!=" - -"<" -"<=" -">" -">=" - -"&" -"|" -"^" - -"<<" -">>" + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket -"+" -"-" -"*" -"/" -"%" -"**" - -"=" - -"+=" -"-=" -"*=" -"/=" -"%=" -"**=" - -"<<=" -">>=" - -"&=" -"|=" -"^=" - -"&&=" -"||=" +[ + ";" + "," + "::" +] @punctuation.delimiter +[ + "!" + "&&" + "||" + "==" + "!=" + "<" + "<=" + ">" + ">=" + "&" + "|" + "^" + "<<" + ">>" + "+" + "-" + "*" + "/" + "%" + "**" + "=" + "+=" + "-=" + "*=" + "/=" + "%=" + "**=" + "<<=" + ">>=" + "&=" + "|=" + "^=" + "&&=" + "||=" ] @operator (comment) @comment @spell (boolean_literal) @boolean -(constant_declaration +(constant_declaration (identifier) @constant) [ - (program_id) - (this_program_id) + (program_id) + (this_program_id) ] @string.special ;record declaration -(record_declaration (identifier) @variable.member) +(record_declaration + (identifier) @variable.member) -;struct component -(struct_component_declaration +;struct component +(struct_component_declaration (identifier) @variable.member) (type) @type @@ -129,18 +130,18 @@ (associated_constant) @constant [ - (block_height) - (self_caller) - (self_signer) + (block_height) + (self_caller) + (self_signer) ] @constant.builtin (free_function_call - (locator - (identifier) @function)) + (locator + (identifier) @function)) (record_type - (locator - (identifier) @variable.member)) + (locator + (identifier) @variable.member)) (transition_declaration name: (identifier) @function.builtin) @@ -158,28 +159,31 @@ name: (identifier) @function.macro) (method_call - . (_) - . (identifier) @function.method.call) + . + (_) + . + (identifier) @function.method.call) (function_parameter - (identifier) @variable.parameter) + (identifier) @variable.parameter) (struct_declaration name: (identifier) @variable.member) (variable_declaration - (identifier_or_identifiers - (identifier) @variable)) + (identifier_or_identifiers + (identifier) @variable)) -[ +[ (address_literal) (signature_literal) - ((affine_group_literal) (#set! "priority" 101)) - (field_literal) - (product_group_literal) - (scalar_literal) - (signed_literal) - (unsigned_literal) + ((affine_group_literal) + (#set! "priority" 101)) + (field_literal) + (product_group_literal) + (scalar_literal) + (signed_literal) + (unsigned_literal) ] @number (annotation) @attribute diff --git a/queries/leo/indents.scm b/queries/leo/indents.scm index a8de26ecd..0f1a0a500 100644 --- a/queries/leo/indents.scm +++ b/queries/leo/indents.scm @@ -1,33 +1,33 @@ [ - (record_declaration) - (struct_declaration) - (mapping_declaration) - (constant_declaration) - (return_statement) - (expression_statement) - (variable_declaration) - (loop_statement) - (assignment_statement) - (assert_statement) - (struct_expression) - (array_expression) - (tuple_expression) - (parenthesized_expression) - (items_block) - (block) + (record_declaration) + (struct_declaration) + (mapping_declaration) + (constant_declaration) + (return_statement) + (expression_statement) + (variable_declaration) + (loop_statement) + (assignment_statement) + (assert_statement) + (struct_expression) + (array_expression) + (tuple_expression) + (parenthesized_expression) + (items_block) + (block) ] @indent.begin - -; if "if" statement and conditional statement are in separate lines -; conditional should be indented and when the conditional block +; if "if" statement and conditional statement are in separate lines +; conditional should be indented and when the conditional block ; starts dedented (branch - (block "{" @indent.end)) @indent.begin + (block + "{" @indent.end)) @indent.begin ((function_parameters) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")")) [ - (comment) - (ERROR) + (comment) + (ERROR) ] @indent.auto diff --git a/queries/leo/injections.scm b/queries/leo/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/leo/injections.scm +++ b/queries/leo/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/linkerscript/highlights.scm b/queries/linkerscript/highlights.scm index 0453ded85..accaad5ca 100644 --- a/queries/linkerscript/highlights.scm +++ b/queries/linkerscript/highlights.scm @@ -1,5 +1,4 @@ ; Keywords - [ "ENTRY" "SECTIONS" @@ -12,17 +11,18 @@ ] @keyword ; Conditionals - -(conditional_expression [ "?" ":" ] @keyword.conditional.ternary) +(conditional_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) ; Variables - (symbol) @variable (filename) @string.special.path ; Functions - (call_expression function: (symbol) @function.call) @@ -32,10 +32,7 @@ ((call_expression function: (symbol) @function.builtin) - (#any-of? @function.builtin - "ABSOLUTE" "ALIAS" "ADDR" "ALIGN" "ALIGNOF" "BASE" "BLOCK" "CHIP" "DATA_SEGMENT_ALIGN" - "DATA_SEGMENT_END" "DATA_SEGMENT_RELRO_END" "END" "LENGTH" "LOADADDR" "LOG2CEIL" "MAX" "MIN" - "NEXT" "ORIGIN" "SEGMENT_START" "SIZEOF" "BYTE" "FILL" "LONG" "SHORT" "QUAD" "SQUAD" "WORD")) + (#any-of? @function.builtin "ABSOLUTE" "ALIAS" "ADDR" "ALIGN" "ALIGNOF" "BASE" "BLOCK" "CHIP" "DATA_SEGMENT_ALIGN" "DATA_SEGMENT_END" "DATA_SEGMENT_RELRO_END" "END" "LENGTH" "LOADADDR" "LOG2CEIL" "MAX" "MIN" "NEXT" "ORIGIN" "SEGMENT_START" "SIZEOF" "BYTE" "FILL" "LONG" "SHORT" "QUAD" "SQUAD" "WORD")) [ "KEEP" @@ -44,42 +41,63 @@ ] @function.builtin ; Types - -(section_type "(" [ "NOLOAD" "DSECT" "COPY" "INFO" "OVERLAY" ] @type.builtin ")") +(section_type + "(" + [ + "NOLOAD" + "DSECT" + "COPY" + "INFO" + "OVERLAY" + ] @type.builtin + ")") ; Fields - [ - "ORIGIN" "org" "o" - "LENGTH" "len" "l" + "ORIGIN" + "org" + "o" + "LENGTH" + "len" + "l" ] @variable.member.builtin ; Constants - ((symbol) @constant (#lua-match? @constant "^[%u_][%u%d_]+$")) ; Labels +(entry_command + name: (symbol) @label) -(entry_command name: (symbol) @label) +(output_section + name: (symbol) @label) -(output_section name: (symbol) @label) +(memory_command + name: (symbol) @label) -(memory_command name: (symbol) @label) +(phdrs_command + name: (symbol) @label) -(phdrs_command name: (symbol) @label) - -(region ">" (symbol) @label) +(region + ">" + (symbol) @label) -(lma_region ">" (symbol) @label) +(lma_region + ">" + (symbol) @label) -(phdr ":" (symbol) @label) +(phdr + ":" + (symbol) @label) -([(symbol) (filename)] @label +([ + (symbol) + (filename) +] @label (#lua-match? @label "^%.")) ; Exceptions - "ASSERT" @keyword.exception [ @@ -88,7 +106,6 @@ ] @variable.builtin ; Operators - [ "+" "-" @@ -121,18 +138,26 @@ ] @operator ; Literals - (number) @number (quoted_symbol) @string -(wildcard_pattern [ "*" "[" "]" ] @character.special) +(wildcard_pattern + [ + "*" + "[" + "]" + ] @character.special) (attributes) @character.special ; Punctuation - -[ "{" "}" "(" ")" ] @punctuation.bracket +[ + "{" + "}" + "(" + ")" +] @punctuation.bracket [ ":" @@ -142,5 +167,4 @@ ">" @punctuation.special ; Comments - (comment) @comment @spell diff --git a/queries/linkerscript/locals.scm b/queries/linkerscript/locals.scm index 7b45dcef2..6b7660370 100644 --- a/queries/linkerscript/locals.scm +++ b/queries/linkerscript/locals.scm @@ -1,15 +1,16 @@ ; References - [ - (symbol) - (filename) - (quoted_symbol) + (symbol) + (filename) + (quoted_symbol) ] @local.reference ; Definitions +(output_section + name: (symbol) @local.definition.var) -(output_section name: (symbol) @local.definition.var) - -(memory_command name: (symbol) @local.definition.var) +(memory_command + name: (symbol) @local.definition.var) -(phdrs_command name: (symbol) @local.definition.var) +(phdrs_command + name: (symbol) @local.definition.var) diff --git a/queries/liquidsoap/folds.scm b/queries/liquidsoap/folds.scm index 9b0d12efa..56e4ce547 100644 --- a/queries/liquidsoap/folds.scm +++ b/queries/liquidsoap/folds.scm @@ -1,21 +1,21 @@ [ - (let) - (binding) - (simple_fun) - (def) - (arglist) - (if) - (if_condition) - (if_then) - (elsif_condition) - (elsif_then) - (if_else) - (for) - (for_do) - (while) - (while_do) - (try) - (try_body) - (try_do) - (block) + (let) + (binding) + (simple_fun) + (def) + (arglist) + (if) + (if_condition) + (if_then) + (elsif_condition) + (elsif_then) + (if_else) + (for) + (for_do) + (while) + (while_do) + (try) + (try_body) + (try_do) + (block) ] @fold diff --git a/queries/liquidsoap/highlights.scm b/queries/liquidsoap/highlights.scm index 45b5abe05..38a386548 100644 --- a/queries/liquidsoap/highlights.scm +++ b/queries/liquidsoap/highlights.scm @@ -1,7 +1,12 @@ (var) @variable (op) @operator -["and" "or" "not"] @keyword.operator + +[ + "and" + "or" + "not" +] @keyword.operator [ "def" @@ -41,7 +46,11 @@ "try_end" ] @keyword.exception -(inline_if [ "?" ":" ] @keyword.conditional.ternary) +(inline_if + [ + "?" + ":" + ] @keyword.conditional.ternary) [ "%ifdef" @@ -57,8 +66,11 @@ (encoder_name) @constant.builtin -(anonymous_argument (var) @variable.parameter) -(labeled_argument label: (var) @variable.parameter) +(anonymous_argument + (var) @variable.parameter) + +(labeled_argument + label: (var) @variable.parameter) "." @punctuation.delimiter @@ -69,17 +81,31 @@ "]" "{" "}" -] @punctuation.bracket +] @punctuation.bracket + +(app + name: (var) @function.call) -(app name: (var) @function.call) (method) @function.method + (method_app) @function.method.call (string) @string -(string_interpolation [ "#{" "}" ] @punctuation.special) + +(string_interpolation + [ + "#{" + "}" + ] @punctuation.special) + (integer) @number + (float) @number.float + (bool) @boolean + (comment) @comment + (regexp) @string.regexp + (type) @type diff --git a/queries/liquidsoap/indents.scm b/queries/liquidsoap/indents.scm index ce8c02b53..7cb5935fb 100644 --- a/queries/liquidsoap/indents.scm +++ b/queries/liquidsoap/indents.scm @@ -22,33 +22,45 @@ "(" ] @indent.begin -(ERROR "def") @indent.begin +(ERROR + "def") @indent.begin -(def "def_end" @indent.end) -(if "if_end" @indent.end) -(block "block_end" @indent.end) -(for "for_end" @indent.end) -(while "while_end" @indent.end) -(try "try_end" @indent.end) +(def + "def_end" @indent.end) + +(if + "if_end" @indent.end) + +(block + "block_end" @indent.end) + +(for + "for_end" @indent.end) + +(while + "while_end" @indent.end) + +(try + "try_end" @indent.end) [ - "then" - "do" - "else" - "elsif" - "catch" + "then" + "do" + "else" + "elsif" + "catch" ] @indent.branch [ - "def_end" - "if_end" - "block_end" - "for_end" - "while_end" - "try_end" - "}" - "]" - ")" + "def_end" + "if_end" + "block_end" + "for_end" + "while_end" + "try_end" + "}" + "]" + ")" ] @indent.branch @indent.end (comment) @indent.auto diff --git a/queries/liquidsoap/locals.scm b/queries/liquidsoap/locals.scm index d4727114a..995294c03 100644 --- a/queries/liquidsoap/locals.scm +++ b/queries/liquidsoap/locals.scm @@ -1,15 +1,35 @@ -[(anonymous_function) (binding) (def) (let)] @local.scope +[ + (anonymous_function) + (binding) + (def) + (let) +] @local.scope -(anonymous_argument (var) @local.definition.parameter) -(labeled_argument label: (var) @local.definition.parameter) +(anonymous_argument + (var) @local.definition.parameter) + +(labeled_argument + label: (var) @local.definition.parameter) (binding defined: (var) @local.definition.var) -(def defined: (var) @local.definition.var) -(let defined: (var) @local.definition.var) -(meth_pattern (var) @local.definition.var) -(list_pattern (var) @local.definition.var) -(tuple_pattern (var) @local.definition.var) -(spread (var) @local.definition.var) + +(def + defined: (var) @local.definition.var) + +(let + defined: (var) @local.definition.var) + +(meth_pattern + (var) @local.definition.var) + +(list_pattern + (var) @local.definition.var) + +(tuple_pattern + (var) @local.definition.var) + +(spread + (var) @local.definition.var) (var) @local.reference diff --git a/queries/llvm/highlights.scm b/queries/llvm/highlights.scm index 96b8bab93..2ccae3693 100644 --- a/queries/llvm/highlights.scm +++ b/queries/llvm/highlights.scm @@ -4,9 +4,11 @@ ] @variable (type) @type + (type_keyword) @type.builtin -(type [ +(type + [ (local_var) (global_var) ] @type) @@ -16,7 +18,8 @@ (argument) @variable.parameter -(_ inst_name: _ @keyword.operator) +(_ + inst_name: _ @keyword.operator) [ "catch" @@ -36,18 +39,24 @@ "inbounds" "inrange" ] @keyword + (icmp_cond) @keyword + (fcmp_cond) @keyword (fast_math) @keyword -(_ callee: _ @function) -(function_header name: _ @function) +(_ + callee: _ @function) + +(function_header + name: _ @function) [ "declare" "define" ] @keyword.function + (calling_conv) @keyword.function [ @@ -86,7 +95,6 @@ "vscale" ] @keyword - [ "no_cfi" (dso_local) @@ -105,18 +113,26 @@ (attribute_name) @attribute -(function_header [ +(function_header + [ (linkage) (calling_conv) (unnamed_addr) ] @keyword.function) (number) @number + (comment) @comment @spell + (string) @string + (cstring) @string + (label) @label -(_ inst_name: "ret" @keyword.return) + +(_ + inst_name: "ret" @keyword.return) + (float) @number.float [ diff --git a/queries/lua/folds.scm b/queries/lua/folds.scm index 37c4947ed..9dfac3abc 100644 --- a/queries/lua/folds.scm +++ b/queries/lua/folds.scm @@ -1,12 +1,12 @@ [ - (do_statement) - (while_statement) - (repeat_statement) - (if_statement) - (for_statement) - (function_declaration) - (function_definition) - (parameters) - (arguments) - (table_constructor) + (do_statement) + (while_statement) + (repeat_statement) + (if_statement) + (for_statement) + (function_declaration) + (function_definition) + (parameters) + (arguments) + (table_constructor) ] @fold diff --git a/queries/lua/highlights.scm b/queries/lua/highlights.scm index ea87c0da0..0b0bf35a8 100644 --- a/queries/lua/highlights.scm +++ b/queries/lua/highlights.scm @@ -1,81 +1,79 @@ -;; Keywords - +; Keywords "return" @keyword.return [ - "goto" - "in" - "local" + "goto" + "in" + "local" ] @keyword (break_statement) @keyword (do_statement -[ - "do" - "end" -] @keyword) + [ + "do" + "end" + ] @keyword) (while_statement -[ - "while" - "do" - "end" -] @keyword.repeat) + [ + "while" + "do" + "end" + ] @keyword.repeat) (repeat_statement -[ - "repeat" - "until" -] @keyword.repeat) + [ + "repeat" + "until" + ] @keyword.repeat) (if_statement -[ - "if" - "elseif" - "else" - "then" - "end" -] @keyword.conditional) + [ + "if" + "elseif" + "else" + "then" + "end" + ] @keyword.conditional) (elseif_statement -[ - "elseif" - "then" - "end" -] @keyword.conditional) + [ + "elseif" + "then" + "end" + ] @keyword.conditional) (else_statement -[ - "else" - "end" -] @keyword.conditional) + [ + "else" + "end" + ] @keyword.conditional) (for_statement -[ - "for" - "do" - "end" -] @keyword.repeat) + [ + "for" + "do" + "end" + ] @keyword.repeat) (function_declaration -[ - "function" - "end" -] @keyword.function) + [ + "function" + "end" + ] @keyword.function) (function_definition -[ - "function" - "end" -] @keyword.function) - -;; Operators + [ + "function" + "end" + ] @keyword.function) +; Operators [ - "and" - "not" - "or" + "and" + "not" + "or" ] @keyword.operator [ @@ -102,8 +100,7 @@ ".." ] @operator -;; Punctuations - +; Punctuations [ ";" ":" @@ -112,19 +109,17 @@ "." ] @punctuation.delimiter -;; Brackets - +; Brackets [ - "(" - ")" - "[" - "]" - "{" - "}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket -;; Variables - +; Variables (identifier) @variable ((identifier) @constant.builtin @@ -145,16 +140,16 @@ (identifier) @attribute ">" @punctuation.bracket)) -;; Labels - -(label_statement (identifier) @label) - -(goto_statement (identifier) @label) +; Labels +(label_statement + (identifier) @label) -;; Constants +(goto_statement + (identifier) @label) +; Constants ((identifier) @constant - (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) + (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) (vararg_expression) @constant @@ -165,43 +160,49 @@ (true) ] @boolean -;; Tables +; Tables +(field + name: (identifier) @variable.member) -(field name: (identifier) @variable.member) - -(dot_index_expression field: (identifier) @variable.member) +(dot_index_expression + field: (identifier) @variable.member) (table_constructor -[ - "{" - "}" -] @constructor) - -;; Functions + [ + "{" + "}" + ] @constructor) -(parameters (identifier) @variable.parameter) +; Functions +(parameters + (identifier) @variable.parameter) (vararg_expression) @variable.parameter.builtin (function_declaration - name: [ - (identifier) @function - (dot_index_expression - field: (identifier) @function) - ]) - -(function_declaration - name: (method_index_expression - method: (identifier) @function.method)) - -(assignment_statement - (variable_list . - name: [ + name: + [ (identifier) @function (dot_index_expression field: (identifier) @function) ]) - (expression_list . + +(function_declaration + name: + (method_index_expression + method: (identifier) @function.method)) + +(assignment_statement + (variable_list + . + name: + [ + (identifier) @function + (dot_index_expression + field: (identifier) @function) + ]) + (expression_list + . value: (function_definition))) (table_constructor @@ -210,13 +211,14 @@ value: (function_definition))) (function_call - name: [ - (identifier) @function.call - (dot_index_expression - field: (identifier) @function.call) - (method_index_expression - method: (identifier) @function.method.call) - ]) + name: + [ + (identifier) @function.call + (dot_index_expression + field: (identifier) @function.call) + (method_index_expression + method: (identifier) @function.method.call) + ]) (function_call (identifier) @function.builtin @@ -231,8 +233,7 @@ "__idiv" "__index" "__le" "__len" "__lt" "__metatable" "__mod" "__mul" "__name" "__newindex" "__pairs" "__pow" "__shl" "__shr" "__sub" "__tostring" "__unm")) -;; Others - +; Others (comment) @comment @spell ((comment) @comment.documentation @@ -254,17 +255,21 @@ (dot_index_expression field: (identifier) @_method (#any-of? @_method "find" "match" "gmatch" "gsub")) - arguments: (arguments - . (_) - . - (string - content: (string_content) @string.regexp))) + arguments: + (arguments + . + (_) + . + (string + content: (string_content) @string.regexp))) ;("123"):match("%d+") (function_call (method_index_expression method: (identifier) @_method (#any-of? @_method "find" "match" "gmatch" "gsub")) - arguments: (arguments - . (string - content: (string_content) @string.regexp))) + arguments: + (arguments + . + (string + content: (string_content) @string.regexp))) diff --git a/queries/lua/indents.scm b/queries/lua/indents.scm index 1125e6485..2c3dc2448 100644 --- a/queries/lua/indents.scm +++ b/queries/lua/indents.scm @@ -40,4 +40,3 @@ (comment) @indent.auto (string) @indent.auto - diff --git a/queries/lua/injections.scm b/queries/lua/injections.scm index 2ce156574..6042ea260 100644 --- a/queries/lua/injections.scm +++ b/queries/lua/injections.scm @@ -1,29 +1,48 @@ ((function_call - name: [ - (identifier) @_cdef_identifier - (_ _ (identifier) @_cdef_identifier) - ] - arguments: - (arguments - (string content: _ @injection.content))) + name: + [ + (identifier) @_cdef_identifier + (_ + _ + (identifier) @_cdef_identifier) + ] + arguments: + (arguments + (string + content: _ @injection.content))) (#set! injection.language "c") (#eq? @_cdef_identifier "cdef")) ((function_call name: (_) @_vimcmd_identifier - arguments: (arguments (string content: _ @injection.content))) + arguments: + (arguments + (string + content: _ @injection.content))) (#set! injection.language "vim") (#any-of? @_vimcmd_identifier "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_command" "vim.api.nvim_exec2")) ((function_call name: (_) @_vimcmd_identifier - arguments: (arguments (string content: _ @injection.content) .)) + arguments: + (arguments + (string + content: _ @injection.content) .)) (#set! injection.language "query") (#any-of? @_vimcmd_identifier "vim.treesitter.query.set" "vim.treesitter.query.parse")) ((function_call name: (_) @_vimcmd_identifier - arguments: (arguments . (_) . (string content: _ @_method) . (string content: _ @injection.content))) + arguments: + (arguments + . + (_) + . + (string + content: _ @_method) + . + (string + content: _ @injection.content))) (#any-of? @_vimcmd_identifier "vim.rpcrequest" "vim.rpcnotify") (#eq? @_method "nvim_exec_lua") (#set! injection.language "lua")) @@ -33,46 +52,52 @@ name: (_) @_vimcmd_identifier arguments: (arguments - . (_) - . + . + (_) + . (table_constructor (field name: (identifier) @_command - value: - (string content: (_) @injection.content))) - .) ; limit so only 2-argument functions gets matched before pred handle + value: + (string + content: (_) @injection.content))) .) + ; limit so only 2-argument functions gets matched before pred handle (#eq? @_vimcmd_identifier "vim.api.nvim_create_autocmd") (#eq? @_command "command") (#set! injection.language "vim")) - (function_call name: (_) @_user_cmd - arguments: + arguments: (arguments - . (_) - . + . + (_) + . (string content: (_) @injection.content) - . (_) .) + . + (_) .) (#eq? @_user_cmd "vim.api.nvim_create_user_command") (#set! injection.language "vim")) (function_call name: (_) @_user_cmd - arguments: + arguments: (arguments - . (_) - . (_) - . + . + (_) + . + (_) + . (string content: (_) @injection.content) - . (_) - .) ; Limiting predicate handling to only functions with 4 arguments + . + (_) .) + ; Limiting predicate handling to only functions with 4 arguments (#eq? @_user_cmd "vim.api.nvim_buf_create_user_command") (#set! injection.language "vim")) -;; rhs highlighting for vim.keymap.set/vim.api.nvim_set_keymap/vim.api.nvim_buf_set_keymap +; rhs highlighting for vim.keymap.set/vim.api.nvim_set_keymap/vim.api.nvim_buf_set_keymap ; (function_call ; name: (_) @_map ; arguments: @@ -92,17 +117,17 @@ ; . (_) ; . (_) ; . (_) -; . +; . ; (string ; content: (_) @injection.content) ; . (_) .) ; (#eq? @_map "vim.api.nvim_buf_set_keymap") ; (#set! injection.language "vim")) - -;; highlight string as query if starts with `;; query` -(string content: _ @injection.content - (#lua-match? @injection.content "^%s*;+%s?query") - (#set! injection.language "query")) +; highlight string as query if starts with `;; query` +(string + content: _ @injection.content + (#lua-match? @injection.content "^%s*;+%s?query") + (#set! injection.language "query")) (comment content: (_) @injection.content @@ -111,48 +136,56 @@ (#offset! @injection.content 0 1 0 0)) ; string.match("123", "%d+") - (function_call (dot_index_expression field: (identifier) @_method (#any-of? @_method "find" "match" "gmatch" "gsub")) - arguments: (arguments - . (_) - . - (string - content: (string_content) @injection.content - (#set! injection.language "luap") - (#set! injection.include-children)))) + arguments: + (arguments + . + (_) + . + (string + content: (string_content) @injection.content + (#set! injection.language "luap") + (#set! injection.include-children)))) ;("123"):match("%d+") - (function_call (method_index_expression method: (identifier) @_method (#any-of? @_method "find" "match" "gmatch" "gsub")) - arguments: (arguments - . (string - content: (string_content) @injection.content - (#set! injection.language "luap") - (#set! injection.include-children)))) + arguments: + (arguments + . + (string + content: (string_content) @injection.content + (#set! injection.language "luap") + (#set! injection.include-children)))) ; string.format("pi = %.2f", 3.14159) ((function_call (dot_index_expression field: (identifier) @_method) - arguments: (arguments - . (string (string_content) @injection.content))) - (#eq? @_method "format") - (#set! injection.language "printf")) + arguments: + (arguments + . + (string + (string_content) @injection.content))) + (#eq? @_method "format") + (#set! injection.language "printf")) ; ("pi = %.2f"):format(3.14159) ((function_call (method_index_expression - table: (_ (string (string_content) @injection.content)) + table: + (_ + (string + (string_content) @injection.content)) method: (identifier) @_method)) - (#eq? @_method "format") - (#set! injection.language "printf")) + (#eq? @_method "format") + (#set! injection.language "printf")) (comment - content: (_) @injection.content + content: (_) @injection.content (#set! injection.language "comment")) diff --git a/queries/lua/locals.scm b/queries/lua/locals.scm index ef927e517..8f50e844f 100644 --- a/queries/lua/locals.scm +++ b/queries/lua/locals.scm @@ -1,5 +1,4 @@ ; Scopes - [ (chunk) (do_statement) @@ -12,27 +11,35 @@ ] @local.scope ; Definitions - (assignment_statement (variable_list (identifier) @local.definition.var)) (assignment_statement (variable_list - (dot_index_expression . (_) @local.definition.associated (identifier) @local.definition.var))) + (dot_index_expression + . + (_) @local.definition.associated + (identifier) @local.definition.var))) ((function_declaration name: (identifier) @local.definition.function) (#set! definition.function.scope "parent")) ((function_declaration - name: (dot_index_expression - . (_) @local.definition.associated (identifier) @local.definition.function)) + name: + (dot_index_expression + . + (_) @local.definition.associated + (identifier) @local.definition.function)) (#set! definition.method.scope "parent")) ((function_declaration - name: (method_index_expression - . (_) @local.definition.associated (identifier) @local.definition.method)) + name: + (method_index_expression + . + (_) @local.definition.associated + (identifier) @local.definition.method)) (#set! definition.method.scope "parent")) (for_generic_clause @@ -42,10 +49,8 @@ (for_numeric_clause name: (identifier) @local.definition.var) -(parameters (identifier) @local.definition.parameter) +(parameters + (identifier) @local.definition.parameter) ; References - -[ - (identifier) -] @local.reference +(identifier) @local.reference diff --git a/queries/luadoc/highlights.scm b/queries/luadoc/highlights.scm index 3555039dc..a73fefd27 100644 --- a/queries/luadoc/highlights.scm +++ b/queries/luadoc/highlights.scm @@ -1,5 +1,4 @@ ; Keywords - [ "@module" "@package" @@ -29,13 +28,17 @@ (diagnostic_identifier) ] @keyword -[ - "@async" -] @keyword.coroutine +"@async" @keyword.coroutine -(language_injection "@language" (identifier) @keyword) +(language_injection + "@language" + (identifier) @keyword) -(function_type ["fun" "function"] @keyword.function) +(function_type + [ + "fun" + "function" + ] @keyword.function) (source_annotation filename: (identifier) @string.special.path @@ -44,12 +47,9 @@ (version_annotation version: _ @constant.builtin) -[ - "@return" -] @keyword.return +"@return" @keyword.return ; Qualifiers - [ "public" "protected" @@ -59,9 +59,7 @@ "@private" ] @type.qualifier - ; Variables - (identifier) @variable [ @@ -70,46 +68,56 @@ ] @variable.builtin ; Macros - -(alias_annotation (identifier) @function.macro) +(alias_annotation + (identifier) @function.macro) ; Parameters +(param_annotation + (identifier) @variable.parameter) -(param_annotation (identifier) @variable.parameter) - -(parameter (identifier) @variable.parameter) +(parameter + (identifier) @variable.parameter) ; Fields +(field_annotation + (identifier) @variable.member) -(field_annotation (identifier) @variable.member) - -(table_literal_type field: (identifier) @variable.member) +(table_literal_type + field: (identifier) @variable.member) -(member_type ["#" "."] . (identifier) @variable.member) +(member_type + [ + "#" + "." + ] + . + (identifier) @variable.member) ; Types - -(table_type "table" @type.builtin) +(table_type + "table" @type.builtin) (builtin_type) @type.builtin -(class_annotation (identifier) @type) +(class_annotation + (identifier) @type) -(enum_annotation (identifier) @type) +(enum_annotation + (identifier) @type) -((array_type ["[" "]"] @type) +((array_type + [ + "[" + "]" + ] @type) (#set! "priority" 105)) (type) @type ; Operators - -[ - "|" -] @operator +"|" @operator ; Literals - (string) @module ; only used in @module (literal_type) @string @@ -117,14 +125,25 @@ (number) @number ; Punctuation +[ + "[" + "]" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket - -[ "{" "}" ] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -[ "<" ">" ] @punctuation.bracket +[ + "<" + ">" +] @punctuation.bracket [ "," @@ -139,7 +158,6 @@ ] @punctuation.special ; Comments - (comment) @comment @spell (at_comment @@ -148,5 +166,6 @@ (class_at_comment (identifier) @type - ("extends"? (identifier)? @type) + ("extends"? + (identifier)? @type) (_) @comment @spell) diff --git a/queries/luap/highlights.scm b/queries/luap/highlights.scm index 0f95d4eff..64bb60c85 100644 --- a/queries/luap/highlights.scm +++ b/queries/luap/highlights.scm @@ -4,11 +4,14 @@ ] @punctuation.delimiter (pattern - (character "." @variable.builtin)) + (character + "." @variable.builtin)) [ - "[" "]" - "(" ")" + "[" + "]" + "(" + ")" ] @punctuation.bracket [ @@ -25,12 +28,14 @@ (set (character) @constant) + (negated_set (character) @constant) (class) @keyword -(negated_set "^" @operator) +(negated_set + "^" @operator) (balanced_match (character) @variable.parameter) diff --git a/queries/luau/folds.scm b/queries/luau/folds.scm index 11b644ef6..c35ce1304 100644 --- a/queries/luau/folds.scm +++ b/queries/luau/folds.scm @@ -1,5 +1,2 @@ ; inherits: lua - -[ - (object_type) -] @fold +(object_type) @fold diff --git a/queries/luau/highlights.scm b/queries/luau/highlights.scm index 328401f26..ec765f1b9 100644 --- a/queries/luau/highlights.scm +++ b/queries/luau/highlights.scm @@ -1,35 +1,33 @@ ; Preproc - (hash_bang_line) @keyword.directive -;; Keywords - +; Keywords "return" @keyword.return [ - "local" - "type" - "export" + "local" + "type" + "export" ] @keyword (do_statement -[ - "do" - "end" -] @keyword) + [ + "do" + "end" + ] @keyword) (while_statement -[ - "while" - "do" - "end" -] @keyword.repeat) + [ + "while" + "do" + "end" + ] @keyword.repeat) (repeat_statement -[ - "repeat" - "until" -] @keyword.repeat) + [ + "repeat" + "until" + ] @keyword.repeat) [ (break_statement) @@ -37,48 +35,47 @@ ] @keyword.repeat (if_statement -[ - "if" - "elseif" - "else" - "then" - "end" -] @keyword.conditional) + [ + "if" + "elseif" + "else" + "then" + "end" + ] @keyword.conditional) (elseif_statement -[ - "elseif" - "then" - "end" -] @keyword.conditional) + [ + "elseif" + "then" + "end" + ] @keyword.conditional) (else_statement -[ - "else" - "end" -] @keyword.conditional) + [ + "else" + "end" + ] @keyword.conditional) (for_statement -[ - "for" - "do" - "end" -] @keyword.repeat) + [ + "for" + "do" + "end" + ] @keyword.repeat) (function_declaration -[ - "function" - "end" -] @keyword.function) + [ + "function" + "end" + ] @keyword.function) (function_definition -[ - "function" - "end" -] @keyword.function) - -;; Operators + [ + "function" + "end" + ] @keyword.function) +; Operators [ "and" "not" @@ -117,15 +114,16 @@ "..=" ] @operator -;; Variables - +; Variables (identifier) @variable ; Types +(type + (identifier) @type) -(type (identifier) @type) - -(type (generic_type (identifier) @type)) +(type + (generic_type + (identifier) @type)) (builtin_type) @type.builtin @@ -133,16 +131,17 @@ (#lua-match? @type "^[A-Z]")) ; Typedefs - -(type_definition "type" . (type) @type.definition "=") +(type_definition + "type" + . + (type) @type.definition + "=") ; Constants - ((identifier) @constant - (#lua-match? @constant "^[A-Z][A-Z_0-9]+$")) + (#lua-match? @constant "^[A-Z][A-Z_0-9]+$")) ; Builtins - ((identifier) @constant.builtin (#eq? @constant.builtin "_VERSION")) @@ -155,32 +154,48 @@ ((identifier) @keyword.coroutine (#eq? @keyword.coroutine "coroutine")) -;; Tables +; Tables +(field + name: (identifier) @variable.member) -(field name: (identifier) @variable.member) +(dot_index_expression + field: (identifier) @variable.member) -(dot_index_expression field: (identifier) @variable.member) - -(object_type (identifier) @variable.member) +(object_type + (identifier) @variable.member) (table_constructor -[ - "{" - "}" -] @constructor) + [ + "{" + "}" + ] @constructor) ; Functions +(parameter + . + (identifier) @variable.parameter) -(parameter . (identifier) @variable.parameter) -(function_type (identifier) @variable.parameter) +(function_type + (identifier) @variable.parameter) + +(function_call + name: (identifier) @function.call) + +(function_declaration + name: (identifier) @function) -(function_call name: (identifier) @function.call) -(function_declaration name: (identifier) @function) +(function_call + name: + (dot_index_expression + field: (identifier) @function.call)) -(function_call name: (dot_index_expression field: (identifier) @function.call)) -(function_declaration name: (dot_index_expression field: (identifier) @function)) +(function_declaration + name: + (dot_index_expression + field: (identifier) @function)) -(method_index_expression method: (identifier) @function.method.call) +(method_index_expression + method: (identifier) @function.method.call) (function_call (identifier) @function.builtin @@ -196,7 +211,6 @@ "__pairs" "__pow" "__shl" "__shr" "__sub" "__tostring" "__unm")) ; Literals - (number) @number (string) @string @@ -210,8 +224,7 @@ (true) ] @boolean -;; Punctuations - +; Punctuations [ ";" ":" @@ -222,24 +235,36 @@ ] @punctuation.delimiter [ - "(" - ")" - "[" - "]" - "{" - "}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket (variable_list - attribute: (attribute - (["<" ">"] @punctuation.bracket - (identifier) @attribute))) + attribute: + (attribute + ([ + "<" + ">" + ] @punctuation.bracket + (identifier) @attribute))) -(generic_type [ "<" ">" ] @punctuation.bracket) -(generic_type_list [ "<" ">" ] @punctuation.bracket) +(generic_type + [ + "<" + ">" + ] @punctuation.bracket) -; Comments +(generic_type_list + [ + "<" + ">" + ] @punctuation.bracket) +; Comments (comment) @comment @spell ((comment) @comment.documentation @@ -253,11 +278,21 @@ (dot_index_expression field: (identifier) @_method (#any-of? @_method "find" "format" "match" "gmatch" "gsub")) - arguments: (arguments . (_) . (string content: _ @string.regexp))) + arguments: + (arguments + . + (_) + . + (string + content: _ @string.regexp))) ; ("123"):match("%d+") (function_call (method_index_expression method: (identifier) @_method (#any-of? @_method "find" "format" "match" "gmatch" "gsub")) - arguments: (arguments . (string content: _ @string.regexp))) + arguments: + (arguments + . + (string + content: _ @string.regexp))) diff --git a/queries/luau/indents.scm b/queries/luau/indents.scm index e03d0ff48..03da6320b 100644 --- a/queries/luau/indents.scm +++ b/queries/luau/indents.scm @@ -1,5 +1,2 @@ ; inherits: lua - -[ - (object_type) -] @indent.begin +(object_type) @indent.begin diff --git a/queries/luau/injections.scm b/queries/luau/injections.scm index 4edc7f5e4..4563f8ed4 100644 --- a/queries/luau/injections.scm +++ b/queries/luau/injections.scm @@ -1,9 +1,15 @@ ((function_call - name: [ - (identifier) @_cdef_identifier - (_ _ (identifier) @_cdef_identifier) - ] - arguments: (arguments (string content: _ @injection.content))) + name: + [ + (identifier) @_cdef_identifier + (_ + _ + (identifier) @_cdef_identifier) + ] + arguments: + (arguments + (string + content: _ @injection.content))) (#eq? @_cdef_identifier "cdef") (#set! injection.language "c")) @@ -17,16 +23,26 @@ (dot_index_expression field: (identifier) @_method (#any-of? @_method "find" "format" "match" "gmatch" "gsub")) - arguments: (arguments . (_) . (string content: _ @injection.content)) - (#set! injection.language "luap")) + arguments: + (arguments + . + (_) + . + (string + content: _ @injection.content)) + (#set! injection.language "luap")) ; ("123"):match("%d+") (function_call (method_index_expression method: (identifier) @_method (#any-of? @_method "find" "format" "match" "gmatch" "gsub")) - arguments: (arguments . (string content: _ @injection.content)) - (#set! injection.language "luap")) + arguments: + (arguments + . + (string + content: _ @injection.content)) + (#set! injection.language "luap")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/luau/locals.scm b/queries/luau/locals.scm index d0581b890..8e45c4743 100644 --- a/queries/luau/locals.scm +++ b/queries/luau/locals.scm @@ -1,5 +1,4 @@ ; Scopes - [ (chunk) (do_statement) @@ -12,33 +11,38 @@ ] @local.scope ; References - -[ - (identifier) -] @local.reference +(identifier) @local.reference ; Definitions - (assignment_statement (variable_list (identifier) @local.definition.var)) (assignment_statement (variable_list - (dot_index_expression . (_) @local.definition.associated (identifier) @local.definition.var))) + (dot_index_expression + . + (_) @local.definition.associated + (identifier) @local.definition.var))) ((function_declaration name: (identifier) @local.definition.function) (#set! definition.function.scope "parent")) ((function_declaration - name: (dot_index_expression - . (_) @local.definition.associated (identifier) @local.definition.function)) + name: + (dot_index_expression + . + (_) @local.definition.associated + (identifier) @local.definition.function)) (#set! definition.method.scope "parent")) ((function_declaration - name: (method_index_expression - . (_) @local.definition.associated (identifier) @local.definition.method)) + name: + (method_index_expression + . + (_) @local.definition.associated + (identifier) @local.definition.method)) (#set! definition.method.scope "parent")) (for_generic_clause @@ -48,4 +52,5 @@ (for_numeric_clause name: (identifier) @local.definition.var) -(parameter (identifier) @local.definition.parameter) +(parameter + (identifier) @local.definition.parameter) diff --git a/queries/m68k/highlights.scm b/queries/m68k/highlights.scm index e37c55ae0..72a5504d6 100644 --- a/queries/m68k/highlights.scm +++ b/queries/m68k/highlights.scm @@ -1,23 +1,32 @@ (symbol) @variable -(label name: (symbol) @label) +(label + name: (symbol) @label) [ (instruction_mnemonic) (directive_mnemonic) ] @function.builtin -(include (directive_mnemonic) @keyword.import) -(include_bin (directive_mnemonic) @keyword.import) -(include_dir (directive_mnemonic) @keyword.import) +(include + (directive_mnemonic) @keyword.import) +(include_bin + (directive_mnemonic) @keyword.import) + +(include_dir + (directive_mnemonic) @keyword.import) (size) @attribute -(macro_definition name: (symbol) @function.macro) -(macro_call name: (symbol) @function.macro) +(macro_definition + name: (symbol) @function.macro) + +(macro_call + name: (symbol) @function.macro) (string_literal) @string + (path) @string.special.path [ @@ -30,7 +39,7 @@ [ (reptn) (carg) - (narg) + (narg) (macro_arg) ] @variable.builtin @@ -42,8 +51,11 @@ (named_register) ] @keyword -(repeat (control_mnemonic) @keyword.repeat) -(conditional (control_mnemonic) @keyword.conditional) +(repeat + (control_mnemonic) @keyword.repeat) + +(conditional + (control_mnemonic) @keyword.conditional) (comment) @comment @spell diff --git a/queries/m68k/injections.scm b/queries/m68k/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/m68k/injections.scm +++ b/queries/m68k/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/m68k/locals.scm b/queries/m68k/locals.scm index 737352e87..6e958b6f5 100644 --- a/queries/m68k/locals.scm +++ b/queries/m68k/locals.scm @@ -6,17 +6,22 @@ (label name: (symbol) @local.definition.constant) + (symbol_definition name: (symbol) @local.definition.constant) + (offset_definition name: (symbol) @local.definition.constant) + (register_definition name: (symbol) @local.definition.constant) + (register_list_definition name: (symbol) @local.definition.constant) (external_reference - symbols: (symbol_list - (symbol) @local.definition.import)) + symbols: + (symbol_list + (symbol) @local.definition.import)) (symbol) @local.reference diff --git a/queries/make/folds.scm b/queries/make/folds.scm index a2b472761..961f4ec7d 100644 --- a/queries/make/folds.scm +++ b/queries/make/folds.scm @@ -1,7 +1,5 @@ -( - [ - (conditional) - (rule) - ] @fold - (#trim! @fold) -) +([ + (conditional) + (rule) +] @fold + (#trim! @fold)) diff --git a/queries/make/highlights.scm b/queries/make/highlights.scm index e1d7aa4f7..1777aa610 100644 --- a/queries/make/highlights.scm +++ b/queries/make/highlights.scm @@ -1,140 +1,147 @@ (comment) @comment @spell (conditional - (_ [ - "ifeq" - "else" - "ifneq" - "ifdef" - "ifndef" - ] @keyword.conditional) - "endif" @keyword.conditional) + (_ + [ + "ifeq" + "else" + "ifneq" + "ifdef" + "ifndef" + ] @keyword.conditional) + "endif" @keyword.conditional) -(rule (targets (word) @function)) +(rule + (targets + (word) @function)) + +(rule + (targets) @_target + (prerequisites + (word) @function + (#eq? @_target ".PHONY"))) (rule - (targets) @_target - (prerequisites (word) @function - (#eq? @_target ".PHONY"))) + (targets + (word) @function.builtin + (#any-of? @function.builtin ".DEFAULT" ".SUFFIXES" ".DELETE_ON_ERROR" ".EXPORT_ALL_VARIABLES" ".IGNORE" ".INTERMEDIATE" ".LOW_RESOLUTION_TIME" ".NOTPARALLEL" ".ONESHELL" ".PHONY" ".POSIX" ".PRECIOUS" ".SECONDARY" ".SECONDEXPANSION" ".SILENT" ".SUFFIXES"))) -(rule (targets - (word) @function.builtin - (#any-of? @function.builtin - ".DEFAULT" - ".SUFFIXES" - ".DELETE_ON_ERROR" - ".EXPORT_ALL_VARIABLES" - ".IGNORE" - ".INTERMEDIATE" - ".LOW_RESOLUTION_TIME" - ".NOTPARALLEL" - ".ONESHELL" - ".PHONY" - ".POSIX" - ".PRECIOUS" - ".SECONDARY" - ".SECONDEXPANSION" - ".SILENT" - ".SUFFIXES"))) +(rule + [ + "&:" + ":" + "::" + ] @operator) + +(export_directive + "export" @keyword) -(rule ["&:" ":" "::"] @operator) +(override_directive + "override" @keyword) -(export_directive "export" @keyword) -(override_directive "override" @keyword) (include_directive - ["include" "-include"] @keyword.import - filenames: (list (word) @string.special.path)) + [ + "include" + "-include" + ] @keyword.import + filenames: + (list + (word) @string.special.path)) (variable_assignment - name: (word) @string.special.symbol - [ - "?=" - ":=" - "::=" -; ":::=" - "+=" - "=" - ] @operator) + name: (word) @string.special.symbol + [ + "?=" + ":=" + "::=" + ; ":::=" + "+=" + "=" + ] @operator) (shell_assignment - name: (word) @string.special.symbol - "!=" @operator) + name: (word) @string.special.symbol + "!=" @operator) (define_directive - "define" @keyword - name: (word) @string.special.symbol - [ - "=" - ":=" - "::=" -; ":::=" - "?=" - "!=" - ]? @operator - "endef" @keyword) + "define" @keyword + name: (word) @string.special.symbol + [ + "=" + ":=" + "::=" + ; ":::=" + "?=" + "!=" + ]? + @operator + "endef" @keyword) (variable_assignment - (word) @variable.builtin (#any-of? @variable.builtin - ".DEFAULT_GOAL" - ".EXTRA_PREREQS" - ".FEATURES" - ".INCLUDE_DIRS" - ".RECIPEPREFIX" - ".SHELLFLAGS" - ".VARIABLES" - "MAKEARGS" - "MAKEFILE_LIST" - "MAKEFLAGS" - "MAKE_RESTARTS" - "MAKE_TERMERR" - "MAKE_TERMOUT" - "SHELL" - )) + (word) @variable.builtin + (#any-of? @variable.builtin ".DEFAULT_GOAL" ".EXTRA_PREREQS" ".FEATURES" ".INCLUDE_DIRS" ".RECIPEPREFIX" ".SHELLFLAGS" ".VARIABLES" "MAKEARGS" "MAKEFILE_LIST" "MAKEFLAGS" "MAKE_RESTARTS" "MAKE_TERMERR" "MAKE_TERMOUT" "SHELL")) ; Use string to match bash -(variable_reference (word) @string) @operator +(variable_reference + (word) @string) @operator (shell_function - ["$" "(" ")"] @operator - "shell" @function.builtin) + [ + "$" + "(" + ")" + ] @operator + "shell" @function.builtin) + +(function_call + [ + "$" + "(" + ")" + ] @operator) -(function_call ["$" "(" ")"] @operator) -(substitution_reference ["$" "(" ")"] @operator) +(substitution_reference + [ + "$" + "(" + ")" + ] @operator) -(function_call [ - "subst" - "patsubst" - "strip" - "findstring" - "filter" - "filter-out" - "sort" - "word" - "words" - "wordlist" - "firstword" - "lastword" - "dir" - "notdir" - "suffix" - "basename" - "addsuffix" - "addprefix" - "join" - "wildcard" - "realpath" - "abspath" - "error" - "warning" - "info" - "origin" - "flavor" - "foreach" - "if" - "or" - "and" - "call" - "eval" - "file" - "value" - ] @function.builtin) +(function_call + [ + "subst" + "patsubst" + "strip" + "findstring" + "filter" + "filter-out" + "sort" + "word" + "words" + "wordlist" + "firstword" + "lastword" + "dir" + "notdir" + "suffix" + "basename" + "addsuffix" + "addprefix" + "join" + "wildcard" + "realpath" + "abspath" + "error" + "warning" + "info" + "origin" + "flavor" + "foreach" + "if" + "or" + "and" + "call" + "eval" + "file" + "value" + ] @function.builtin) diff --git a/queries/make/injections.scm b/queries/make/injections.scm index 646daadd0..c9c09be5d 100644 --- a/queries/make/injections.scm +++ b/queries/make/injections.scm @@ -1,7 +1,8 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((shell_text) @injection.content - (#set! injection.language "bash")) + (#set! injection.language "bash")) + ((shell_command) @injection.content - (#set! injection.language "bash")) + (#set! injection.language "bash")) diff --git a/queries/markdown/folds.scm b/queries/markdown/folds.scm index 5900f7ffb..a682e20e0 100644 --- a/queries/markdown/folds.scm +++ b/queries/markdown/folds.scm @@ -1,9 +1,7 @@ -( - [ - (fenced_code_block) - (indented_code_block) - (list) - (section) - ] @fold - (#trim! @fold) -) +([ + (fenced_code_block) + (indented_code_block) + (list) + (section) +] @fold + (#trim! @fold)) diff --git a/queries/markdown/highlights.scm b/queries/markdown/highlights.scm index aa7b6a66c..92c0e7486 100644 --- a/queries/markdown/highlights.scm +++ b/queries/markdown/highlights.scm @@ -1,24 +1,53 @@ ;From MDeiml/tree-sitter-markdown & Helix -(setext_heading (paragraph) @markup.heading.1 (setext_h1_underline) @markup.heading.1.marker) -(setext_heading (paragraph) @markup.heading.2 (setext_h2_underline) @markup.heading.2.marker) +(setext_heading + (paragraph) @markup.heading.1 + (setext_h1_underline) @markup.heading.1.marker) -(atx_heading (atx_h1_marker) @markup.heading.1.marker (inline) @markup.heading.1) -(atx_heading (atx_h2_marker) @markup.heading.2.marker (inline) @markup.heading.2) -(atx_heading (atx_h3_marker) @markup.heading.3.marker (inline) @markup.heading.3) -(atx_heading (atx_h4_marker) @markup.heading.4.marker (inline) @markup.heading.4) -(atx_heading (atx_h5_marker) @markup.heading.5.marker (inline) @markup.heading.5) -(atx_heading (atx_h6_marker) @markup.heading.6.marker (inline) @markup.heading.6) +(setext_heading + (paragraph) @markup.heading.2 + (setext_h2_underline) @markup.heading.2.marker) + +(atx_heading + (atx_h1_marker) @markup.heading.1.marker + (inline) @markup.heading.1) + +(atx_heading + (atx_h2_marker) @markup.heading.2.marker + (inline) @markup.heading.2) + +(atx_heading + (atx_h3_marker) @markup.heading.3.marker + (inline) @markup.heading.3) + +(atx_heading + (atx_h4_marker) @markup.heading.4.marker + (inline) @markup.heading.4) + +(atx_heading + (atx_h5_marker) @markup.heading.5.marker + (inline) @markup.heading.5) + +(atx_heading + (atx_h6_marker) @markup.heading.6.marker + (inline) @markup.heading.6) (info_string) @label -(pipe_table_header (pipe_table_cell) @markup.heading) +(pipe_table_header + (pipe_table_cell) @markup.heading) + +(pipe_table_header + "|" @punctuation.special) + +(pipe_table_row + "|" @punctuation.special) + +(pipe_table_delimiter_row + "|" @punctuation.special) -(pipe_table_header "|" @punctuation.special) -(pipe_table_row "|" @punctuation.special) -(pipe_table_delimiter_row "|" @punctuation.special) (pipe_table_delimiter_cell) @punctuation.special -;; Code blocks (conceal backticks and language annotation) +; Code blocks (conceal backticks and language annotation) (indented_code_block) @markup.raw.block ((fenced_code_block) @markup.raw.block @@ -33,9 +62,7 @@ (language) @conceal (#set! conceal ""))) -[ - (link_destination) -] @markup.link.url +(link_destination) @markup.link.url [ (link_title) @@ -71,23 +98,22 @@ ; @punctuation.special ; (#eq? @punctuation.special "-") ; (#set! conceal "—")) - (code_fence_content) @none (thematic_break) @punctuation.special (task_list_marker_unchecked) @markup.list.unchecked + (task_list_marker_checked) @markup.list.checked -((block_quote) @markup.quote (#set! "priority" 90)) +((block_quote) @markup.quote + (#set! "priority" 90)) [ (block_continuation) (block_quote_marker) ] @punctuation.special -[ - (backslash_escape) -] @string.escape +(backslash_escape) @string.escape (inline) @spell diff --git a/queries/markdown/indents.scm b/queries/markdown/indents.scm index 6d13122f4..90c52d3d0 100644 --- a/queries/markdown/indents.scm +++ b/queries/markdown/indents.scm @@ -1,3 +1 @@ -[ - (list_item) -] @indent.auto +(list_item) @indent.auto diff --git a/queries/markdown/injections.scm b/queries/markdown/injections.scm index 735189db1..8ed205296 100644 --- a/queries/markdown/injections.scm +++ b/queries/markdown/injections.scm @@ -4,23 +4,23 @@ (code_fence_content) @injection.content (#set-lang-from-info-string! @_lang)) -((html_block) @injection.content - (#set! injection.language "html") - (#set! injection.combined) - (#set! injection.include-children)) +((html_block) @injection.content + (#set! injection.language "html") + (#set! injection.combined) + (#set! injection.include-children)) -((minus_metadata) @injection.content - (#set! injection.language "yaml") - (#offset! @injection.content 1 0 -1 0) - (#set! injection.include-children)) +((minus_metadata) @injection.content + (#set! injection.language "yaml") + (#offset! @injection.content 1 0 -1 0) + (#set! injection.include-children)) -((plus_metadata) @injection.content - (#set! injection.language "toml") - (#offset! @injection.content 1 0 -1 0) - (#set! injection.include-children)) +((plus_metadata) @injection.content + (#set! injection.language "toml") + (#offset! @injection.content 1 0 -1 0) + (#set! injection.include-children)) ([ (inline) (pipe_table_cell) - ] @injection.content - (#set! injection.language "markdown_inline")) +] @injection.content + (#set! injection.language "markdown_inline")) diff --git a/queries/markdown_inline/highlights.scm b/queries/markdown_inline/highlights.scm index a1f63328b..d9f48296d 100644 --- a/queries/markdown_inline/highlights.scm +++ b/queries/markdown_inline/highlights.scm @@ -1,4 +1,4 @@ -;; From MDeiml/tree-sitter-markdown +; From MDeiml/tree-sitter-markdown (code_span) @markup.raw @nospell (emphasis) @markup.italic @@ -12,7 +12,8 @@ (uri_autolink) ] @markup.link.url @nospell -(shortcut_link (link_text) @nospell) +(shortcut_link + (link_text) @nospell) [ (link_label) @@ -29,6 +30,7 @@ ; Conceal codeblock and text style markers ((code_span_delimiter) @markup.raw (#set! conceal "")) + ((emphasis_delimiter) @markup.strong (#set! conceal "")) @@ -80,10 +82,27 @@ ] @markup.link (#set! conceal "")) -;; Replace common HTML entities. -((entity_reference) @character.special (#eq? @character.special " ") (#set! conceal "")) -((entity_reference) @character.special (#eq? @character.special "<") (#set! conceal "<")) -((entity_reference) @character.special (#eq? @character.special ">") (#set! conceal ">")) -((entity_reference) @character.special (#eq? @character.special "&") (#set! conceal "&")) -((entity_reference) @character.special (#eq? @character.special """) (#set! conceal "\"")) -((entity_reference) @character.special (#any-of? @character.special " " " ") (#set! conceal " ")) +; Replace common HTML entities. +((entity_reference) @character.special + (#eq? @character.special " ") + (#set! conceal "")) + +((entity_reference) @character.special + (#eq? @character.special "<") + (#set! conceal "<")) + +((entity_reference) @character.special + (#eq? @character.special ">") + (#set! conceal ">")) + +((entity_reference) @character.special + (#eq? @character.special "&") + (#set! conceal "&")) + +((entity_reference) @character.special + (#eq? @character.special """) + (#set! conceal "\"")) + +((entity_reference) @character.special + (#any-of? @character.special " " " ") + (#set! conceal " ")) diff --git a/queries/markdown_inline/injections.scm b/queries/markdown_inline/injections.scm index d665574ff..6448b77c1 100644 --- a/queries/markdown_inline/injections.scm +++ b/queries/markdown_inline/injections.scm @@ -1,7 +1,7 @@ ((html_tag) @injection.content - (#set! injection.language "html") - (#set! injection.combined)) + (#set! injection.language "html") + (#set! injection.combined)) ((latex_block) @injection.content - (#set! injection.language "latex") - (#set! injection.include-children)) + (#set! injection.language "latex") + (#set! injection.include-children)) diff --git a/queries/matlab/folds.scm b/queries/matlab/folds.scm index dad9ea177..83008b3d7 100644 --- a/queries/matlab/folds.scm +++ b/queries/matlab/folds.scm @@ -1,11 +1,13 @@ -[(if_statement) - (for_statement) - (while_statement) - (switch_statement) - (try_statement) - (function_definition) - (class_definition) - (enumeration) - (events) - (methods) - (properties)] @fold +[ + (if_statement) + (for_statement) + (while_statement) + (switch_statement) + (try_statement) + (function_definition) + (class_definition) + (enumeration) + (events) + (methods) + (properties) +] @fold diff --git a/queries/matlab/highlights.scm b/queries/matlab/highlights.scm index a2e73ee62..7a1b6c40a 100644 --- a/queries/matlab/highlights.scm +++ b/queries/matlab/highlights.scm @@ -1,10 +1,8 @@ ; Includes - ((command_name) @keyword.import (#eq? @keyword.import "import")) ; Keywords - [ "arguments" "classdef" @@ -18,91 +16,149 @@ ] @keyword ; Conditionals +(if_statement + [ + "if" + "end" + ] @keyword.conditional) + +(elseif_clause + "elseif" @keyword.conditional) + +(else_clause + "else" @keyword.conditional) + +(switch_statement + [ + "switch" + "end" + ] @keyword.conditional) + +(case_clause + "case" @keyword.conditional) + +(otherwise_clause + "otherwise" @keyword.conditional) -(if_statement [ "if" "end" ] @keyword.conditional) -(elseif_clause "elseif" @keyword.conditional) -(else_clause "else" @keyword.conditional) -(switch_statement [ "switch" "end" ] @keyword.conditional) -(case_clause "case" @keyword.conditional) -(otherwise_clause "otherwise" @keyword.conditional) (break_statement) @keyword.conditional ; Repeats +(for_statement + [ + "for" + "parfor" + "end" + ] @keyword.repeat) + +(while_statement + [ + "while" + "end" + ] @keyword.repeat) -(for_statement [ "for" "parfor" "end" ] @keyword.repeat) -(while_statement [ "while" "end" ] @keyword.repeat) (continue_statement) @keyword.repeat ; Exceptions +(try_statement + [ + "try" + "end" + ] @keyword.exception) -(try_statement [ "try" "end" ] @keyword.exception) -(catch_clause "catch" @keyword.exception) +(catch_clause + "catch" @keyword.exception) ; Variables - (identifier) @variable ; Constants +(events + (identifier) @constant) -(events (identifier) @constant) -(attribute (identifier) @constant) +(attribute + (identifier) @constant) "~" @constant.builtin ; Fields/Properties +(field_expression + field: (identifier) @variable.member) -(field_expression field: (identifier) @variable.member) +(superclass + "." + (identifier) @property) -(superclass "." (identifier) @property) +(property_name + "." + (identifier) @property) -(property_name "." (identifier) @property) - -(property name: (identifier) @property) +(property + name: (identifier) @property) ; Types +(class_definition + name: (identifier) @type) -(class_definition name: (identifier) @type) - -(attributes (identifier) @constant) +(attributes + (identifier) @constant) -(enum . (identifier) @type) +(enum + . + (identifier) @type) ((identifier) @type (#lua-match? @type "^_*[A-Z][a-zA-Z0-9_]+$")) ; Functions - (function_definition "function" @keyword.function name: (identifier) @function - [ "end" "endfunction" ]? @keyword.function) + [ + "end" + "endfunction" + ]? + @keyword.function) -(function_signature name: (identifier) @function) +(function_signature + name: (identifier) @function) (function_call name: (identifier) @function.call) -(handle_operator (identifier) @function) +(handle_operator + (identifier) @function) + +(validation_functions + (identifier) @function) -(validation_functions (identifier) @function) +(command + (command_name) @function.call) -(command (command_name) @function.call) (command_argument) @variable.parameter (return_statement) @keyword.return ; Parameters - -(function_arguments (identifier) @variable.parameter) +(function_arguments + (identifier) @variable.parameter) ; Punctuation +[ + ";" + "," + "." +] @punctuation.delimiter -[ ";" "," "." ] @punctuation.delimiter - -[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket ; Operators - [ "+" ".+" @@ -135,10 +191,10 @@ ] @operator ; Literals - (string) @string (escape_sequence) @string.escape + (formatting_sequence) @string.special (number) @number @@ -146,5 +202,7 @@ (boolean) @boolean ; Comments - -[ (comment) (line_continuation) ] @comment @spell +[ + (comment) + (line_continuation) +] @comment @spell diff --git a/queries/matlab/indents.scm b/queries/matlab/indents.scm index 46889a280..c217879d3 100644 --- a/queries/matlab/indents.scm +++ b/queries/matlab/indents.scm @@ -22,14 +22,18 @@ "catch" ] @indent.branch -((matrix (row) @indent.align) - (#set! indent.open_delimiter "[") - (#set! indent.close_delimiter "]")) -((cell (row) @indent.align) - (#set! indent.open_delimiter "{") - (#set! indent.close_delimiter "}")) +((matrix + (row) @indent.align) + (#set! indent.open_delimiter "[") + (#set! indent.close_delimiter "]")) + +((cell + (row) @indent.align) + (#set! indent.open_delimiter "{") + (#set! indent.close_delimiter "}")) + ((parenthesis) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) (comment) @indent.auto diff --git a/queries/matlab/injections.scm b/queries/matlab/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/matlab/injections.scm +++ b/queries/matlab/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/matlab/locals.scm b/queries/matlab/locals.scm index ec2d8d52a..366c82027 100644 --- a/queries/matlab/locals.scm +++ b/queries/matlab/locals.scm @@ -1,20 +1,33 @@ ; References - (identifier) @local.reference ; Definitions - (function_definition name: (identifier) @local.definition.function (function_arguments (identifier)* @local.definition.parameter - ("," (identifier) @local.definition.parameter)*)?) @local.scope + ("," + (identifier) @local.definition.parameter)*)?) @local.scope + +(assignment + left: (identifier) @local.definition.var) + +(multioutput_variable + (identifier) @local.definition.var) + +(iterator + . + (identifier) @local.definition.var) + +(lambda + (arguments + (identifier) @local.definition.parameter)) + +(global_operator + (identifier) @local.definition.var) -(assignment left: (identifier) @local.definition.var) -(multioutput_variable (identifier) @local.definition.var) +(persistent_operator + (identifier) @local.definition.var) -(iterator . (identifier) @local.definition.var) -(lambda (arguments (identifier) @local.definition.parameter)) -(global_operator (identifier) @local.definition.var) -(persistent_operator (identifier) @local.definition.var) -(catch_clause (identifier) @local.definition) +(catch_clause + (identifier) @local.definition) diff --git a/queries/menhir/highlights.scm b/queries/menhir/highlights.scm index 8c4e402c0..6a7ceb085 100644 --- a/queries/menhir/highlights.scm +++ b/queries/menhir/highlights.scm @@ -1,21 +1,60 @@ -["%parameter" "%token" "%type" "%start" "%attribute" "%left" "%right" "%nonassoc" "%public" "%inline" "%prec"] @keyword -["%on_error_reduce"] @keyword.exception +[ + "%parameter" + "%token" + "%type" + "%start" + "%attribute" + "%left" + "%right" + "%nonassoc" + "%public" + "%inline" + "%prec" +] @keyword -["let"] @keyword.function +"%on_error_reduce" @keyword.exception -[(equality_symbol) ":" "|" ";" ","] @punctuation.delimiter +"let" @keyword.function + +[ + (equality_symbol) + ":" + "|" + ";" + "," +] @punctuation.delimiter + +[ + "=" + "~" + "_" +] @operator -["=" "~" "_"] @operator (modifier) @operator -["<" ">" "{" "}" "%{" "%}" "%%"] @punctuation.special +[ + "<" + ">" + "{" + "}" + "%{" + "%}" + "%%" +] @punctuation.special -["(" ")"] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -(old_rule [(symbol)] @function) -(new_rule [(lid)] @function) +(old_rule + (symbol) @function) -(precedence [(symbol)] @variable.parameter) +(new_rule + (lid) @function) + +(precedence + (symbol) @variable.parameter) (funcall) @function.call @@ -23,6 +62,11 @@ (uid) @constant (ocaml_type) @type + (ocaml) @none -[(comment) (line_comment) (ocaml_comment)] @comment @spell +[ + (comment) + (line_comment) + (ocaml_comment) +] @comment @spell diff --git a/queries/menhir/injections.scm b/queries/menhir/injections.scm index f209dd139..9343d60af 100644 --- a/queries/menhir/injections.scm +++ b/queries/menhir/injections.scm @@ -1,2 +1,2 @@ ((ocaml) @injection.content - (#set! injection.language "ocaml")) + (#set! injection.language "ocaml")) diff --git a/queries/mermaid/highlights.scm b/queries/mermaid/highlights.scm index b661f8ad8..3289c4e5c 100644 --- a/queries/mermaid/highlights.scm +++ b/queries/mermaid/highlights.scm @@ -1,105 +1,97 @@ ; adapted from https://github.com/monaqa/tree-sitter-mermaid - [ - "sequenceDiagram" - "classDiagram" - "classDiagram-v2" - "stateDiagram" - "stateDiagram-v2" - "gantt" - "pie" - "flowchart" - "erdiagram" - - "participant" - "as" - "activate" - "deactivate" - "note " - "over" - "link" - "links" - ; "left of" - ; "right of" - "properties" - "details" - "title" - "loop" - "rect" - "opt" - "alt" - "else" - "par" - "and" - "end" - (sequence_stmt_autonumber) - (note_placement_left) - (note_placement_right) - - "class" - - "state " - - "dateformat" - "inclusiveenddates" - "topaxis" - "axisformat" - "includes" - "excludes" - "todaymarker" - "title" - "section" - - "direction" - "subgraph" - - ] @keyword + "sequenceDiagram" + "classDiagram" + "classDiagram-v2" + "stateDiagram" + "stateDiagram-v2" + "gantt" + "pie" + "flowchart" + "erdiagram" + "participant" + "as" + "activate" + "deactivate" + "note " + "over" + "link" + "links" + ; "left of" + ; "right of" + "properties" + "details" + "title" + "loop" + "rect" + "opt" + "alt" + "else" + "par" + "and" + "end" + (sequence_stmt_autonumber) + (note_placement_left) + (note_placement_right) + "class" + "state " + "dateformat" + "inclusiveenddates" + "topaxis" + "axisformat" + "includes" + "excludes" + "todaymarker" + "title" + "section" + "direction" + "subgraph" +] @keyword (comment) @comment @spell [ - ":" - (sequence_signal_plus_sign) - (sequence_signal_minus_sign) - - (class_visibility_public) - (class_visibility_private) - (class_visibility_protected) - (class_visibility_internal) - - (state_division) - ] @punctuation.delimiter + ":" + (sequence_signal_plus_sign) + (sequence_signal_minus_sign) + (class_visibility_public) + (class_visibility_private) + (class_visibility_protected) + (class_visibility_internal) + (state_division) +] @punctuation.delimiter [ - "(" - ")" - "{" - "}" - ] @punctuation.bracket + "(" + ")" + "{" + "}" +] @punctuation.bracket [ - "-->" - (solid_arrow) - (dotted_arrow) - (solid_open_arrow) - (dotted_open_arrow) - (solid_cross) - (dotted_cross) - (solid_point) - (dotted_point) - ] @operator + "-->" + (solid_arrow) + (dotted_arrow) + (solid_open_arrow) + (dotted_open_arrow) + (solid_cross) + (dotted_cross) + (solid_point) + (dotted_point) +] @operator [ - (class_reltype_aggregation) - (class_reltype_extension) - (class_reltype_composition) - (class_reltype_dependency) - (class_linetype_solid) - (class_linetype_dotted) - "&" - ] @operator + (class_reltype_aggregation) + (class_reltype_extension) + (class_reltype_composition) + (class_reltype_dependency) + (class_linetype_solid) + (class_linetype_dotted) + "&" +] @operator (sequence_actor) @variable.member + (class_name) @variable.member (state_name) @variable.member @@ -107,71 +99,151 @@ (gantt_task_text) @variable.member [ - (class_annotation_line) - (class_stmt_annotation) - (class_generics) - - (state_annotation_fork) - (state_annotation_join) - (state_annotation_choice) - ] @attribute + (class_annotation_line) + (class_stmt_annotation) + (class_generics) + (state_annotation_fork) + (state_annotation_join) + (state_annotation_choice) +] @attribute (directive) @keyword.import (pie_label) @string + (pie_value) @number.float [ -(flowchart_direction_lr) -(flowchart_direction_rl) -(flowchart_direction_tb) -(flowchart_direction_bt) - ] @constant + (flowchart_direction_lr) + (flowchart_direction_rl) + (flowchart_direction_tb) + (flowchart_direction_bt) +] @constant (flow_vertex_id) @variable.member [ - (flow_link_arrow) - (flow_link_arrow_start) - ] @operator + (flow_link_arrow) + (flow_link_arrow_start) +] @operator + +(flow_link_arrowtext + "|" @punctuation.bracket) + +(flow_vertex_square + [ + "[" + "]" + ] @punctuation.bracket) -(flow_link_arrowtext "|" @punctuation.bracket) +(flow_vertex_circle + [ + "((" + "))" + ] @punctuation.bracket) -(flow_vertex_square [ "[" "]" ] @punctuation.bracket ) -(flow_vertex_circle ["((" "))"] @punctuation.bracket ) -(flow_vertex_ellipse ["(-" "-)"] @punctuation.bracket ) -(flow_vertex_stadium ["([" "])"] @punctuation.bracket ) -(flow_vertex_subroutine ["[[" "]]"] @punctuation.bracket ) -(flow_vertex_rect ["[|" "|]"] @punctuation.bracket ) -(flow_vertex_cylinder ["[(" ")]"] @punctuation.bracket ) -(flow_vertex_round ["(" ")"] @punctuation.bracket ) -(flow_vertex_diamond ["{" "}"] @punctuation.bracket ) -(flow_vertex_hexagon ["{{" "}}"] @punctuation.bracket ) -(flow_vertex_odd [">" "]"] @punctuation.bracket ) -(flow_vertex_trapezoid ["[/" "\\]"] @punctuation.bracket ) -(flow_vertex_inv_trapezoid ["[\\" "/]"] @punctuation.bracket ) -(flow_vertex_leanright ["[/" "/]"] @punctuation.bracket ) -(flow_vertex_leanleft ["[\\" "\\]"] @punctuation.bracket ) +(flow_vertex_ellipse + [ + "(-" + "-)" + ] @punctuation.bracket) -(flow_stmt_subgraph ["[" "]"] @punctuation.bracket ) +(flow_vertex_stadium + [ + "([" + "])" + ] @punctuation.bracket) + +(flow_vertex_subroutine + [ + "[[" + "]]" + ] @punctuation.bracket) + +(flow_vertex_rect + [ + "[|" + "|]" + ] @punctuation.bracket) + +(flow_vertex_cylinder + [ + "[(" + ")]" + ] @punctuation.bracket) + +(flow_vertex_round + [ + "(" + ")" + ] @punctuation.bracket) + +(flow_vertex_diamond + [ + "{" + "}" + ] @punctuation.bracket) + +(flow_vertex_hexagon + [ + "{{" + "}}" + ] @punctuation.bracket) + +(flow_vertex_odd + [ + ">" + "]" + ] @punctuation.bracket) + +(flow_vertex_trapezoid + [ + "[/" + "\\]" + ] @punctuation.bracket) + +(flow_vertex_inv_trapezoid + [ + "[\\" + "/]" + ] @punctuation.bracket) + +(flow_vertex_leanright + [ + "[/" + "/]" + ] @punctuation.bracket) + +(flow_vertex_leanleft + [ + "[\\" + "\\]" + ] @punctuation.bracket) + +(flow_stmt_subgraph + [ + "[" + "]" + ] @punctuation.bracket) [ - (er_cardinarity_zero_or_one) - (er_cardinarity_zero_or_more) - (er_cardinarity_one_or_more) - (er_cardinarity_only_one) - (er_reltype_non_identifying) - (er_reltype_identifying) - ] @operator + (er_cardinarity_zero_or_one) + (er_cardinarity_zero_or_more) + (er_cardinarity_one_or_more) + (er_cardinarity_only_one) + (er_reltype_non_identifying) + (er_reltype_identifying) +] @operator (er_entity_name) @variable.member (er_attribute_type) @type + (er_attribute_name) @variable.member [ - (er_attribute_key_type_pk) - (er_attribute_key_type_fk) - ] @type.qualifier + (er_attribute_key_type_pk) + (er_attribute_key_type_fk) +] @type.qualifier (er_attribute_comment) @string @spell diff --git a/queries/meson/folds.scm b/queries/meson/folds.scm index bb6c3c877..386d4d306 100644 --- a/queries/meson/folds.scm +++ b/queries/meson/folds.scm @@ -1,9 +1,9 @@ [ - (normal_command) - (if_condition) - (if_command) - (else_command) - (elseif_command) - (foreach_command) - (list) + (normal_command) + (if_condition) + (if_command) + (else_command) + (elseif_command) + (foreach_command) + (list) ] @fold diff --git a/queries/meson/highlights.scm b/queries/meson/highlights.scm index a61e6b1e6..b00c3399b 100644 --- a/queries/meson/highlights.scm +++ b/queries/meson/highlights.scm @@ -1,5 +1,7 @@ (comment) @comment @spell + (number) @number + (bool) @boolean (identifier) @variable @@ -40,7 +42,10 @@ ] @operator (ternaryoperator - ["?" ":"] @keyword.conditional.ternary) + [ + "?" + ":" + ] @keyword.conditional.ternary) [ "if" @@ -62,15 +67,11 @@ (normal_command command: (identifier) @function) + (pair key: (identifier) @property) (escape_sequence) @string.escape ((identifier) @variable.builtin - (#any-of? @variable.builtin - "meson" - "host_machine" - "build_machine" - "target_machine" - )) + (#any-of? @variable.builtin "meson" "host_machine" "build_machine" "target_machine")) diff --git a/queries/meson/injections.scm b/queries/meson/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/meson/injections.scm +++ b/queries/meson/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/mlir/highlights.scm b/queries/mlir/highlights.scm index 6d7f4c2d7..cbe4ecf0d 100644 --- a/queries/mlir/highlights.scm +++ b/queries/mlir/highlights.scm @@ -22,7 +22,6 @@ "default" (arith_cmp_predicate) ] @keyword - ; format-ignore [ "module" @@ -276,6 +275,7 @@ ] @number (float_literal) @number.float + (bool_literal) @boolean [ @@ -325,13 +325,23 @@ "->" ] @operator -(builtin_dialect name: (symbol_ref_id) @function) -(func_dialect name: (symbol_ref_id) @function) -(llvm_dialect name: (symbol_ref_id) @function) +(builtin_dialect + name: (symbol_ref_id) @function) + +(func_dialect + name: (symbol_ref_id) @function) + +(llvm_dialect + name: (symbol_ref_id) @function) -(func_arg_list (value_use) @variable.parameter) -(block_arg_list (value_use) @variable.parameter) +(func_arg_list + (value_use) @variable.parameter) + +(block_arg_list + (value_use) @variable.parameter) (caret_id) @tag + (value_use) @variable + (comment) @comment @spell diff --git a/queries/mlir/locals.scm b/queries/mlir/locals.scm index 8e569e8e6..d29351d48 100644 --- a/queries/mlir/locals.scm +++ b/queries/mlir/locals.scm @@ -1,7 +1,12 @@ (region) @local.scope -(func_arg_list (value_use) @local.definition.var) -(block_arg_list (value_use) @local.definition.var) -(op_result (value_use) @local.definition.var) +(func_arg_list + (value_use) @local.definition.var) + +(block_arg_list + (value_use) @local.definition.var) + +(op_result + (value_use) @local.definition.var) (value_use) @local.reference diff --git a/queries/nasm/highlights.scm b/queries/nasm/highlights.scm index d588635fc..02506de8b 100644 --- a/queries/nasm/highlights.scm +++ b/queries/nasm/highlights.scm @@ -1,8 +1,9 @@ -;; adapted from https://github.com/naclsn/tree-sitter-nasm/blob/main/queries/highlights.scm - +; adapted from https://github.com/naclsn/tree-sitter-nasm/blob/main/queries/highlights.scm (word) @variable + ((word) @constant (#lua-match? @constant "^[A-Z_][?A-Z_0-9]+$")) + ((word) @constant.builtin (#lua-match? @constant.builtin "^__%?[A-Z_a-z0-9]+%?__$")) @@ -11,19 +12,28 @@ (section_here_token) ] @variable.builtin -(label (word) @label) -(assembl_directive_symbols (word) @label) -(assembl_directive_sections (word) @label) +(label + (word) @label) + +(assembl_directive_symbols + (word) @label) + +(assembl_directive_sections + (word) @label) (unary_expression operator: _ @operator) + (binary_expression operator: _ @operator) "?" @constant.builtin (conditional_expression - [ "?" ":" ] @keyword.conditional.ternary) + [ + "?" + ":" + ] @keyword.conditional.ternary) [ ":" @@ -31,12 +41,16 @@ ] @punctuation.delimiter [ - "(" ")" - "[" "]" - "{" "}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket (instruction_prefix) @keyword + (actual_instruction instruction: (word) @function.builtin) @@ -44,13 +58,16 @@ base: (word) @function.call) (size_hint) @type + (struc_declaration name: (word) @type) + (struc_instance name: (word) @type) (effective_address hint: _ @type) + (effective_address segment: _ @constant.builtin) diff --git a/queries/nickel/highlights.scm b/queries/nickel/highlights.scm index e340c37f7..d77bf7373 100644 --- a/queries/nickel/highlights.scm +++ b/queries/nickel/highlights.scm @@ -13,14 +13,21 @@ "import" @keyword.import -[ "if" "then" "else" ] @keyword.conditional +[ + "if" + "then" + "else" +] @keyword.conditional + "match" @keyword.conditional (types) @type + "Array" @type.builtin ; BUILTIN Constants (bool) @boolean + "null" @constant.builtin (num_literal) @number @@ -28,34 +35,42 @@ (infix_op) @operator (type_atom) @type + (enum_tag) @variable (chunk_literal_single) @string + (chunk_literal_multi) @string (str_esc_char) @string.escape [ - "{" "}" - "(" ")" - "[|" "|]" + "{" + "}" + "(" + ")" + "[|" + "|]" ] @punctuation.bracket (multstr_start) @punctuation.bracket + (multstr_end) @punctuation.bracket + (interpolation_start) @punctuation.bracket + (interpolation_end) @punctuation.bracket (record_field) @variable.member (builtin) @function.builtin -(fun_expr pats: - (pattern id: - (ident) @variable.parameter - ) -) +(fun_expr + pats: + (pattern + id: (ident) @variable.parameter)) -(applicative t1: - (applicative (record_operand) @function) -) +(applicative + t1: + (applicative + (record_operand) @function)) diff --git a/queries/nickel/indents.scm b/queries/nickel/indents.scm index 3195d7feb..8c6f740d9 100644 --- a/queries/nickel/indents.scm +++ b/queries/nickel/indents.scm @@ -1,6 +1,8 @@ [ - (atom (uni_record)) ; for {...} - (atom terms: (term)) ; for [...] + (atom + (uni_record)) ; for {...} + (atom + terms: (term)) ; for [...] ] @indent.begin [ @@ -8,6 +10,4 @@ "}" ] @indent.end @indent.branch -[ - (comment) -] @indent.auto +(comment) @indent.auto diff --git a/queries/nim/folds.scm b/queries/nim/folds.scm index 466bcf5ae..fa0581a72 100644 --- a/queries/nim/folds.scm +++ b/queries/nim/folds.scm @@ -4,11 +4,9 @@ (let_section) (type_section) (using_section) - (object_declaration) (tuple_type) (enum_declaration) - (case) (if) (when) @@ -17,22 +15,18 @@ (of_branch) (elif_branch) (else_branch) - (for) (while) (block) (static_statement) (pragma_statement) - (try) (except_branch) (finally_branch) - (do_block) (call (argument_list (statement_list))) - (proc_declaration) (func_declaration) (method_declaration) @@ -40,10 +34,8 @@ (converter_declaration) (template_declaration) (macro_declaration) - (proc_expression) (func_expression) (iterator_expression) - (concept_declaration) ] @fold diff --git a/queries/nim/highlights.scm b/queries/nim/highlights.scm index 1a7da2ba2..d868be072 100644 --- a/queries/nim/highlights.scm +++ b/queries/nim/highlights.scm @@ -1,59 +1,58 @@ ; SPDX-FileCopyrightText: 2023 Leorize <leorize+oss@disroot.org>, aMOPel <> ; SPDX-License-Identifier: MPL-2.0 ; SPDX-License-Identifier: Apache-2.0 - ; ============================================================================= ; catch all rules +((identifier) @variable + (#set! "priority" 99)) -((identifier) @variable (#set! "priority" 99)) ; NOTE: we need priority, since (identifier) is most specific and we have to ; capture nodes containing (identifier) as a whole, while overruling the ; @variable capture. - (type_expression) @type + ; NOTE: has to be after ; ((identifier) @variable (#set! "priority" 99)) - ; overrule identifiers in pragmas in (proc_type)s and (pragma_expression)s (proc_type - pragmas: - (pragma_list) @variable) + pragmas: (pragma_list) @variable) + (iterator_type - pragmas: - (pragma_list) @variable) + pragmas: (pragma_list) @variable) + (type_expression (pragma_expression - right: - (pragma_list) @variable)) + right: (pragma_list) @variable)) + ; NOTE: has to be after ; (type_expression) @type ; and before @keyword.directive and all literals - ; constants/enums in array construction (array_construction (colon_expression left: (_) @constant)) -; NOTE: has to be before literals and punctuation etc. +; NOTE: has to be before literals and punctuation etc. ; identifiers in "case" "of" branches have to be enums (case alternative: (of_branch values: - (expression_list (_) @constant))) -; NOTE: has to be before literals and punctuation etc. + (expression_list + (_) @constant))) +; NOTE: has to be before literals and punctuation etc. ; in variant objects with "case" "of" (variant_declaration alternative: (of_branch values: - (expression_list (_) @constant))) -; NOTE: has to be before literals and punctuation etc. + (expression_list + (_) @constant))) +; NOTE: has to be before literals and punctuation etc. ; ============================================================================= ; @comment ; line and block comments - [ (comment) (block_comment) @@ -61,54 +60,75 @@ ; ============================================================================= ; @comment.documentation ; comments documenting code +(documentation_comment + "##" @comment.documentation) -(documentation_comment "##" @comment.documentation) (block_documentation_comment "##[" @comment.documentation "]##" @comment.documentation) -; NOTE: leaving content uncaptured so markdown can be injected +; NOTE: leaving content uncaptured so markdown can be injected ; ============================================================================= ; @punctuation.delimiter ; delimiters (e.g. `;` / `.` / `,`) - -[ "." ";" "," ":" "=" ] @punctuation.delimiter +[ + "." + ";" + "," + ":" + "=" +] @punctuation.delimiter ; ============================================================================= ; @operator ; symbolic operators (e.g. `+` / `*`) - (operator) @operator -(assignment "=" @operator) +(assignment + "=" @operator) ; ============================================================================= ; @punctuation.bracket ; brackets (e.g. `()` / `{}` / `[]`) - -[ "(" ")" "[" "[:" "]" "{" "}" ] @punctuation.bracket +[ + "(" + ")" + "[" + "[:" + "]" + "{" + "}" +] @punctuation.bracket ; ============================================================================= ; @keyword.directive ; various preprocessor directives & shebangs - [ "macro" "template" ] @keyword.directive -(pragma_list ["{." "}" ".}"] @keyword.directive) -; NOTE: has to come after @punctuation.bracket +(pragma_list + [ + "{." + "}" + ".}" + ] @keyword.directive) +; NOTE: has to come after @punctuation.bracket ; ============================================================================= ; @punctuation.special ; special symbols (e.g. `{}` in string interpolation) +(accent_quoted + "`" @punctuation.special) -(accent_quoted "`" @punctuation.special) - -(exported_symbol "*" @punctuation.special) +(exported_symbol + "*" @punctuation.special) ; dereference operator -(bracket_expression !right "[" @punctuation.special . "]" @punctuation.special) +(bracket_expression + !right + "[" @punctuation.special + . + "]" @punctuation.special) ; ============================================================================= ; @string ; string literals - [ (interpreted_string_literal) (long_string_literal) @@ -117,147 +137,189 @@ ] @string ; injections in generalized_strings -(generalized_string (string_content) @none) +(generalized_string + (string_content) @none) ; format string injection in normal strings with & prefix (prefix_expression - operator: (operator) @_string_prefix . - (_ (string_content) @none) + operator: (operator) @_string_prefix + . + (_ + (string_content) @none) (#eq? @_string_prefix "&")) ; emit pragma injection (pragma_statement (pragma_list (colon_expression - left: (identifier) @_emit_keyword (#eq? @_emit_keyword "emit") - right: (_ (string_content) @none)))) + left: (identifier) @_emit_keyword + (#eq? @_emit_keyword "emit") + right: + (_ + (string_content) @none)))) ; ============================================================================= ; @string.escape ; escape sequences - (escape_sequence) @string.escape ; ============================================================================= ; @character ; character literals - (char_literal) @character ; ============================================================================= ; @boolean ; boolean literals - ((identifier) @boolean (#any-of? @boolean "true" "false" "on" "off")) ; ============================================================================= ; @number ; numeric literals - (integer_literal) @number (custom_numeric_literal) @number ; ============================================================================= ; @number.float ; floating-point number literals - (float_literal) @number.float ; ============================================================================= ; @function ; function definitions - (proc_declaration - name: [ - (identifier) @function - (accent_quoted (identifier) @function) - (exported_symbol (identifier) @function) - (exported_symbol (accent_quoted (identifier) @function)) - ]) + name: + [ + (identifier) @function + (accent_quoted + (identifier) @function) + (exported_symbol + (identifier) @function) + (exported_symbol + (accent_quoted + (identifier) @function)) + ]) (func_declaration - name: [ - (identifier) @function - (accent_quoted (identifier) @function) - (exported_symbol (identifier) @function) - (exported_symbol (accent_quoted (identifier) @function)) - ]) + name: + [ + (identifier) @function + (accent_quoted + (identifier) @function) + (exported_symbol + (identifier) @function) + (exported_symbol + (accent_quoted + (identifier) @function)) + ]) (iterator_declaration - name: [ - (identifier) @function - (accent_quoted (identifier) @function) - (exported_symbol (identifier) @function) - (exported_symbol (accent_quoted (identifier) @function)) - ]) + name: + [ + (identifier) @function + (accent_quoted + (identifier) @function) + (exported_symbol + (identifier) @function) + (exported_symbol + (accent_quoted + (identifier) @function)) + ]) (converter_declaration - name: [ - (identifier) @function - (accent_quoted (identifier) @function) - (exported_symbol (identifier) @function) - (exported_symbol (accent_quoted (identifier) @function)) - ]) + name: + [ + (identifier) @function + (accent_quoted + (identifier) @function) + (exported_symbol + (identifier) @function) + (exported_symbol + (accent_quoted + (identifier) @function)) + ]) ; ============================================================================= ; @function.call ; function calls - (call - function: [ - (identifier) @function.call - (accent_quoted (identifier) @function.call) - ; generic types - (bracket_expression left: (identifier) @function.call) - (bracket_expression left: (accent_quoted (identifier) @function.call)) - ; dot accessor - (dot_expression right: (identifier) @function.call) - (dot_expression right: (accent_quoted (identifier) @function.call)) - ; both - (bracket_expression left: - (dot_expression right: (identifier) @function.call)) - (bracket_expression left: - (dot_expression right: (accent_quoted (identifier) @function.call))) - ]) + function: + [ + (identifier) @function.call + (accent_quoted + (identifier) @function.call) + ; generic types + (bracket_expression + left: (identifier) @function.call) + (bracket_expression + left: + (accent_quoted + (identifier) @function.call)) + ; dot accessor + (dot_expression + right: (identifier) @function.call) + (dot_expression + right: + (accent_quoted + (identifier) @function.call)) + ; both + (bracket_expression + left: + (dot_expression + right: (identifier) @function.call)) + (bracket_expression + left: + (dot_expression + right: + (accent_quoted + (identifier) @function.call))) + ]) (dot_generic_call - function: [ - (identifier) @function.call - (accent_quoted (identifier) @function.call) - ]) + function: + [ + (identifier) @function.call + (accent_quoted + (identifier) @function.call) + ]) ; generalized_string is a function call ; `identifier"string literal"` ; is short for ; `identifier(r"string literal")` (generalized_string - function: [ - (identifier) @function.call - (accent_quoted (identifier) @function.call) - ]) + function: + [ + (identifier) @function.call + (accent_quoted + (identifier) @function.call) + ]) ; call with leading literal (dot_expression - left: [ - (nil_literal) - (integer_literal) - (float_literal) - (custom_numeric_literal) - (char_literal) - (interpreted_string_literal) - (long_string_literal) - (raw_string_literal) - (generalized_string) - (array_construction) - ; for sequences - (prefix_expression - operator: (operator) @_at + left: + [ + (nil_literal) + (integer_literal) + (float_literal) + (custom_numeric_literal) + (char_literal) + (interpreted_string_literal) + (long_string_literal) + (raw_string_literal) + (generalized_string) (array_construction) - (#eq? @_at "@")) - (tuple_construction) - (curly_construction) - ] - right: [ - (identifier) @function.call - (accent_quoted (identifier) @function.call) - ]) -; NOTE: will double capture as @function.call if it also has argument_list + ; for sequences + (prefix_expression + operator: (operator) @_at + (array_construction) + (#eq? @_at "@")) + (tuple_construction) + (curly_construction) + ] + right: + [ + (identifier) @function.call + (accent_quoted + (identifier) @function.call) + ]) +; NOTE: will double capture as @function.call if it also has argument_list ; function.calls in `varargs[type, routine]` (bracket_expression left: (identifier) @_varargs @@ -268,73 +330,104 @@ . [ (identifier) @function.call - (accent_quoted (identifier) @function.call) - (dot_expression right: (identifier) @function.call) - (dot_expression right: (accent_quoted (identifier) @function.call)) + (accent_quoted + (identifier) @function.call) + (dot_expression + right: (identifier) @function.call) + (dot_expression + right: + (accent_quoted + (identifier) @function.call)) ]) (#eq? @_varargs "varargs")) ; ============================================================================= ; @function.macro ; preprocessor macros - (template_declaration - name: [ - (identifier) @function.macro - (accent_quoted (identifier) @function.macro) - (exported_symbol (identifier) @function.macro) - (exported_symbol (accent_quoted (identifier) @function.macro)) - ]) + name: + [ + (identifier) @function.macro + (accent_quoted + (identifier) @function.macro) + (exported_symbol + (identifier) @function.macro) + (exported_symbol + (accent_quoted + (identifier) @function.macro)) + ]) (macro_declaration - name: [ - (identifier) @function.macro - (accent_quoted (identifier) @function.macro) - (exported_symbol (identifier) @function.macro) - (exported_symbol (accent_quoted (identifier) @function.macro)) - ]) + name: + [ + (identifier) @function.macro + (accent_quoted + (identifier) @function.macro) + (exported_symbol + (identifier) @function.macro) + (exported_symbol + (accent_quoted + (identifier) @function.macro)) + ]) ; ============================================================================= ; @function.method ; method definitions - (method_declaration - name: [ - (identifier) @function.method - (accent_quoted (identifier) @function.method) - (exported_symbol (identifier) @function.method) - (exported_symbol (accent_quoted (identifier) @function.method)) - ]) + name: + [ + (identifier) @function.method + (accent_quoted + (identifier) @function.method) + (exported_symbol + (identifier) @function.method) + (exported_symbol + (accent_quoted + (identifier) @function.method)) + ]) ; ============================================================================= ; @constructor ; constructor calls and definitions - (call - function: [ - (identifier) @constructor - (accent_quoted (identifier) @constructor) - ; generic types - (bracket_expression left: (identifier) @constructor) - (bracket_expression left: (accent_quoted (identifier) @constructor)) - ; dot accessor - (dot_expression right: (identifier) @constructor) - (dot_expression right: (accent_quoted (identifier) @constructor)) - ; both - (bracket_expression left: - (dot_expression right: (identifier) @constructor)) - (bracket_expression left: - (dot_expression right: (accent_quoted (identifier) @constructor))) - ] + function: + [ + (identifier) @constructor + (accent_quoted + (identifier) @constructor) + ; generic types + (bracket_expression + left: (identifier) @constructor) + (bracket_expression + left: + (accent_quoted + (identifier) @constructor)) + ; dot accessor + (dot_expression + right: (identifier) @constructor) + (dot_expression + right: + (accent_quoted + (identifier) @constructor)) + ; both + (bracket_expression + left: + (dot_expression + right: (identifier) @constructor)) + (bracket_expression + left: + (dot_expression + right: + (accent_quoted + (identifier) @constructor))) + ] (argument_list (colon_expression)+)) + ; NOTE: this cannot detect constructors with 0 arguments ; those will be matched as @function.call instead - ; ============================================================================= ; @keyword ; various keywords - ; unhandled but reserved keywords ; end ; interface - ; static expression ; addr operator ((call @@ -363,7 +456,6 @@ ; ============================================================================= ; @keyword.function ; keywords that define a function (e.g. `func` in Go, `def` in Python) - [ "proc" "func" @@ -374,7 +466,6 @@ ; ============================================================================= ; @keyword.operator ; operators that are English words (e.g. `and` / `or`) - [ "and" "or" @@ -396,7 +487,6 @@ ; ============================================================================= ; @keyword.return ; keywords like `return` and `yield` - [ "return" "yield" @@ -404,7 +494,6 @@ ; ============================================================================= ; @keyword.conditional ; keywords related to conditionals (e.g. `if` / `else`) - [ "if" "when" @@ -413,11 +502,11 @@ "else" ] @keyword.conditional -(of_branch "of" @keyword.conditional) +(of_branch + "of" @keyword.conditional) ; ============================================================================= ; @keyword.repeat ; keywords related to loops (e.g. `for` / `while`) - [ "for" "while" @@ -425,33 +514,35 @@ "break" ] @keyword.repeat -(for "in" @keyword.repeat) +(for + "in" @keyword.repeat) ; ============================================================================= ; @label ; GOTO and other labels (e.g. `label:` in C) - (block - label: [ - (identifier) @label - (accent_quoted (identifier) @label) - ]) + label: + [ + (identifier) @label + (accent_quoted + (identifier) @label) + ]) ; ============================================================================= ; @keyword.import ; keywords for including modules (e.g. `import` / `from` in Python) - [ "import" "include" "export" ] @keyword.import -(import_from_statement "from" @keyword.import) +(import_from_statement + "from" @keyword.import) -(except_clause "except" @keyword.import) +(except_clause + "except" @keyword.import) ; ============================================================================= ; @keyword.exception ; keywords related to exceptions (e.g. `throw` / `catch`) - [ "try" "except" @@ -461,22 +552,26 @@ ; ============================================================================= ; @type ; type or class definitions and annotations - ; generic types when calling (call - function: (bracket_expression - right: (argument_list) @type)) + function: + (bracket_expression + right: (argument_list) @type)) + ; NOTE: this also falsely matches ; when accessing and directly call elements from an array of routines ; eg `array_of_routines[index](arguments), but that is an uncommon case - ; dot_generic_call `v.call[:type, type]() (dot_generic_call generic_arguments: (_) @type) ; right side of `is` operator is always type (infix_expression - operator: [ "is" "isnot" ] + operator: + [ + "is" + "isnot" + ] right: (_) @type) ; except branch always contains types of errors @@ -487,213 +582,285 @@ ; overrule special case in (except_branch) with "as" operator ; `except module.exception[gen_type] as variable:` (except_branch - values: (expression_list - (infix_expression - operator: "as" - right: [ - (identifier) @variable - (accent_quoted (identifier) @variable) - ]))) + values: + (expression_list + (infix_expression + operator: "as" + right: + [ + (identifier) @variable + (accent_quoted + (identifier) @variable) + ]))) ; for inline tuple types ; `type a = tuple[a: int]` (tuple_type "tuple" @type (field_declaration_list)) + ; NOTE: this is consistent with other generic types like `seq[int]` ; but inconsistent with multiline tuple declaration, ; where `tuple` is captured as @keyword - ; ============================================================================= ; @variable.parameter ; parameters of a function - ; named parameters when calling ; call(parameter_name=arg) (argument_list (equal_expression - left: [ - (identifier) @variable.parameter - (accent_quoted (identifier) @variable.parameter) - ])) + left: + [ + (identifier) @variable.parameter + (accent_quoted + (identifier) @variable.parameter) + ])) ; parameters in function declaration (parameter_declaration_list (parameter_declaration (symbol_declaration_list (symbol_declaration - name: [ - (identifier) @variable.parameter - (accent_quoted (identifier) @variable.parameter) - ])))) -; NOTE: needs to be after @type + name: + [ + (identifier) @variable.parameter + (accent_quoted + (identifier) @variable.parameter) + ])))) +; NOTE: needs to be after @type ; generic types when declaring ((generic_parameter_list (parameter_declaration (symbol_declaration_list (symbol_declaration - name: [ - (identifier) @variable.parameter - (accent_quoted (identifier) @variable.parameter) - ]))))) + name: + [ + (identifier) @variable.parameter + (accent_quoted + (identifier) @variable.parameter) + ]))))) ; for loop variables (for left: (symbol_declaration_list (symbol_declaration - name: [ - (identifier) @variable.parameter - (accent_quoted (identifier) @variable.parameter) - ]))) + name: + [ + (identifier) @variable.parameter + (accent_quoted + (identifier) @variable.parameter) + ]))) ((tuple_deconstruct_declaration (symbol_declaration - name: [ - (identifier) @variable.parameter - (accent_quoted (identifier) @variable.parameter) - ])) @_tuple_decons + name: + [ + (identifier) @variable.parameter + (accent_quoted + (identifier) @variable.parameter) + ])) @_tuple_decons (#has-ancestor? @_tuple_decons for)) (concept_declaration parameters: - (parameter_list [ - (identifier) @variable.parameter - (accent_quoted (identifier) @variable.parameter) - ])) -(var_parameter [ - (identifier) @variable.parameter - (accent_quoted (identifier) @variable.parameter) -]) -(type_parameter [ - (identifier) @variable.parameter - (accent_quoted (identifier) @variable.parameter) -]) -(static_parameter [ - (identifier) @variable.parameter - (accent_quoted (identifier) @variable.parameter) -]) -(ref_parameter [ - (identifier) @variable.parameter - (accent_quoted (identifier) @variable.parameter) -]) -(pointer_parameter [ - (identifier) @variable.parameter - (accent_quoted (identifier) @variable.parameter) -]) + (parameter_list + [ + (identifier) @variable.parameter + (accent_quoted + (identifier) @variable.parameter) + ])) + +(var_parameter + [ + (identifier) @variable.parameter + (accent_quoted + (identifier) @variable.parameter) + ]) + +(type_parameter + [ + (identifier) @variable.parameter + (accent_quoted + (identifier) @variable.parameter) + ]) + +(static_parameter + [ + (identifier) @variable.parameter + (accent_quoted + (identifier) @variable.parameter) + ]) + +(ref_parameter + [ + (identifier) @variable.parameter + (accent_quoted + (identifier) @variable.parameter) + ]) +(pointer_parameter + [ + (identifier) @variable.parameter + (accent_quoted + (identifier) @variable.parameter) + ]) ; ============================================================================= ; @type.definition ; type definitions (e.g. `typedef` in C) - (type_section (type_declaration (type_symbol_declaration - name: [ - (identifier) @type.definition - (accent_quoted (identifier) @type.definition) - (exported_symbol (identifier) @type.definition) - (exported_symbol (accent_quoted (identifier) @type.definition)) - ]))) + name: + [ + (identifier) @type.definition + (accent_quoted + (identifier) @type.definition) + (exported_symbol + (identifier) @type.definition) + (exported_symbol + (accent_quoted + (identifier) @type.definition)) + ]))) ; ============================================================================= ; @type.qualifier ; type qualifiers (e.g. `const`) +(var_type + "var" @type.qualifier) + +(out_type + "out" @type.qualifier) -(var_type "var" @type.qualifier) -(out_type "out" @type.qualifier) -(distinct_type "distinct" @type.qualifier) -(ref_type "ref" @type.qualifier) -(pointer_type "ptr" @type.qualifier) +(distinct_type + "distinct" @type.qualifier) -(var_parameter "var" @type.qualifier) -(type_parameter "type" @type.qualifier) -(static_parameter "static" @type.qualifier) -(ref_parameter "ref" @type.qualifier) -(pointer_parameter "ptr" @type.qualifier) +(ref_type + "ref" @type.qualifier) + +(pointer_type + "ptr" @type.qualifier) + +(var_parameter + "var" @type.qualifier) + +(type_parameter + "type" @type.qualifier) + +(static_parameter + "static" @type.qualifier) + +(ref_parameter + "ref" @type.qualifier) + +(pointer_parameter + "ptr" @type.qualifier) ; ============================================================================= ; @variable.member ; object and struct fields - ; fields in object/tuple declaration (field_declaration (symbol_declaration_list (symbol_declaration - name: [ - (identifier) @variable.member - (accent_quoted (identifier) @variable.member) - (exported_symbol (identifier) @variable.member) - (exported_symbol (accent_quoted (identifier) @variable.member)) - ]))) + name: + [ + (identifier) @variable.member + (accent_quoted + (identifier) @variable.member) + (exported_symbol + (identifier) @variable.member) + (exported_symbol + (accent_quoted + (identifier) @variable.member)) + ]))) ; fields in object construction (call (argument_list (colon_expression - left: [ - (identifier) @variable.member - (accent_quoted (identifier) @variable.member) - ]))) + left: + [ + (identifier) @variable.member + (accent_quoted + (identifier) @variable.member) + ]))) ; fields in tuple construction (tuple_construction (colon_expression - left: [ - (identifier) @variable.member - (accent_quoted (identifier) @variable.member) - ])) + left: + [ + (identifier) @variable.member + (accent_quoted + (identifier) @variable.member) + ])) (variant_declaration (variant_discriminator_declaration (symbol_declaration_list (symbol_declaration - name: [ - (identifier) @variable.member - (accent_quoted (identifier) @variable.member) - (exported_symbol (identifier) @variable.member) - (exported_symbol (accent_quoted (identifier) @variable.member)) - ])))) + name: + [ + (identifier) @variable.member + (accent_quoted + (identifier) @variable.member) + (exported_symbol + (identifier) @variable.member) + (exported_symbol + (accent_quoted + (identifier) @variable.member)) + ])))) ; ============================================================================= ; @variable.builtin ; built-in variable names (e.g. `this`) - (blank_identifier) @variable.builtin ((identifier) @variable.builtin (#eq? @variable.builtin "result")) + ; NOTE: technically needs `has-ancestor some routine declaration` but it's ; not worth it - ; ============================================================================= ; @constant ; constant identifiers - ; enum declaration (enum_field_declaration (symbol_declaration - name: [ - (identifier) @constant - (accent_quoted (identifier) @constant) - ])) + name: + [ + (identifier) @constant + (accent_quoted + (identifier) @constant) + ])) ; constant declaration (const_section (variable_declaration (symbol_declaration_list (symbol_declaration - name: [ - (identifier) @constant - (accent_quoted (identifier) @constant) - (exported_symbol (identifier) @constant) - (exported_symbol (accent_quoted (identifier) @constant)) - ])))) + name: + [ + (identifier) @constant + (accent_quoted + (identifier) @constant) + (exported_symbol + (identifier) @constant) + (exported_symbol + (accent_quoted + (identifier) @constant)) + ])))) ((tuple_deconstruct_declaration (symbol_declaration - name: [ - (identifier) @constant - (accent_quoted (identifier) @constant) - (exported_symbol (identifier) @constant) - (exported_symbol (accent_quoted (identifier) @constant)) - ])) @_tuple_decons + name: + [ + (identifier) @constant + (accent_quoted + (identifier) @constant) + (exported_symbol + (identifier) @constant) + (exported_symbol + (accent_quoted + (identifier) @constant)) + ])) @_tuple_decons (#has-ancestor? @_tuple_decons const_section)) ; constants x and y in `array[x..y, type]` @@ -703,37 +870,48 @@ (argument_list . (infix_expression - right: [ - (identifier) @constant - (accent_quoted (identifier) @constant) - (dot_expression right: (identifier) @constant) - (dot_expression right: (accent_quoted (identifier) @constant)) - ])) + right: + [ + (identifier) @constant + (accent_quoted + (identifier) @constant) + (dot_expression + right: (identifier) @constant) + (dot_expression + right: + (accent_quoted + (identifier) @constant)) + ])) (#any-of? @_array "array" "range")) + (bracket_expression left: (identifier) @_array right: (argument_list . (infix_expression - left: [ - (identifier) @constant - (accent_quoted (identifier) @constant) - (dot_expression right: (identifier) @constant) - (dot_expression right: (accent_quoted (identifier) @constant)) - ])) + left: + [ + (identifier) @constant + (accent_quoted + (identifier) @constant) + (dot_expression + right: (identifier) @constant) + (dot_expression + right: + (accent_quoted + (identifier) @constant)) + ])) (#any-of? @_array "array" "range")) + ; NOTE: can only do this for (infix_expression)s, since standalone identifiers ; could be ordinal types and constants - ; ============================================================================= ; @constant.builtin ; built-in constant values - (nil_literal) @constant.builtin ; ============================================================================= ; @module ; modules or namespaces - (import_statement (expression_list (identifier) @module)) @@ -748,16 +926,19 @@ (expression_list (infix_expression operator: (operator) @_operator - right: [ - (identifier) @module - (array_construction (identifier) @module) - ])) + right: + [ + (identifier) @module + (array_construction + (identifier) @module) + ])) (#eq? @_operator "/")) (import_from_statement - module: (infix_expression - operator: (operator) @_operator - right: (identifier) @module) + module: + (infix_expression + operator: (operator) @_operator + right: (identifier) @module) (#eq? @_operator "/")) (export_statement @@ -766,15 +947,17 @@ ; ============================================================================= ; overrule things - ; left identifier in dot_expression -(dot_expression left: [ - (identifier) @none - (accent_quoted (identifier) @none) -]) +(dot_expression + left: + [ + (identifier) @none + (accent_quoted + (identifier) @none) + ]) + ; NOTE: we can't know what the left identifier is, so better leave it alone ; for consistency - ; discard literals is like a comment (discard_statement "discard" @comment diff --git a/queries/nim/injections.scm b/queries/nim/injections.scm index 5e347e965..776d36e3a 100644 --- a/queries/nim/injections.scm +++ b/queries/nim/injections.scm @@ -1,24 +1,27 @@ ; ============================================================================= ; generalized_strings - ; regex in generalized_strings (generalized_string - function: (identifier) @_string_prefix . + function: (identifier) @_string_prefix + . (string_content) @injection.content (#set! injection.language "regex") (#any-of? @_string_prefix "re" "rex")) ; format string in generalized_strings (generalized_string - function: (identifier) @_string_prefix . + function: (identifier) @_string_prefix + . (string_content) @injection.content (#set! injection.language "nim_format_string") (#eq? @_string_prefix "fmt")) ; format string in normal strings with & prefix (prefix_expression - operator: (operator) @_string_prefix . - (_ (string_content) @injection.content) + operator: (operator) @_string_prefix + . + (_ + (string_content) @injection.content) (#set! injection.language "nim_format_string") (#eq? @_string_prefix "&")) @@ -31,45 +34,47 @@ ; ============================================================================= ; emit pragma - ; C / CPP / OBJC / JAVASCRIPT ; a `#<no whitespace><language name>` ; has to directly precede the {.emit: "<language code>".} pragma - ; eg.: ; #objc ; {.emit: "<objc code>".} ; OR ; #javascript ; {.emit: "<javascript code>".} - ; normal strings -((comment (comment_content) @injection.language) +((comment + (comment_content) @injection.language) . (pragma_statement (pragma_list (colon_expression - left: (identifier) @_emit_keyword (#eq? @_emit_keyword "emit") - right: (_ (string_content) @injection.content))))) - + left: (identifier) @_emit_keyword + (#eq? @_emit_keyword "emit") + right: + (_ + (string_content) @injection.content))))) ; ============================================================================= ; asm statement - ; works same as emit pragma, needs preceding comment with language name -((comment (comment_content) @injection.language) +((comment + (comment_content) @injection.language) . - (assembly_statement (_ (string_content) @injection.content))) + (assembly_statement + (_ + (string_content) @injection.content))) ; ============================================================================= ; comments - ; NOTE: ts "comment" parser heavily impacts performance - ; markdown parser in documentation_comment -(documentation_comment (comment_content) @injection.content +(documentation_comment + (comment_content) @injection.content (#set! injection.language "markdown_inline")) ; markdown parser in block_documentation_comment -(block_documentation_comment (comment_content) @injection.content +(block_documentation_comment + (comment_content) @injection.content (#set! injection.language "markdown")) diff --git a/queries/nim/locals.scm b/queries/nim/locals.scm index 4ca6f6d44..d4d89b048 100644 --- a/queries/nim/locals.scm +++ b/queries/nim/locals.scm @@ -1,198 +1,243 @@ - ; ============================================================================== ; @local.definition ; various definitions - (block - label: [ - (identifier) @local.definition - (accent_quoted) @local.definition - ]) + label: + [ + (identifier) @local.definition + (accent_quoted) @local.definition + ]) ; ============================================================================== ; @local.definition.constant ; constants - (const_section (variable_declaration (symbol_declaration_list (symbol_declaration - name: [ - (identifier) @local.definition.constant - (accent_quoted) @local.definition.constant - (exported_symbol (identifier) @local.definition.constant) - (exported_symbol (accent_quoted) @local.definition.constant) - ])) + name: + [ + (identifier) @local.definition.constant + (accent_quoted) @local.definition.constant + (exported_symbol + (identifier) @local.definition.constant) + (exported_symbol + (accent_quoted) @local.definition.constant) + ])) type: (type_expression)? @local.definition.associated)) ; ============================================================================== ; @local.definition.function ; functions - (proc_declaration - name: [ - (identifier) @local.definition.function - (accent_quoted) @local.definition.function - (exported_symbol (identifier) @local.definition.function) - (exported_symbol (accent_quoted) @local.definition.function) - ] + name: + [ + (identifier) @local.definition.function + (accent_quoted) @local.definition.function + (exported_symbol + (identifier) @local.definition.function) + (exported_symbol + (accent_quoted) @local.definition.function) + ] (#set! "definition.function.scope" "parent")) (func_declaration - name: [ - (identifier) @local.definition.function - (accent_quoted) @local.definition.function - (exported_symbol (identifier) @local.definition.function) - (exported_symbol (accent_quoted) @local.definition.function) - ] + name: + [ + (identifier) @local.definition.function + (accent_quoted) @local.definition.function + (exported_symbol + (identifier) @local.definition.function) + (exported_symbol + (accent_quoted) @local.definition.function) + ] (#set! "definition.function.scope" "parent")) (iterator_declaration - name: [ - (identifier) @local.definition.function - (accent_quoted) @local.definition.function - (exported_symbol (identifier) @local.definition.function) - (exported_symbol (accent_quoted) @local.definition.function) - ] + name: + [ + (identifier) @local.definition.function + (accent_quoted) @local.definition.function + (exported_symbol + (identifier) @local.definition.function) + (exported_symbol + (accent_quoted) @local.definition.function) + ] (#set! "definition.function.scope" "parent")) (converter_declaration - name: [ - (identifier) @local.definition.function - (accent_quoted) @local.definition.function - (exported_symbol (identifier) @local.definition.function) - (exported_symbol (accent_quoted) @local.definition.function) - ] + name: + [ + (identifier) @local.definition.function + (accent_quoted) @local.definition.function + (exported_symbol + (identifier) @local.definition.function) + (exported_symbol + (accent_quoted) @local.definition.function) + ] (#set! "definition.function.scope" "parent")) ; ============================================================================== ; @local.definition.method ; methods - (method_declaration - name: [ - (identifier) @local.definition.method - (accent_quoted) @local.definition.method - (exported_symbol (identifier) @local.definition.method) - (exported_symbol (accent_quoted) @local.definition.method) - ] + name: + [ + (identifier) @local.definition.method + (accent_quoted) @local.definition.method + (exported_symbol + (identifier) @local.definition.method) + (exported_symbol + (accent_quoted) @local.definition.method) + ] (#set! "definition.method.scope" "parent")) ; ============================================================================== ; @local.definition.var ; variables - (var_section (variable_declaration (symbol_declaration_list (symbol_declaration - name: [ - (identifier) @local.definition.var - (accent_quoted) @local.definition.var - (exported_symbol (identifier) @local.definition.var) - (exported_symbol (accent_quoted) @local.definition.var) - ])) + name: + [ + (identifier) @local.definition.var + (accent_quoted) @local.definition.var + (exported_symbol + (identifier) @local.definition.var) + (exported_symbol + (accent_quoted) @local.definition.var) + ])) type: (type_expression)? @local.definition.associated)) (let_section (variable_declaration (symbol_declaration_list (symbol_declaration - name: [ - (identifier) @local.definition.var - (accent_quoted) @local.definition.var - (exported_symbol (identifier) @local.definition.var) - (exported_symbol (accent_quoted) @local.definition.var) - ])) + name: + [ + (identifier) @local.definition.var + (accent_quoted) @local.definition.var + (exported_symbol + (identifier) @local.definition.var) + (exported_symbol + (accent_quoted) @local.definition.var) + ])) type: (type_expression)? @local.definition.associated)) (for (symbol_declaration_list (symbol_declaration - name: [ - (identifier) @local.definition.var - (accent_quoted) @local.definition.var - ]))) + name: + [ + (identifier) @local.definition.var + (accent_quoted) @local.definition.var + ]))) (try (except_branch - values: (expression_list - (infix_expression - right: [ - (identifier) @local.definition.var - (accent_quoted) @local.definition.var - ])))) + values: + (expression_list + (infix_expression + right: + [ + (identifier) @local.definition.var + (accent_quoted) @local.definition.var + ])))) ; ============================================================================== ; @local.definition.parameter ; parameters - (parameter_declaration (symbol_declaration_list (symbol_declaration - name: [ - (identifier) @local.definition.parameter - (accent_quoted) @local.definition.parameter - ])) + name: + [ + (identifier) @local.definition.parameter + (accent_quoted) @local.definition.parameter + ])) type: (type_expression)? @local.definition.associated) (concept_declaration parameters: - (parameter_list [ - (identifier) @local.definition.parameter - (accent_quoted (identifier) @local.definition.parameter) - ])) -(var_parameter [ - (identifier) @local.definition.parameter - (accent_quoted (identifier) @local.definition.parameter) -]) -(type_parameter [ - (identifier) @local.definition.parameter - (accent_quoted (identifier) @local.definition.parameter) -]) -(static_parameter [ - (identifier) @local.definition.parameter - (accent_quoted (identifier) @local.definition.parameter) -]) -(ref_parameter [ - (identifier) @local.definition.parameter - (accent_quoted (identifier) @local.definition.parameter) -]) -(pointer_parameter [ - (identifier) @local.definition.parameter - (accent_quoted (identifier) @local.definition.parameter) -]) + (parameter_list + [ + (identifier) @local.definition.parameter + (accent_quoted + (identifier) @local.definition.parameter) + ])) + +(var_parameter + [ + (identifier) @local.definition.parameter + (accent_quoted + (identifier) @local.definition.parameter) + ]) + +(type_parameter + [ + (identifier) @local.definition.parameter + (accent_quoted + (identifier) @local.definition.parameter) + ]) + +(static_parameter + [ + (identifier) @local.definition.parameter + (accent_quoted + (identifier) @local.definition.parameter) + ]) + +(ref_parameter + [ + (identifier) @local.definition.parameter + (accent_quoted + (identifier) @local.definition.parameter) + ]) + +(pointer_parameter + [ + (identifier) @local.definition.parameter + (accent_quoted + (identifier) @local.definition.parameter) + ]) ; ============================================================================== ; @local.definition.macro ; preprocessor macros - (template_declaration - name: [ - (identifier) @local.definition.macro - (accent_quoted) @local.definition.macro - (exported_symbol (identifier) @local.definition.macro) - (exported_symbol (accent_quoted) @local.definition.macro) - ] + name: + [ + (identifier) @local.definition.macro + (accent_quoted) @local.definition.macro + (exported_symbol + (identifier) @local.definition.macro) + (exported_symbol + (accent_quoted) @local.definition.macro) + ] (#set! "definition.macro.scope" "parent")) (macro_declaration - name: [ - (identifier) @local.definition.macro - (accent_quoted) @local.definition.macro - (exported_symbol (identifier) @local.definition.macro) - (exported_symbol (accent_quoted) @local.definition.macro) - ] + name: + [ + (identifier) @local.definition.macro + (accent_quoted) @local.definition.macro + (exported_symbol + (identifier) @local.definition.macro) + (exported_symbol + (accent_quoted) @local.definition.macro) + ] (#set! "definition.macro.scope" "parent")) ; ============================================================================== ; @local.definition.type ; types or classes - (type_declaration (type_symbol_declaration - name: [ - (identifier) @local.definition.type - (accent_quoted) @local.definition.type - (exported_symbol (identifier) @local.definition.type) - (exported_symbol (accent_quoted) @local.definition.type) - ])) + name: + [ + (identifier) @local.definition.type + (accent_quoted) @local.definition.type + (exported_symbol + (identifier) @local.definition.type) + (exported_symbol + (accent_quoted) @local.definition.type) + ])) ; ============================================================================== ; @local.definition.field ; fields or properties - ; object_declaration ; variant_declaration ; conditional_declaration @@ -201,29 +246,31 @@ (field_declaration (symbol_declaration_list (symbol_declaration - name: [ - (identifier) @local.definition.field - (accent_quoted) @local.definition.field - (exported_symbol (identifier) @local.definition.field) - (exported_symbol (accent_quoted) @local.definition.field) - ])) + name: + [ + (identifier) @local.definition.field + (accent_quoted) @local.definition.field + (exported_symbol + (identifier) @local.definition.field) + (exported_symbol + (accent_quoted) @local.definition.field) + ])) type: (type_expression)? @local.definition.associated) ; ============================================================================== ; @local.definition.enum ; enumerations - (enum_declaration (enum_field_declaration (symbol_declaration - name: [ - (identifier) @local.definition.enum - (accent_quoted) @local.definition.enum - ]))) + name: + [ + (identifier) @local.definition.enum + (accent_quoted) @local.definition.enum + ]))) ; ============================================================================== ; @local.definition.namespace ; modules or namespaces ; @local.definition.import ; imported names - (import_statement (expression_list (identifier) @local.definition.namespace)) @@ -238,28 +285,30 @@ (expression_list (infix_expression operator: (operator) @_operator - right: [ - (identifier) @local.definition.namespace - (array_construction (identifier) @local.definition.namespace) - ])) + right: + [ + (identifier) @local.definition.namespace + (array_construction + (identifier) @local.definition.namespace) + ])) (#eq? @_operator "/")) (import_from_statement - module: (infix_expression - operator: (operator) @_operator - right: (identifier) @local.definition.namespace) - (expression_list [ - (identifier) @local.definition.import - (accent_quoted) @local.definition.import - ]) + module: + (infix_expression + operator: (operator) @_operator + right: (identifier) @local.definition.namespace) + (expression_list + [ + (identifier) @local.definition.import + (accent_quoted) @local.definition.import + ]) (#eq? @_operator "/")) ; ============================================================================== ; @local.scope ; scope block - ; (when) ; NOTE: `when` does actually not create a scope - (if consequence: (statement_list) @local.scope alternative: (elif_branch)* @local.scope @@ -280,7 +329,6 @@ (while) (block) (static_statement) - (proc_declaration) (func_declaration) (method_declaration) @@ -288,16 +336,14 @@ (converter_declaration) (template_declaration) (macro_declaration) - (proc_expression) (func_expression) (iterator_expression) - (concept_declaration) ] @local.scope ; ============================================================================== ; @local.reference ; identifier reference - (identifier) @local.reference + (accent_quoted) @local.reference diff --git a/queries/nim_format_string/highlights.scm b/queries/nim_format_string/highlights.scm index b30ecbbef..44fc80260 100644 --- a/queries/nim_format_string/highlights.scm +++ b/queries/nim_format_string/highlights.scm @@ -1,6 +1,7 @@ (string_literal) -(matching_curlies - opening_curly: (opening_curly) @punctuation.special + +(matching_curlies + opening_curly: (opening_curly) @punctuation.special equals: (equals)? @punctuation.special closing_curly: (closing_curly) @punctuation.special) @@ -14,6 +15,7 @@ precision: (precision)? @number type: (type)? @type) -(matching_curlies - nim_expression: (nim_expression - escaped_curly: (escaped_curly)+ @string.escape) @none) +(matching_curlies + nim_expression: + (nim_expression + escaped_curly: (escaped_curly)+ @string.escape) @none) diff --git a/queries/nim_format_string/injections.scm b/queries/nim_format_string/injections.scm index 0775fba0c..3efbfb854 100644 --- a/queries/nim_format_string/injections.scm +++ b/queries/nim_format_string/injections.scm @@ -1,2 +1,4 @@ -((matching_curlies (nim_expression !escaped_curly) @injection.content) +((matching_curlies + (nim_expression + !escaped_curly) @injection.content) (#set! injection.language "nim")) diff --git a/queries/ninja/highlights.scm b/queries/ninja/highlights.scm index 5f87ff6b5..d216c3f71 100644 --- a/queries/ninja/highlights.scm +++ b/queries/ninja/highlights.scm @@ -10,9 +10,7 @@ "subninja" ] @keyword.import -[ - ":" -] @punctuation.delimiter +":" @punctuation.delimiter [ "=" @@ -27,74 +25,76 @@ "}" ] @punctuation.special -;; -;; Names -;; ===== -(pool name: (identifier) @type) -(rule name: (identifier) @function) -(let name: (identifier) @constant) -(expansion (identifier) @constant) -(build rule: (identifier) @function) +; +; Names +; ===== +(pool + name: (identifier) @type) + +(rule + name: (identifier) @function) -;; -;; Paths and Text -;; ============== +(let + name: (identifier) @constant) + +(expansion + (identifier) @constant) + +(build + rule: (identifier) @function) + +; +; Paths and Text +; ============== (path) @string.special.path + (text) @string -;; -;; Builtins -;; ======== -(pool name: (identifier) @type.builtin - (#any-of? @type.builtin "console")) -(build rule: (identifier) @function.builtin - (#any-of? @function.builtin "phony" "dyndep")) +; +; Builtins +; ======== +(pool + name: (identifier) @type.builtin + (#any-of? @type.builtin "console")) + +(build + rule: (identifier) @function.builtin + (#any-of? @function.builtin "phony" "dyndep")) -;; Top level bindings -;; ------------------ +; Top level bindings +; ------------------ (manifest - (let name: ((identifier) @constant.builtin - (#any-of? @constant.builtin "builddir" - "ninja_required_version")))) + (let + name: + ((identifier) @constant.builtin + (#any-of? @constant.builtin "builddir" "ninja_required_version")))) -;; Rules bindings -;; ----------------- +; Rules bindings +; ----------------- (rule (body - (let name: (identifier) @constant.builtin - (#not-any-of? @constant.builtin "command" - "depfile" - "deps" - "msvc_deps_prefix" - "description" - "dyndep" - "generator" - "in" - "in_newline" - "out" - "restat" - "rspfile" - "rspfile_content" - "pool")))) + (let + name: (identifier) @constant.builtin + (#not-any-of? @constant.builtin "command" "depfile" "deps" "msvc_deps_prefix" "description" "dyndep" "generator" "in" "in_newline" "out" "restat" "rspfile" "rspfile_content" "pool")))) -;; -;; Expansion -;; --------- +; +; Expansion +; --------- (expansion (identifier) @constant.macro - (#any-of? @constant.macro "in" "out")) + (#any-of? @constant.macro "in" "out")) -;; -;; Escape sequences -;; ================ +; +; Escape sequences +; ================ (quote) @string.escape -;; -;; Others -;; ====== +; +; Others +; ====== [ - (split) - (comment) + (split) + (comment) ] @comment (comment) @spell diff --git a/queries/ninja/indents.scm b/queries/ninja/indents.scm index 19f20dff5..80344cdfb 100644 --- a/queries/ninja/indents.scm +++ b/queries/ninja/indents.scm @@ -3,4 +3,3 @@ (rule) (build) ] @indent.begin - diff --git a/queries/nix/highlights.scm b/queries/nix/highlights.scm index bcabbbc65..57f4c11b8 100644 --- a/queries/nix/highlights.scm +++ b/queries/nix/highlights.scm @@ -33,11 +33,19 @@ (comment) @comment @spell ; strings -([ (string_expression) (indented_string_expression) ] +([ + (string_expression) + (indented_string_expression) +] (#set! "priority" 99)) @string ; paths and URLs -[ (path_expression) (hpath_expression) (spath_expression) ] @string.special.path +[ + (path_expression) + (hpath_expression) + (spath_expression) +] @string.special.path + (uri_expression) @string.special.url ; escape sequences @@ -76,8 +84,9 @@ ; function calls (apply_expression - function: (variable_expression - name: (identifier) @function.call)) + function: + (variable_expression + name: (identifier) @function.call)) ; basic identifiers (variable_expression) @variable @@ -92,58 +101,86 @@ ; builtin functions (with builtins prefix) (select_expression - expression: (variable_expression name: (identifier) @_id) - attrpath: (attrpath attr: (identifier) @function.builtin) - (#eq? @_id "builtins") -) + expression: + (variable_expression + name: (identifier) @_id) + attrpath: + (attrpath + attr: (identifier) @function.builtin) + (#eq? @_id "builtins")) ; builtin functions (without builtins prefix) -(variable_expression name: (identifier) @function.builtin +(variable_expression + name: (identifier) @function.builtin ; format-ignore (#any-of? @function.builtin ; nix eval --impure --expr 'with builtins; filter (x: !(elem x [ "abort" "derivation" "import" "throw" ]) && isFunction builtins.${x}) (attrNames builtins)' "add" "addErrorContext" "all" "any" "appendContext" "attrNames" "attrValues" "baseNameOf" "bitAnd" "bitOr" "bitXor" "break" "catAttrs" "ceil" "compareVersions" "concatLists" "concatMap" "concatStringsSep" "deepSeq" "derivationStrict" "dirOf" "div" "elem" "elemAt" "fetchGit" "fetchMercurial" "fetchTarball" "fetchTree" "fetchurl" "filter" "filterSource" "findFile" "floor" "foldl'" "fromJSON" "fromTOML" "functionArgs" "genList" "genericClosure" "getAttr" "getContext" "getEnv" "getFlake" "groupBy" "hasAttr" "hasContext" "hashFile" "hashString" "head" "intersectAttrs" "isAttrs" "isBool" "isFloat" "isFunction" "isInt" "isList" "isNull" "isPath" "isString" "length" "lessThan" "listToAttrs" "map" "mapAttrs" "match" "mul" "parseDrvName" "partition" "path" "pathExists" "placeholder" "readDir" "readFile" "removeAttrs" "replaceStrings" "scopedImport" "seq" "sort" "split" "splitVersion" "storePath" "stringLength" "sub" "substring" "tail" "toFile" "toJSON" "toPath" "toString" "toXML" "trace" "traceVerbose" "tryEval" "typeOf" "unsafeDiscardOutputDependency" "unsafeDiscardStringContext" "unsafeGetAttrPos" "zipAttrsWith" ; primops, `__<tab>` in `nix repl` - "__add" "__filter" "__isFunction" "__split" "__addErrorContext" "__filterSource" "__isInt" "__splitVersion" "__all" "__findFile" "__isList" "__storeDir" "__any" "__floor" "__isPath" "__storePath" "__appendContext" "__foldl'" "__isString" "__stringLength" "__attrNames" "__fromJSON" "__langVersion" "__sub" "__attrValues" "__functionArgs" "__length" "__substring" "__bitAnd" "__genList" "__lessThan" "__tail" "__bitOr" "__genericClosure" "__listToAttrs" "__toFile" "__bitXor" "__getAttr" "__mapAttrs" "__toJSON" "__catAttrs" "__getContext" "__match" "__toPath" "__ceil" "__getEnv" "__mul" "__toXML" "__compareVersions" "__getFlake" "__nixPath" "__trace" "__concatLists" "__groupBy" "__nixVersion" "__traceVerbose" "__concatMap" "__hasAttr" "__parseDrvName" "__tryEval" "__concatStringsSep" "__hasContext" "__partition" "__typeOf" "__currentSystem" "__hashFile" "__path" "__unsafeDiscardOutputDependency" "__currentTime" "__hashString" "__pathExists" "__unsafeDiscardStringContext" "__deepSeq" "__head" "__readDir" "__unsafeGetAttrPos" "__div" "__intersectAttrs" "__readFile" "__zipAttrsWith" "__elem" "__isAttrs" "__replaceStrings" "__elemAt" "__isBool" "__seq" "__fetchurl" "__isFloat" "__sort")) - + "__add" "__filter" "__isFunction" "__split" "__addErrorContext" "__filterSource" "__isInt" "__splitVersion" "__all" "__findFile" "__isList" "__storeDir" "__any" "__floor" "__isPath" "__storePath" "__appendContext" "__foldl'" "__isString" "__stringLength" "__attrNames" "__fromJSON" "__langVersion" "__sub" "__attrValues" "__functionArgs" "__length" "__substring" "__bitAnd" "__genList" "__lessThan" "__tail" "__bitOr" "__genericClosure" "__listToAttrs" "__toFile" "__bitXor" "__getAttr" "__mapAttrs" "__toJSON" "__catAttrs" "__getContext" "__match" "__toPath" "__ceil" "__getEnv" "__mul" "__toXML" "__compareVersions" "__getFlake" "__nixPath" "__trace" "__concatLists" "__groupBy" "__nixVersion" "__traceVerbose" "__concatMap" "__hasAttr" "__parseDrvName" "__tryEval" "__concatStringsSep" "__hasContext" "__partition" "__typeOf" "__currentSystem" "__hashFile" "__path" "__unsafeDiscardOutputDependency" "__currentTime" "__hashString" "__pathExists" "__unsafeDiscardStringContext" "__deepSeq" "__head" "__readDir" "__unsafeGetAttrPos" "__div" "__intersectAttrs" "__readFile" "__zipAttrsWith" "__elem" "__isAttrs" "__replaceStrings" "__elemAt" "__isBool" "__seq" "__fetchurl" "__isFloat" "__sort") + ) ; constants -(variable_expression name: (identifier) @constant.builtin +(variable_expression + name: (identifier) @constant.builtin ; format-ignore (#any-of? @constant.builtin ; nix eval --impure --expr 'with builtins; filter (x: !(isFunction builtins.${x} || isBool builtins.${x})) (attrNames builtins)' "builtins" "currentSystem" "currentTime" "langVersion" "nixPath" "nixVersion" "null" "storeDir")) ; string interpolation (this was very annoying to get working properly) -(interpolation "${" @punctuation.special (_) "}" @punctuation.special) @none +(interpolation + "${" @punctuation.special + (_) + "}" @punctuation.special) @none (select_expression expression: (_) @_expr - attrpath: (attrpath attr: (identifier) @variable.member) - (#not-eq? @_expr "builtins") -) -(attrset_expression (binding_set (binding . (attrpath (identifier) @variable.member)))) -(rec_attrset_expression (binding_set (binding . (attrpath (identifier) @variable.member)))) + attrpath: + (attrpath + attr: (identifier) @variable.member) + (#not-eq? @_expr "builtins")) + +(attrset_expression + (binding_set + (binding + . + (attrpath + (identifier) @variable.member)))) + +(rec_attrset_expression + (binding_set + (binding + . + (attrpath + (identifier) @variable.member)))) ; function definition -(binding - attrpath: (attrpath attr: (identifier) @function) +(binding + attrpath: + (attrpath + attr: (identifier) @function) expression: (function_expression)) ; unary operators -(unary_expression operator: _ @operator) +(unary_expression + operator: _ @operator) ; binary operators -(binary_expression operator: _ @operator) +(binary_expression + operator: _ @operator) ; integers, also highlight a unary - [ - (unary_expression "-" (integer_expression)) + (unary_expression + "-" + (integer_expression)) (integer_expression) ] @number ; floats, also highlight a unary - [ - (unary_expression "-" (float_expression)) + (unary_expression + "-" + (float_expression)) (float_expression) ] @number.float - diff --git a/queries/nix/injections.scm b/queries/nix/injections.scm index c2c31c44e..5d86d3697 100644 --- a/queries/nix/injections.scm +++ b/queries/nix/injections.scm @@ -1,140 +1,206 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((comment) @injection.language . ; this is to make sure only adjacent comments are accounted for the injections [ - (string_expression (string_fragment) @injection.content) - (indented_string_expression (string_fragment) @injection.content) + (string_expression + (string_fragment) @injection.content) + (indented_string_expression + (string_fragment) @injection.content) ] (#gsub! @injection.language "/%*%s*([%w%p]+)%s*%*/" "%1") (#set! injection.combined)) (apply_expression function: (_) @_func - argument: [ - (string_expression - ((string_fragment) @injection.content (#set! injection.language "regex"))) - (indented_string_expression - ((string_fragment) @injection.content (#set! injection.language "regex"))) - ] + argument: + [ + (string_expression + ((string_fragment) @injection.content + (#set! injection.language "regex"))) + (indented_string_expression + ((string_fragment) @injection.content + (#set! injection.language "regex"))) + ] (#match? @_func "(^|\\.)match$") (#set! injection.combined)) (binding - attrpath: (attrpath (identifier) @_path) - expression: [ - (string_expression - ((string_fragment) @injection.content (#set! injection.language "bash"))) - (indented_string_expression - ((string_fragment) @injection.content (#set! injection.language "bash"))) - ] - (#match? @_path "(^\\w+(Phase|Hook)|(pre|post)[A-Z]\\w+|script)$")) + attrpath: + (attrpath + (identifier) @_path) + expression: + [ + (string_expression + ((string_fragment) @injection.content + (#set! injection.language "bash"))) + (indented_string_expression + ((string_fragment) @injection.content + (#set! injection.language "bash"))) + ] + (#match? @_path "(^\\w+(Phase|Hook|Check)|(pre|post)[A-Z]\\w+|script)$")) (apply_expression function: (_) @_func - argument: (_ (_)* (_ (_)* (binding - attrpath: (attrpath (identifier) @_path) - expression: [ - (string_expression - ((string_fragment) @injection.content (#set! injection.language "bash"))) - (indented_string_expression - ((string_fragment) @injection.content (#set! injection.language "bash"))) - ]))) + argument: + (_ + (_)* + (_ + (_)* + (binding + attrpath: + (attrpath + (identifier) @_path) + expression: + [ + (string_expression + ((string_fragment) @injection.content + (#set! injection.language "bash"))) + (indented_string_expression + ((string_fragment) @injection.content + (#set! injection.language "bash"))) + ]))) (#match? @_func "(^|\\.)writeShellApplication$") (#match? @_path "^text$") (#set! injection.combined)) (apply_expression - function: (apply_expression - function: (apply_expression function: (_) @_func)) - argument: [ - (string_expression - ((string_fragment) @injection.content (#set! injection.language "bash"))) - (indented_string_expression - ((string_fragment) @injection.content (#set! injection.language "bash"))) - ] + function: + (apply_expression + function: + (apply_expression + function: (_) @_func)) + argument: + [ + (string_expression + ((string_fragment) @injection.content + (#set! injection.language "bash"))) + (indented_string_expression + ((string_fragment) @injection.content + (#set! injection.language "bash"))) + ] (#match? @_func "(^|\\.)runCommand((No)?CC)?(Local)?$") (#set! injection.combined)) ((apply_expression - function: (apply_expression function: (_) @_func) - argument: [ - (string_expression - ((string_fragment) @injection.content (#set! injection.language "bash"))) - (indented_string_expression - ((string_fragment) @injection.content (#set! injection.language "bash"))) - ]) + function: + (apply_expression + function: (_) @_func) + argument: + [ + (string_expression + ((string_fragment) @injection.content + (#set! injection.language "bash"))) + (indented_string_expression + ((string_fragment) @injection.content + (#set! injection.language "bash"))) + ]) (#match? @_func "(^|\\.)write(Bash|Dash|ShellScript)(Bin)?$") (#set! injection.combined)) ((apply_expression - function: (apply_expression function: (_) @_func) - argument: [ - (string_expression - ((string_fragment) @injection.content (#set! injection.language "fish"))) - (indented_string_expression - ((string_fragment) @injection.content (#set! injection.language "fish"))) - ]) + function: + (apply_expression + function: (_) @_func) + argument: + [ + (string_expression + ((string_fragment) @injection.content + (#set! injection.language "fish"))) + (indented_string_expression + ((string_fragment) @injection.content + (#set! injection.language "fish"))) + ]) (#match? @_func "(^|\\.)writeFish(Bin)?$") (#set! injection.combined)) ((apply_expression - function: (apply_expression - function: (apply_expression function: (_) @_func)) - argument: [ - (string_expression - ((string_fragment) @injection.content (#set! injection.language "haskell"))) - (indented_string_expression - ((string_fragment) @injection.content (#set! injection.language "haskell"))) - ]) + function: + (apply_expression + function: + (apply_expression + function: (_) @_func)) + argument: + [ + (string_expression + ((string_fragment) @injection.content + (#set! injection.language "haskell"))) + (indented_string_expression + ((string_fragment) @injection.content + (#set! injection.language "haskell"))) + ]) (#match? @_func "(^|\\.)writeHaskell(Bin)?$") (#set! injection.combined)) ((apply_expression - function: (apply_expression - function: (apply_expression function: (_) @_func)) - argument: [ - (string_expression - ((string_fragment) @injection.content (#set! injection.language "javascript"))) - (indented_string_expression - ((string_fragment) @injection.content (#set! injection.language "javascript"))) - ]) + function: + (apply_expression + function: + (apply_expression + function: (_) @_func)) + argument: + [ + (string_expression + ((string_fragment) @injection.content + (#set! injection.language "javascript"))) + (indented_string_expression + ((string_fragment) @injection.content + (#set! injection.language "javascript"))) + ]) (#match? @_func "(^|\\.)writeJS(Bin)?$") (#set! injection.combined)) ((apply_expression - function: (apply_expression - function: (apply_expression function: (_) @_func)) - argument: [ - (string_expression - ((string_fragment) @injection.content (#set! injection.language "perl"))) - (indented_string_expression - ((string_fragment) @injection.content (#set! injection.language "perl"))) - ]) + function: + (apply_expression + function: + (apply_expression + function: (_) @_func)) + argument: + [ + (string_expression + ((string_fragment) @injection.content + (#set! injection.language "perl"))) + (indented_string_expression + ((string_fragment) @injection.content + (#set! injection.language "perl"))) + ]) (#match? @_func "(^|\\.)writePerl(Bin)?$") (#set! injection.combined)) ((apply_expression - function: (apply_expression - function: (apply_expression function: (_) @_func)) - argument: [ - (string_expression - ((string_fragment) @injection.content (#set! injection.language "python"))) - (indented_string_expression - ((string_fragment) @injection.content (#set! injection.language "python"))) - ]) + function: + (apply_expression + function: + (apply_expression + function: (_) @_func)) + argument: + [ + (string_expression + ((string_fragment) @injection.content + (#set! injection.language "python"))) + (indented_string_expression + ((string_fragment) @injection.content + (#set! injection.language "python"))) + ]) (#match? @_func "(^|\\.)write(PyPy|Python)[23](Bin)?$") (#set! injection.combined)) ((apply_expression - function: (apply_expression - function: (apply_expression function: (_) @_func)) - argument: [ - (string_expression - ((string_fragment) @injection.content (#set! injection.language "rust"))) - (indented_string_expression - ((string_fragment) @injection.content (#set! injection.language "rust"))) - ]) + function: + (apply_expression + function: + (apply_expression + function: (_) @_func)) + argument: + [ + (string_expression + ((string_fragment) @injection.content + (#set! injection.language "rust"))) + (indented_string_expression + ((string_fragment) @injection.content + (#set! injection.language "rust"))) + ]) (#match? @_func "(^|\\.)writeRust(Bin)?$") (#set! injection.combined)) diff --git a/queries/nix/locals.scm b/queries/nix/locals.scm index 1871f0404..61cab2309 100644 --- a/queries/nix/locals.scm +++ b/queries/nix/locals.scm @@ -1,15 +1,34 @@ ; let bindings -(let_expression (binding_set (binding . (attrpath) @local.definition.var))) @local.scope +(let_expression + (binding_set + (binding + . + (attrpath) @local.definition.var))) @local.scope ; rec attrsets -(rec_attrset_expression (binding_set (binding . (attrpath) @local.definition.field))) @local.scope +(rec_attrset_expression + (binding_set + (binding + . + (attrpath) @local.definition.field))) @local.scope ; functions and parameters -(function_expression . [ +(function_expression + . + [ (identifier) @local.definition.parameter - (formals (formal . (identifier) @local.definition.parameter)) -]) @local.scope -((formals) "@" (identifier) @local.definition.parameter) ; I couldn't get this to work properly inside the (function) + (formals + (formal + . + (identifier) @local.definition.parameter)) + ]) @local.scope -(variable_expression (identifier) @local.reference) -(inherited_attrs attr: (identifier) @local.reference) +((formals) + "@" + (identifier) @local.definition.parameter) ; I couldn't get this to work properly inside the (function) + +(variable_expression + (identifier) @local.reference) + +(inherited_attrs + attr: (identifier) @local.reference) diff --git a/queries/nqc/highlights.scm b/queries/nqc/highlights.scm index 2198426ca..d1ff8de9c 100644 --- a/queries/nqc/highlights.scm +++ b/queries/nqc/highlights.scm @@ -1,13 +1,10 @@ ; inherits: c - [ "task" "sub" ] @keyword.function -[ - "until" -] @keyword.repeat +"until" @keyword.repeat [ "acquire" diff --git a/queries/objc/folds.scm b/queries/objc/folds.scm index b922f8bf8..90469b9c3 100644 --- a/queries/objc/folds.scm +++ b/queries/objc/folds.scm @@ -1,5 +1,4 @@ ; inherits: c - [ (class_declaration) (class_interface) diff --git a/queries/objc/highlights.scm b/queries/objc/highlights.scm index 129a74e89..dfb513a07 100644 --- a/queries/objc/highlights.scm +++ b/queries/objc/highlights.scm @@ -1,20 +1,19 @@ ; inherits: c - ; Preprocs - (preproc_undef name: (_) @constant) @keyword.directive ; Includes - -(module_import "@import" @keyword.import path: (identifier) @module) +(module_import + "@import" @keyword.import + path: (identifier) @module) ((preproc_include - _ @keyword.import path: (_)) + _ @keyword.import + path: (_)) (#any-of? @keyword.import "#include" "#import")) ; Type Qualifiers - [ "@optional" "@required" @@ -24,7 +23,6 @@ ] @type.qualifier ; Storageclasses - [ "@autoreleasepool" "@synthesize" @@ -34,7 +32,6 @@ ] @keyword.storage ; Keywords - [ "@protocol" "@interface" @@ -47,10 +44,21 @@ "@end" ] @keyword -(class_declaration "@" @keyword "class" @keyword) ; I hate Obj-C for allowing "@ class" :) +(class_declaration + "@" @keyword + "class" @keyword) ; I hate Obj-C for allowing "@ class" :) -(method_definition ["+" "-"] @keyword.function) -(method_declaration ["+" "-"] @keyword.function) +(method_definition + [ + "+" + "-" + ] @keyword.function) + +(method_declaration + [ + "+" + "-" + ] @keyword.function) [ "__typeof__" @@ -65,7 +73,6 @@ ] @keyword.coroutine ; Exceptions - [ "@try" "__try" @@ -77,12 +84,10 @@ ] @keyword.exception ; Variables - ((identifier) @variable.builtin (#any-of? @variable.builtin "self" "super")) ; Functions & Methods - [ "objc_bridge_related" "@available" @@ -91,34 +96,59 @@ "asm" ] @function.builtin -(method_definition (identifier) @function.method) +(method_definition + (identifier) @function.method) -(method_declaration (identifier) @function.method) +(method_declaration + (identifier) @function.method) -(method_identifier (identifier)? @function.method ":" @function.method (identifier)? @function.method) +(method_identifier + (identifier)? @function.method + ":" @function.method + (identifier)? @function.method) -(message_expression method: (identifier) @function.method.call) +(message_expression + method: (identifier) @function.method.call) ; Constructors - -((message_expression method: (identifier) @constructor) +((message_expression + method: (identifier) @constructor) (#eq? @constructor "init")) ; Attributes - -(availability_attribute_specifier +(availability_attribute_specifier [ - "CF_FORMAT_FUNCTION" "NS_AVAILABLE" "__IOS_AVAILABLE" "NS_AVAILABLE_IOS" - "API_AVAILABLE" "API_UNAVAILABLE" "API_DEPRECATED" "NS_ENUM_AVAILABLE_IOS" - "NS_DEPRECATED_IOS" "NS_ENUM_DEPRECATED_IOS" "NS_FORMAT_FUNCTION" "DEPRECATED_MSG_ATTRIBUTE" - "__deprecated_msg" "__deprecated_enum_msg" "NS_SWIFT_NAME" "NS_SWIFT_UNAVAILABLE" - "NS_EXTENSION_UNAVAILABLE_IOS" "NS_CLASS_AVAILABLE_IOS" "NS_CLASS_DEPRECATED_IOS" "__OSX_AVAILABLE_STARTING" - "NS_ROOT_CLASS" "NS_UNAVAILABLE" "NS_REQUIRES_NIL_TERMINATION" "CF_RETURNS_RETAINED" - "CF_RETURNS_NOT_RETAINED" "DEPRECATED_ATTRIBUTE" "UI_APPEARANCE_SELECTOR" "UNAVAILABLE_ATTRIBUTE" + "CF_FORMAT_FUNCTION" + "NS_AVAILABLE" + "__IOS_AVAILABLE" + "NS_AVAILABLE_IOS" + "API_AVAILABLE" + "API_UNAVAILABLE" + "API_DEPRECATED" + "NS_ENUM_AVAILABLE_IOS" + "NS_DEPRECATED_IOS" + "NS_ENUM_DEPRECATED_IOS" + "NS_FORMAT_FUNCTION" + "DEPRECATED_MSG_ATTRIBUTE" + "__deprecated_msg" + "__deprecated_enum_msg" + "NS_SWIFT_NAME" + "NS_SWIFT_UNAVAILABLE" + "NS_EXTENSION_UNAVAILABLE_IOS" + "NS_CLASS_AVAILABLE_IOS" + "NS_CLASS_DEPRECATED_IOS" + "__OSX_AVAILABLE_STARTING" + "NS_ROOT_CLASS" + "NS_UNAVAILABLE" + "NS_REQUIRES_NIL_TERMINATION" + "CF_RETURNS_RETAINED" + "CF_RETURNS_NOT_RETAINED" + "DEPRECATED_ATTRIBUTE" + "UI_APPEARANCE_SELECTOR" + "UNAVAILABLE_ATTRIBUTE" ]) @attribute ; Macros - (type_qualifier [ "_Complex" @@ -145,22 +175,38 @@ "__weak" ]) @function.macro.builtin -[ "__real" "__imag" ] @function.macro.builtin +[ + "__real" + "__imag" +] @function.macro.builtin -((call_expression function: (identifier) @function.macro) +((call_expression + function: (identifier) @function.macro) (#eq? @function.macro "testassert")) ; Types +(class_declaration + (identifier) @type) -(class_declaration (identifier) @type) - -(class_interface "@interface" . (identifier) @type superclass: _? @type category: _? @module) +(class_interface + "@interface" + . + (identifier) @type + superclass: _? @type + category: _? @module) -(class_implementation "@implementation" . (identifier) @type superclass: _? @type category: _? @module) +(class_implementation + "@implementation" + . + (identifier) @type + superclass: _? @type + category: _? @module) -(protocol_forward_declaration (identifier) @type) ; @interface :( +(protocol_forward_declaration + (identifier) @type) ; @interface :( -(protocol_reference_list (identifier) @type) ; ^ +(protocol_reference_list + (identifier) @type) ; ^ [ "BOOL" @@ -171,46 +217,53 @@ ] @type.builtin ; Constants +(property_attribute + (identifier) @constant + "="?) -(property_attribute (identifier) @constant "="?) - -[ "__asm" "__asm__" ] @constant.macro +[ + "__asm" + "__asm__" +] @constant.macro ; Properties - -(property_implementation "@synthesize" (identifier) @property) +(property_implementation + "@synthesize" + (identifier) @property) ((identifier) @property (#has-ancestor? @property struct_declaration)) ; Parameters +(method_parameter + ":" @function.method + (identifier) @variable.parameter) -(method_parameter ":" @function.method (identifier) @variable.parameter) - -(method_parameter declarator: (identifier) @variable.parameter) +(method_parameter + declarator: (identifier) @variable.parameter) -(parameter_declaration - declarator: (function_declarator - declarator: (parenthesized_declarator - (block_pointer_declarator - declarator: (identifier) @variable.parameter)))) +(parameter_declaration + declarator: + (function_declarator + declarator: + (parenthesized_declarator + (block_pointer_declarator + declarator: (identifier) @variable.parameter)))) "..." @variable.parameter.builtin ; Operators - -[ - "^" -] @operator +"^" @operator ; Literals - (platform) @string.special (version_number) @string.special ; Punctuation - "@" @punctuation.special -[ "<" ">" ] @punctuation.bracket +[ + "<" + ">" +] @punctuation.bracket diff --git a/queries/objc/injections.scm b/queries/objc/injections.scm index 359420d10..f5d13f38e 100644 --- a/queries/objc/injections.scm +++ b/queries/objc/injections.scm @@ -1,5 +1,4 @@ ; inherits: c - ; TODO(amaanq): uncomment/add when I add asm support ; (ms_asm_block "{" _ @asm "}") ; diff --git a/queries/objdump/highlights.scm b/queries/objdump/highlights.scm index 7532260a6..b73e18803 100644 --- a/queries/objdump/highlights.scm +++ b/queries/objdump/highlights.scm @@ -16,20 +16,45 @@ (section_address) @string.special (identifier) @variable -(code_location (identifier) @function.call) -(header (identifier) @keyword) -(disassembly_section_label (identifier) @module) -(disassembly_section (identifier) @module) -[(file_offset) (discriminator)] @variable.member +(code_location + (identifier) @function.call) + +(header + (identifier) @keyword) + +(disassembly_section_label + (identifier) @module) + +(disassembly_section + (identifier) @module) + +[ + (file_offset) + (discriminator) +] @variable.member (file_path) @string.special.path + (instruction) @function + (bad_instruction) @comment.warning + (label) @label -["<" ">"] @punctuation.special -["(" ")"] @punctuation.bracket -["+" ":"] @punctuation.delimiter +[ + "<" + ">" +] @punctuation.special + +[ + "(" + ")" +] @punctuation.bracket + +[ + "+" + ":" +] @punctuation.delimiter (comment) @comment.documentation diff --git a/queries/ocaml/highlights.scm b/queries/ocaml/highlights.scm index d08c8e358..99151efdc 100644 --- a/queries/ocaml/highlights.scm +++ b/queries/ocaml/highlights.scm @@ -1,86 +1,109 @@ ; Modules ;-------- - -[(module_name) (module_type_name)] @module +[ + (module_name) + (module_type_name) +] @module ; Types ;------ +((type_constructor) @type.builtin + (#any-of? @type.builtin "int" "char" "bytes" "string" "float" "bool" "unit" "exn" "array" "list" "option" "int32" "int64" "nativeint" "format6" "lazy_t")) -( - (type_constructor) @type.builtin - (#any-of? @type.builtin - "int" "char" "bytes" "string" "float" - "bool" "unit" "exn" "array" "list" "option" - "int32" "int64" "nativeint" "format6" "lazy_t") -) - -[(class_name) (class_type_name) (type_constructor)] @type +[ + (class_name) + (class_type_name) + (type_constructor) +] @type -[(constructor_name) (tag)] @constructor +[ + (constructor_name) + (tag) +] @constructor ; Variables ;---------- - -[(value_name) (type_variable)] @variable +[ + (value_name) + (type_variable) +] @variable (value_pattern) @variable.parameter ; Functions ;---------- - (let_binding pattern: (value_name) @function (parameter)) (let_binding pattern: (value_name) @function - body: [(fun_expression) (function_expression)]) + body: + [ + (fun_expression) + (function_expression) + ]) -(value_specification (value_name) @function) +(value_specification + (value_name) @function) -(external (value_name) @function) +(external + (value_name) @function) (method_name) @function.method ; Application ;------------ - (infix_expression - left: (value_path (value_name) @function.call) + left: + (value_path + (value_name) @function.call) operator: (concat_operator) @_operator (#eq? @_operator "@@")) (infix_expression operator: (rel_operator) @_operator - right: (value_path (value_name) @function.call) + right: + (value_path + (value_name) @function.call) (#eq? @_operator "|>")) (application_expression - function: (value_path (value_name) @function.call)) + function: + (value_path + (value_name) @function.call)) ((value_name) @function.builtin (#any-of? @function.builtin "raise" "raise_notrace" "failwith" "invalid_arg")) ; Properties ;----------- - -[(label_name) (field_name) (instance_variable_name)] @property +[ + (label_name) + (field_name) + (instance_variable_name) +] @property ; Constants ;---------- - ; Don't let normal parens take priority over this -((unit) @constant.builtin (#set! "priority" 105)) +((unit) @constant.builtin + (#set! "priority" 105)) (boolean) @boolean -[(number) (signed_number)] @number +[ + (number) + (signed_number) +] @number (character) @character (string) @string -(quoted_string "{" @string "}" @string) @string +(quoted_string + "{" @string + "}" @string) @string (escape_sequence) @string.escape @@ -91,55 +114,162 @@ ; Keywords ;--------- - [ - "and" "as" "assert" "begin" "class" - "constraint" "end" "external" "in" - "inherit" "initializer" "let" "match" - "method" "module" "new" "object" "of" - "sig" "struct" "type" "val" "when" "with" + "and" + "as" + "assert" + "begin" + "class" + "constraint" + "end" + "external" + "in" + "inherit" + "initializer" + "let" + "match" + "method" + "module" + "new" + "object" + "of" + "sig" + "struct" + "type" + "val" + "when" + "with" ] @keyword [ - "lazy" "mutable" "nonrec" - "rec" "private" "virtual" + "lazy" + "mutable" + "nonrec" + "rec" + "private" + "virtual" ] @type.qualifier -["fun" "function" "functor"] @keyword.function +[ + "fun" + "function" + "functor" +] @keyword.function -["if" "then" "else"] @keyword.conditional +[ + "if" + "then" + "else" +] @keyword.conditional -["exception" "try"] @keyword.exception +[ + "exception" + "try" +] @keyword.exception -["include" "open"] @keyword.import +[ + "include" + "open" +] @keyword.import -["for" "to" "downto" "while" "do" "done"] @keyword.repeat +[ + "for" + "to" + "downto" + "while" + "do" + "done" +] @keyword.repeat ; Punctuation ;------------ +(attribute + [ + "[@" + "]" + ] @punctuation.special) + +(item_attribute + [ + "[@@" + "]" + ] @punctuation.special) + +(floating_attribute + [ + "[@@@" + "]" + ] @punctuation.special) + +(extension + [ + "[%" + "]" + ] @punctuation.special) + +(item_extension + [ + "[%%" + "]" + ] @punctuation.special) + +(quoted_extension + [ + "{%" + "}" + ] @punctuation.special) -(attribute ["[@" "]"] @punctuation.special) -(item_attribute ["[@@" "]"] @punctuation.special) -(floating_attribute ["[@@@" "]"] @punctuation.special) -(extension ["[%" "]"] @punctuation.special) -(item_extension ["[%%" "]"] @punctuation.special) -(quoted_extension ["{%" "}"] @punctuation.special) -(quoted_item_extension ["{%%" "}"] @punctuation.special) +(quoted_item_extension + [ + "{%%" + "}" + ] @punctuation.special) "%" @punctuation.special -["(" ")" "[" "]" "{" "}" "[|" "|]" "[<" "[>"] @punctuation.bracket +[ + "(" + ")" + "[" + "]" + "{" + "}" + "[|" + "|]" + "[<" + "[>" +] @punctuation.bracket -(object_type ["<" ">"] @punctuation.bracket) +(object_type + [ + "<" + ">" + ] @punctuation.bracket) [ - "," "." ";" ":" "=" "|" "~" "?" "+" "-" "!" ">" "&" - "->" ";;" ":>" "+=" ":=" ".." + "," + "." + ";" + ":" + "=" + "|" + "~" + "?" + "+" + "-" + "!" + ">" + "&" + "->" + ";;" + ":>" + "+=" + ":=" + ".." ] @punctuation.delimiter ; Operators ;---------- - [ (prefix_operator) (sign_operator) @@ -158,18 +288,31 @@ (match_operator) ] @operator -(match_expression (match_operator) @keyword) +(match_expression + (match_operator) @keyword) -(value_definition [(let_operator) (let_and_operator)] @keyword) +(value_definition + [ + (let_operator) + (let_and_operator) + ] @keyword) -["*" "#" "::" "<-"] @operator +[ + "*" + "#" + "::" + "<-" +] @operator ; Attributes ;----------- - (attribute_id) @property ; Comments ;--------- - -[(comment) (line_number_directive) (directive) (shebang)] @comment @spell +[ + (comment) + (line_number_directive) + (directive) + (shebang) +] @comment @spell diff --git a/queries/ocaml/indents.scm b/queries/ocaml/indents.scm index d821abbd7..9181dcadf 100644 --- a/queries/ocaml/indents.scm +++ b/queries/ocaml/indents.scm @@ -23,48 +23,55 @@ ; handle if-else if-else case (if_expression condition: (_) @indent.begin) + (then_clause) @indent.begin -((else_clause - (_) @_not_if) @indent.begin - (#not-has-type? @_not_if if_expression)) -((parameter) @indent.begin - (#set! indent.start_at_same_line)) +((else_clause + (_) @_not_if) @indent.begin + (#not-has-type? @_not_if if_expression)) -(_ (ERROR) @indent.begin - (#set! indent.start_at_same_line)) +((parameter) @indent.begin + (#set! indent.start_at_same_line)) -(ERROR "|" @indent.begin - (#set! indent.start_at_same_line)) +(_ + (ERROR) @indent.begin + (#set! indent.start_at_same_line)) +(ERROR + "|" @indent.begin + (#set! indent.start_at_same_line)) (try_expression "with" @indent.branch [ (match_case) @indent.dedent - (match_case + (match_case [ - (parenthesized_expression) + (parenthesized_expression) (list_expression) ] @indent.dedent) - ] -) + ]) -[ - "}" -] @indent.branch @indent.end +"}" @indent.branch @indent.end +(list_expression + "]" @indent.branch) -(list_expression "]" @indent.branch) -(parenthesized_expression ")" @indent.branch) +(parenthesized_expression + ")" @indent.branch) ";;" @indent.end -(do_clause "done" @indent.end @indent.branch) -(structure "end" @indent.end @indent.branch) -(signature "end" @indent.end @indent.branch) +(do_clause + "done" @indent.end @indent.branch) + +(structure + "end" @indent.end @indent.branch) + +(signature + "end" @indent.end @indent.branch) [ (string) - (comment) + (comment) ] @indent.auto diff --git a/queries/ocaml/injections.scm b/queries/ocaml/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/ocaml/injections.scm +++ b/queries/ocaml/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/ocaml/locals.scm b/queries/ocaml/locals.scm index 1230bd013..38f1f15f2 100644 --- a/queries/ocaml/locals.scm +++ b/queries/ocaml/locals.scm @@ -1,6 +1,5 @@ ; Scopes ;------- - [ (compilation_unit) (structure) @@ -22,7 +21,6 @@ ; Definitions ;------------ - (value_pattern) @local.definition.var (let_binding @@ -30,37 +28,49 @@ (#set! definition.var.scope "parent")) (let_binding - pattern: (tuple_pattern (value_name) @local.definition.var) + pattern: + (tuple_pattern + (value_name) @local.definition.var) (#set! definition.var.scope "parent")) (let_binding - pattern: (record_pattern (field_pattern (value_name) @local.definition.var)) + pattern: + (record_pattern + (field_pattern + (value_name) @local.definition.var)) (#set! definition.var.scope "parent")) -(external (value_name) @local.definition.var) +(external + (value_name) @local.definition.var) -(type_binding (type_constructor) @local.definition.type) +(type_binding + (type_constructor) @local.definition.type) -(abstract_type (type_constructor) @local.definition.type) +(abstract_type + (type_constructor) @local.definition.type) -(method_definition (method_name) @local.definition.method) +(method_definition + (method_name) @local.definition.method) (module_binding (module_name) @local.definition.namespace (#set! definition.namespace.scope "parent")) -(module_parameter (module_name) @local.definition.namespace) +(module_parameter + (module_name) @local.definition.namespace) -(module_type_definition (module_type_name) @local.definition.type) +(module_type_definition + (module_type_name) @local.definition.type) ; References ;------------ - -(value_path . +(value_path + . (value_name) @local.reference (#set! reference.kind "var")) -(type_constructor_path . +(type_constructor_path + . (type_constructor) @local.reference (#set! reference.kind "type")) @@ -68,10 +78,12 @@ (method_name) @local.reference (#set! reference.kind "method")) -(module_path . +(module_path + . (module_name) @local.reference (#set! reference.kind "type")) -(module_type_path . +(module_type_path + . (module_type_name) @local.reference (#set! reference.kind "type")) diff --git a/queries/ocamllex/highlights.scm b/queries/ocamllex/highlights.scm index 6a5088710..2556aa4c2 100644 --- a/queries/ocamllex/highlights.scm +++ b/queries/ocamllex/highlights.scm @@ -1,40 +1,70 @@ ; Allow OCaml highlighter - (ocaml) @none ; Regular expressions - (regexp_name) @variable -[(eof) (any)] @constant +[ + (eof) + (any) +] @constant (character) @character (string) @string + (escape_sequence) @string.escape -(character_set "^" @punctuation.special) -(character_range "-" @punctuation.delimiter) +(character_set + "^" @punctuation.special) -(regexp_difference ["#"] @operator) -(regexp_repetition ["?" "*" "+"] @operator) -(regexp_alternative ["|"] @operator) +(character_range + "-" @punctuation.delimiter) -; Rules +(regexp_difference + "#" @operator) + +(regexp_repetition + [ + "?" + "*" + "+" + ] @operator) + +(regexp_alternative + "|" @operator) +; Rules (lexer_entry_name) @function + (lexer_argument) @variable.parameter -(lexer_entry ["=" "|"] @punctuation.delimiter) +(lexer_entry + [ + "=" + "|" + ] @punctuation.delimiter) ; keywords - -["and" "as" "let" "parse" "refill" "rule" "shortest"] @keyword +[ + "and" + "as" + "let" + "parse" + "refill" + "rule" + "shortest" +] @keyword ; Punctuation - -["[" "]" "(" ")" "{" "}"] @punctuation.bracket +[ + "[" + "]" + "(" + ")" + "{" + "}" +] @punctuation.bracket ; Misc - (comment) @comment @spell diff --git a/queries/ocamllex/injections.scm b/queries/ocamllex/injections.scm index ed1d9302a..ecc577d40 100644 --- a/queries/ocamllex/injections.scm +++ b/queries/ocamllex/injections.scm @@ -1,5 +1,5 @@ ((ocaml) @injection.content - (#set! injection.language "ocaml")) + (#set! injection.language "ocaml")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/odin/highlights.scm b/queries/odin/highlights.scm index 38896cbfc..f599f6e97 100644 --- a/queries/odin/highlights.scm +++ b/queries/odin/highlights.scm @@ -1,19 +1,16 @@ ; Preprocs - [ (calling_convention) (tag) ] @keyword.directive ; Includes - [ "import" "package" ] @keyword.import ; Keywords - [ "foreign" "using" @@ -29,9 +26,7 @@ "matrix" ] @keyword -[ - "proc" -] @keyword.function +"proc" @keyword.function [ "return" @@ -44,7 +39,6 @@ ] @keyword.storage ; Conditionals - [ "if" "else" @@ -67,7 +61,6 @@ (#set! "priority" 105)) ; Repeats - [ "for" "do" @@ -75,116 +68,163 @@ ] @keyword.repeat ; Variables - (identifier) @variable ; Namespaces +(package_declaration + (identifier) @module) -(package_declaration (identifier) @module) - -(import_declaration alias: (identifier) @module) +(import_declaration + alias: (identifier) @module) -(foreign_block (identifier) @module) +(foreign_block + (identifier) @module) -(using_statement (identifier) @module) +(using_statement + (identifier) @module) ; Parameters +(parameter + (identifier) @variable.parameter + ":" + "="? + (identifier)? @constant) -(parameter (identifier) @variable.parameter ":" "="? (identifier)? @constant) - -(default_parameter (identifier) @variable.parameter ":=") +(default_parameter + (identifier) @variable.parameter + ":=") -(named_type (identifier) @variable.parameter) +(named_type + (identifier) @variable.parameter) -(call_expression argument: (identifier) @variable.parameter "=") +(call_expression + argument: (identifier) @variable.parameter + "=") ; Functions +(procedure_declaration + (identifier) @type) -(procedure_declaration (identifier) @type) +(procedure_declaration + (identifier) @function + (procedure + (block))) -(procedure_declaration (identifier) @function (procedure (block))) +(procedure_declaration + (identifier) @function + (procedure + (uninitialized))) -(procedure_declaration (identifier) @function (procedure (uninitialized))) +(overloaded_procedure_declaration + (identifier) @function) -(overloaded_procedure_declaration (identifier) @function) - -(call_expression function: (identifier) @function.call) +(call_expression + function: (identifier) @function.call) ; Types +(type + (identifier) @type) -(type (identifier) @type) - -((type (identifier) @type.builtin) - (#any-of? @type.builtin - "bool" "byte" "b8" "b16" "b32" "b64" - "int" "i8" "i16" "i32" "i64" "i128" - "uint" "u8" "u16" "u32" "u64" "u128" "uintptr" - "i16le" "i32le" "i64le" "i128le" "u16le" "u32le" "u64le" "u128le" - "i16be" "i32be" "i64be" "i128be" "u16be" "u32be" "u64be" "u128be" - "float" "double" "f16" "f32" "f64" "f16le" "f32le" "f64le" "f16be" "f32be" "f64be" - "complex32" "complex64" "complex128" "complex_float" "complex_double" - "quaternion64" "quaternion128" "quaternion256" - "rune" "string" "cstring" "rawptr" "typeid" "any")) +((type + (identifier) @type.builtin) + (#any-of? @type.builtin "bool" "byte" "b8" "b16" "b32" "b64" "int" "i8" "i16" "i32" "i64" "i128" "uint" "u8" "u16" "u32" "u64" "u128" "uintptr" "i16le" "i32le" "i64le" "i128le" "u16le" "u32le" "u64le" "u128le" "i16be" "i32be" "i64be" "i128be" "u16be" "u32be" "u64be" "u128be" "float" "double" "f16" "f32" "f64" "f16le" "f32le" "f64le" "f16be" "f32be" "f64be" "complex32" "complex64" "complex128" "complex_float" "complex_double" "quaternion64" "quaternion128" "quaternion256" "rune" "string" "cstring" "rawptr" "typeid" "any")) "..." @type.builtin -(struct_declaration (identifier) @type "::") +(struct_declaration + (identifier) @type + "::") -(enum_declaration (identifier) @type "::") +(enum_declaration + (identifier) @type + "::") -(union_declaration (identifier) @type "::") +(union_declaration + (identifier) @type + "::") -(const_declaration (identifier) @type "::" [(array_type) (distinct_type) (bit_set_type) (pointer_type)]) +(const_declaration + (identifier) @type + "::" + [ + (array_type) + (distinct_type) + (bit_set_type) + (pointer_type) + ]) -(struct . (identifier) @type) +(struct + . + (identifier) @type) -(field_type . (identifier) @module "." (identifier) @type) +(field_type + . + (identifier) @module + "." + (identifier) @type) -(bit_set_type (identifier) @type ";") +(bit_set_type + (identifier) @type + ";") -(procedure_type (parameters (parameter (identifier) @type))) +(procedure_type + (parameters + (parameter + (identifier) @type))) -(polymorphic_parameters (identifier) @type) +(polymorphic_parameters + (identifier) @type) ((identifier) @type (#lua-match? @type "^[A-Z][a-zA-Z0-9]*$") (#not-has-parent? @type parameter procedure_declaration)) ; Fields +(member_expression + "." + (identifier) @variable.member) -(member_expression "." (identifier) @variable.member) - -(struct_type "{" (identifier) @variable.member) +(struct_type + "{" + (identifier) @variable.member) -(struct_field (identifier) @variable.member "="?) +(struct_field + (identifier) @variable.member + "="?) -(field (identifier) @variable.member) +(field + (identifier) @variable.member) ; Constants - ((identifier) @constant (#lua-match? @constant "^_*[A-Z][A-Z0-9_]*$") (#not-has-parent? @constant type parameter)) -(member_expression . "." (identifier) @constant) +(member_expression + . + "." + (identifier) @constant) -(enum_declaration "{" (identifier) @constant) +(enum_declaration + "{" + (identifier) @constant) ; Macros - -((call_expression function: (identifier) @function.macro) +((call_expression + function: (identifier) @function.macro) (#lua-match? @function.macro "^_*[A-Z][A-Z0-9_]*$")) ; Attributes - -(attribute (identifier) @attribute "="?) +(attribute + (identifier) @attribute + "="?) ; Labels - -(label_statement (identifier) @label ":") +(label_statement + (identifier) @label + ":") ; Literals - (number) @number (float) @number.float @@ -206,7 +246,6 @@ (#any-of? @variable.builtin "context" "self")) ; Operators - [ ":=" "=" @@ -259,12 +298,20 @@ ] @keyword.operator ; Punctuation +[ + "{" + "}" +] @punctuation.bracket -[ "{" "}" ] @punctuation.bracket - -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket [ "::" @@ -275,14 +322,12 @@ ";" ] @punctuation.delimiter - [ "@" "$" ] @punctuation.special ; Comments - [ (comment) (block_comment) diff --git a/queries/odin/injections.scm b/queries/odin/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/odin/injections.scm +++ b/queries/odin/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/odin/locals.scm b/queries/odin/locals.scm index 845a08a48..6c55f8a1a 100644 --- a/queries/odin/locals.scm +++ b/queries/odin/locals.scm @@ -1,5 +1,4 @@ ; Scopes - [ (block) (declaration) @@ -7,33 +6,54 @@ ] @local.scope ; References - (identifier) @local.reference ; Definitions +(package_declaration + (identifier) @local.definition.namespace) -(package_declaration (identifier) @local.definition.namespace) - -(import_declaration alias: (identifier) @local.definition.namespace) +(import_declaration + alias: (identifier) @local.definition.namespace) -(procedure_declaration (identifier) @local.definition.function) +(procedure_declaration + (identifier) @local.definition.function) -(struct_declaration (identifier) @local.definition.type "::") +(struct_declaration + (identifier) @local.definition.type + "::") -(enum_declaration (identifier) @local.definition.enum "::") +(enum_declaration + (identifier) @local.definition.enum + "::") -(union_declaration (identifier) @local.definition.type "::") +(union_declaration + (identifier) @local.definition.type + "::") -(variable_declaration (identifier) @local.definition.var ":=") +(variable_declaration + (identifier) @local.definition.var + ":=") -(const_declaration (identifier) @local.definition.constant "::") +(const_declaration + (identifier) @local.definition.constant + "::") -(const_type_declaration (identifier) @local.definition.type ":") +(const_type_declaration + (identifier) @local.definition.type + ":") -(parameter (identifier) @local.definition.parameter ":"?) +(parameter + (identifier) @local.definition.parameter + ":"?) -(default_parameter (identifier) @local.definition.parameter ":=") +(default_parameter + (identifier) @local.definition.parameter + ":=") -(field (identifier) @local.definition.field ":") +(field + (identifier) @local.definition.field + ":") -(label_statement (identifier) @local.definition ":") +(label_statement + (identifier) @local.definition + ":") diff --git a/queries/pascal/folds.scm b/queries/pascal/folds.scm index 6db2857bf..8fcde3ac0 100644 --- a/queries/pascal/folds.scm +++ b/queries/pascal/folds.scm @@ -3,7 +3,6 @@ (implementation) (initialization) (finalization) - (if) (ifElse) (while) @@ -15,7 +14,6 @@ (caseCase) (asm) (with) - (declVar) (declConst) (declEnum) @@ -26,8 +24,8 @@ (defProc) (declField) (declProp) - (comment) ] @fold -(interface (declProc) @fold) +(interface + (declProc) @fold) diff --git a/queries/pascal/highlights.scm b/queries/pascal/highlights.scm index 088465545..f8788a056 100644 --- a/queries/pascal/highlights.scm +++ b/queries/pascal/highlights.scm @@ -1,379 +1,454 @@ ; -- Keywords [ - (kProgram) - (kLibrary) - (kUnit) - - (kBegin) - (kEnd) - (kAsm) - - (kVar) - (kThreadvar) - (kConst) - (kConstref) - (kResourcestring) - (kOut) - (kType) - (kLabel) - (kExports) - - (kProperty) - (kRead) - (kWrite) - (kImplements) - - (kClass) - (kInterface) - (kObject) - (kRecord) - (kObjcclass) - (kObjccategory) - (kObjcprotocol) - (kArray) - (kFile) - (kString) - (kSet) - (kOf) - (kHelper) - - (kInherited) - - (kGeneric) - (kSpecialize) - - (kFunction) - (kProcedure) - (kConstructor) - (kDestructor) - (kOperator) - (kReference) - - (kInterface) - (kImplementation) - (kInitialization) - (kFinalization) - - (kTry) - (kExcept) - (kFinally) - (kRaise) - (kOn) - (kCase) - (kWith) - (kGoto) + (kProgram) + (kLibrary) + (kUnit) + (kBegin) + (kEnd) + (kAsm) + (kVar) + (kThreadvar) + (kConst) + (kConstref) + (kResourcestring) + (kOut) + (kType) + (kLabel) + (kExports) + (kProperty) + (kRead) + (kWrite) + (kImplements) + (kClass) + (kInterface) + (kObject) + (kRecord) + (kObjcclass) + (kObjccategory) + (kObjcprotocol) + (kArray) + (kFile) + (kString) + (kSet) + (kOf) + (kHelper) + (kInherited) + (kGeneric) + (kSpecialize) + (kFunction) + (kProcedure) + (kConstructor) + (kDestructor) + (kOperator) + (kReference) + (kInterface) + (kImplementation) + (kInitialization) + (kFinalization) + (kTry) + (kExcept) + (kFinally) + (kRaise) + (kOn) + (kCase) + (kWith) + (kGoto) ] @keyword [ - (kFor) - (kTo) - (kDownto) - (kDo) - (kWhile) - (kRepeat) - (kUntil) + (kFor) + (kTo) + (kDownto) + (kDo) + (kWhile) + (kRepeat) + (kUntil) ] @keyword.repeat [ - (kIf) - (kThen) - (kElse) + (kIf) + (kThen) + (kElse) ] @keyword.conditional [ - (kPublished) - (kPublic) - (kProtected) - (kPrivate) - - (kStrict) - (kRequired) - (kOptional) + (kPublished) + (kPublic) + (kProtected) + (kPrivate) + (kStrict) + (kRequired) + (kOptional) ] @type.qualifier [ - (kPacked) - - (kAbsolute) + (kPacked) + (kAbsolute) ] @keyword.storage (kUses) @keyword.import ; -- Attributes - [ - (kDefault) - (kIndex) - (kNodefault) - (kStored) - - (kStatic) - (kVirtual) - (kAbstract) - (kSealed) - (kDynamic) - (kOverride) - (kOverload) - (kReintroduce) - (kInline) - - (kForward) - - (kStdcall) - (kCdecl) - (kCppdecl) - (kPascal) - (kRegister) - (kMwpascal) - (kExternal) - (kName) - (kMessage) - (kDeprecated) - (kExperimental) - (kPlatform) - (kUnimplemented) - (kCvar) - (kExport) - (kFar) - (kNear) - (kSafecall) - (kAssembler) - (kNostackframe) - (kInterrupt) - (kNoreturn) - (kIocheck) - (kLocal) - (kHardfloat) - (kSoftfloat) - (kMs_abi_default) - (kMs_abi_cdecl) - (kSaveregisters) - (kSysv_abi_default) - (kSysv_abi_cdecl) - (kVectorcall) - (kVarargs) - (kWinapi) - (kAlias) - (kDelayed) - - (rttiAttributes) - (procAttribute) - + (kDefault) + (kIndex) + (kNodefault) + (kStored) + (kStatic) + (kVirtual) + (kAbstract) + (kSealed) + (kDynamic) + (kOverride) + (kOverload) + (kReintroduce) + (kInline) + (kForward) + (kStdcall) + (kCdecl) + (kCppdecl) + (kPascal) + (kRegister) + (kMwpascal) + (kExternal) + (kName) + (kMessage) + (kDeprecated) + (kExperimental) + (kPlatform) + (kUnimplemented) + (kCvar) + (kExport) + (kFar) + (kNear) + (kSafecall) + (kAssembler) + (kNostackframe) + (kInterrupt) + (kNoreturn) + (kIocheck) + (kLocal) + (kHardfloat) + (kSoftfloat) + (kMs_abi_default) + (kMs_abi_cdecl) + (kSaveregisters) + (kSysv_abi_default) + (kSysv_abi_cdecl) + (kVectorcall) + (kVarargs) + (kWinapi) + (kAlias) + (kDelayed) + (rttiAttributes) + (procAttribute) ] @attribute -(procAttribute (kPublic) @attribute) +(procAttribute + (kPublic) @attribute) ; -- Punctuation & operators - [ - "(" - ")" - "[" - "]" + "(" + ")" + "[" + "]" ] @punctuation.bracket [ - ";" - "," - ":" - (kEndDot) + ";" + "," + ":" + (kEndDot) ] @punctuation.delimiter -[ - ".." -] @punctuation.special +".." @punctuation.special [ - (kDot) - (kAdd) - (kSub) - (kMul) - (kFdiv) - (kAssign) - (kAssignAdd) - (kAssignSub) - (kAssignMul) - (kAssignDiv) - (kEq) - (kLt) - (kLte) - (kGt) - (kGte) - (kNeq) - (kAt) - (kHat) + (kDot) + (kAdd) + (kSub) + (kMul) + (kFdiv) + (kAssign) + (kAssignAdd) + (kAssignSub) + (kAssignMul) + (kAssignDiv) + (kEq) + (kLt) + (kLte) + (kGt) + (kGte) + (kNeq) + (kAt) + (kHat) ] @operator [ - (kOr) - (kXor) - (kDiv) - (kMod) - (kAnd) - (kShl) - (kShr) - (kNot) - (kIs) - (kAs) - (kIn) + (kOr) + (kXor) + (kDiv) + (kMod) + (kAnd) + (kShl) + (kShr) + (kNot) + (kIs) + (kAs) + (kIn) ] @keyword.operator ; -- Builtin constants - [ - (kTrue) - (kFalse) + (kTrue) + (kFalse) ] @boolean -[ - (kNil) -] @constant.builtin +(kNil) @constant.builtin ; -- Literals +(literalNumber) @number -(literalNumber) @number -(literalString) @string +(literalString) @string ; -- Variables +(exprBinary + (identifier) @variable) -(exprBinary (identifier) @variable) -(exprUnary (identifier) @variable) -(assignment (identifier) @variable) -(exprBrackets (identifier) @variable) -(exprParens (identifier) @variable) -(exprDot (identifier) @variable) -(exprTpl (identifier) @variable) -(exprArgs (identifier) @variable) -(defaultValue (identifier) @variable) +(exprUnary + (identifier) @variable) -; -- Comments +(assignment + (identifier) @variable) + +(exprBrackets + (identifier) @variable) + +(exprParens + (identifier) @variable) + +(exprDot + (identifier) @variable) +(exprTpl + (identifier) @variable) + +(exprArgs + (identifier) @variable) + +(defaultValue + (identifier) @variable) + +; -- Comments (comment) @comment @spell ((comment) @comment.documentation (#lua-match? @comment.documentation "^///[^/]")) + ((comment) @comment.documentation (#lua-match? @comment.documentation "^///$")) ((comment) @comment.documentation - . [(unit) (declProc)]) + . + [ + (unit) + (declProc) + ]) (declTypes (comment) @comment.documentation - . (declType)) + . + (declType)) (declSection (comment) @comment.documentation - . [(declField) (declProc)]) + . + [ + (declField) + (declProc) + ]) (declEnum (comment) @comment.documentation - . (declEnumValue)) + . + (declEnumValue)) (declConsts (comment) @comment.documentation - . (declConst)) + . + (declConst)) (declVars (comment) @comment.documentation - . (declVar)) + . + (declVar)) -(pp) @keyword.directive +(pp) @keyword.directive ; -- Type declaration +(declType + name: (identifier) @type) -(declType name: (identifier) @type) -(declType name: (genericTpl entity: (identifier) @type)) +(declType + name: + (genericTpl + entity: (identifier) @type)) ; -- Procedure & function declarations - ; foobar -(declProc name: (identifier) @function) +(declProc + name: (identifier) @function) + ; foobar<t> -(declProc name: (genericTpl entity: (identifier) @function)) +(declProc + name: + (genericTpl + entity: (identifier) @function)) + ; foo.bar -(declProc name: (genericDot rhs: (identifier) @function)) +(declProc + name: + (genericDot + rhs: (identifier) @function)) + ; foo.bar<t> -(declProc name: (genericDot rhs: (genericTpl entity: (identifier) @function))) +(declProc + name: + (genericDot + rhs: + (genericTpl + entity: (identifier) @function))) ; Treat property declarations like functions +(declProp + name: (identifier) @function) -(declProp name: (identifier) @function) -(declProp getter: (identifier) @property) -(declProp setter: (identifier) @property) +(declProp + getter: (identifier) @property) -; -- Function parameters +(declProp + setter: (identifier) @property) -(declArg name: (identifier) @variable.parameter) +; -- Function parameters +(declArg + name: (identifier) @variable.parameter) ; -- Template parameters +(genericArg + name: (identifier) @variable.parameter) -(genericArg name: (identifier) @variable.parameter) -(genericArg type: (typeref) @type) +(genericArg + type: (typeref) @type) -(declProc name: (genericDot lhs: (identifier) @type)) -(declType (genericDot (identifier) @type)) +(declProc + name: + (genericDot + lhs: (identifier) @type)) -(genericDot (genericTpl (identifier) @type)) -(genericDot (genericDot (identifier) @type)) +(declType + (genericDot + (identifier) @type)) -(genericTpl entity: (identifier) @type) -(genericTpl entity: (genericDot (identifier) @type)) +(genericDot + (genericTpl + (identifier) @type)) -; -- Exception parameters +(genericDot + (genericDot + (identifier) @type)) -(exceptionHandler variable: (identifier) @variable.parameter) +(genericTpl + entity: (identifier) @type) -; -- Type usage +(genericTpl + entity: + (genericDot + (identifier) @type)) + +; -- Exception parameters +(exceptionHandler + variable: (identifier) @variable.parameter) +; -- Type usage (typeref) @type ; -- Constant usage - [ - (caseLabel) - (label) + (caseLabel) + (label) ] @constant -(procAttribute (identifier) @constant) -(procExternal (identifier) @constant) +(procAttribute + (identifier) @constant) + +(procExternal + (identifier) @constant) ; -- Variable & constant declarations ; (This is only questionable because we cannot detect types of identifiers ; declared in other units, so the results will be inconsistent) +(declVar + name: (identifier) @variable) -(declVar name: (identifier) @variable) -(declConst name: (identifier) @constant) -(declEnumValue name: (identifier) @constant) +(declConst + name: (identifier) @constant) + +(declEnumValue + name: (identifier) @constant) ; -- Fields +(exprDot + rhs: (identifier) @property) -(exprDot rhs: (identifier) @property) -(exprDot rhs: (exprDot) @property) -(declClass (declField name:(identifier) @property)) -(declSection (declField name:(identifier) @property)) -(declSection (declVars (declVar name:(identifier) @property))) +(exprDot + rhs: (exprDot) @property) -(recInitializerField name:(identifier) @property) +(declClass + (declField + name: (identifier) @property)) +(declSection + (declField + name: (identifier) @property)) -;;; ---------------------------------------------- ;;; -;;; EVERYTHING BELOW THIS IS OF QUESTIONABLE VALUE ;;; -;;; ---------------------------------------------- ;;; +(declSection + (declVars + (declVar + name: (identifier) @property))) +(recInitializerField + name: (identifier) @property) +; ---------------------------------------------- ;;; +; EVERYTHING BELOW THIS IS OF QUESTIONABLE VALUE ;;; +; ---------------------------------------------- ;;; ; -- Procedure name in calls with parentheses ; (Pascal doesn't require parentheses for procedure calls, so this will not ; detect all calls) - ; foobar -(exprCall entity: (identifier) @function) +(exprCall + entity: (identifier) @function) + ; foobar<t> -(exprCall entity: (exprTpl entity: (identifier) @function)) +(exprCall + entity: + (exprTpl + entity: (identifier) @function)) + ; foo.bar -(exprCall entity: (exprDot rhs: (identifier) @function)) +(exprCall + entity: + (exprDot + rhs: (identifier) @function)) + ; foo.bar<t> -(exprCall entity: (exprDot rhs: (exprTpl entity: (identifier) @function))) +(exprCall + entity: + (exprDot + rhs: + (exprTpl + entity: (identifier) @function))) (inherited) @function @@ -381,44 +456,85 @@ ; (If a statement consists only of an identifier, assume it's a procedure) ; (This will still not match all procedure calls, and also may produce false ; positives in rare cases, but only for nonsensical code) +(statement + (identifier) @function) + +(statement + (exprDot + rhs: (identifier) @function)) -(statement (identifier) @function) -(statement (exprDot rhs: (identifier) @function)) -(statement (exprTpl entity: (identifier) @function)) -(statement (exprDot rhs: (exprTpl entity: (identifier) @function))) +(statement + (exprTpl + entity: (identifier) @function)) + +(statement + (exprDot + rhs: + (exprTpl + entity: (identifier) @function))) ; -- Break, Continue & Exit ; (Not ideal: ideally, there would be a way to check if these special ; identifiers are shadowed by a local variable) -(statement ((identifier) @keyword.return - (#lua-match? @keyword.return "^[eE][xX][iI][tT]$"))) -(statement (exprCall entity: ((identifier) @keyword.return - (#lua-match? @keyword.return "^[eE][xX][iI][tT]$")))) -(statement ((identifier) @keyword.repeat - (#lua-match? @keyword.repeat "^[bB][rR][eE][aA][kK]$"))) -(statement ((identifier) @keyword.repeat - (#lua-match? @keyword.repeat "^[cC][oO][nN][tT][iI][nN][uU][eE]$"))) +(statement + ((identifier) @keyword.return + (#lua-match? @keyword.return "^[eE][xX][iI][tT]$"))) -; -- Identifier type inference +(statement + (exprCall + entity: + ((identifier) @keyword.return + (#lua-match? @keyword.return "^[eE][xX][iI][tT]$")))) +(statement + ((identifier) @keyword.repeat + (#lua-match? @keyword.repeat "^[bB][rR][eE][aA][kK]$"))) + +(statement + ((identifier) @keyword.repeat + (#lua-match? @keyword.repeat "^[cC][oO][nN][tT][iI][nN][uU][eE]$"))) + +; -- Identifier type inference ; VERY QUESTIONABLE: Highlighting of identifiers based on spelling -(exprBinary ((identifier) @constant - (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) -(exprUnary ((identifier) @constant - (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) -(assignment rhs: ((identifier) @constant - (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) -(exprBrackets ((identifier) @constant - (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) -(exprParens ((identifier) @constant - (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) -(exprDot rhs: ((identifier) @constant - (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) -(exprTpl args: ((identifier) @constant - (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) -(exprArgs ((identifier) @constant - (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) -(declEnumValue ((identifier) @constant - (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) -(defaultValue ((identifier) @constant - (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) +(exprBinary + ((identifier) @constant + (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) + +(exprUnary + ((identifier) @constant + (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) + +(assignment + rhs: + ((identifier) @constant + (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) + +(exprBrackets + ((identifier) @constant + (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) + +(exprParens + ((identifier) @constant + (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) + +(exprDot + rhs: + ((identifier) @constant + (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) + +(exprTpl + args: + ((identifier) @constant + (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) + +(exprArgs + ((identifier) @constant + (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) + +(declEnumValue + ((identifier) @constant + (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) + +(defaultValue + ((identifier) @constant + (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) diff --git a/queries/pascal/indents.scm b/queries/pascal/indents.scm index bbeea0089..879e7b86f 100644 --- a/queries/pascal/indents.scm +++ b/queries/pascal/indents.scm @@ -1,32 +1,33 @@ [ - (statement) - (declVars) - (declConsts) - (declTypes) - (declProc) - (declArgs) - (declUses) - (declClass) - (exprArgs) - (exprSubscript) - (exprBrackets) - (exprParens) - (recInitializer) - (arrInitializer) - (defaultValue) + (statement) + (declVars) + (declConsts) + (declTypes) + (declProc) + (declArgs) + (declUses) + (declClass) + (exprArgs) + (exprSubscript) + (exprBrackets) + (exprParens) + (recInitializer) + (arrInitializer) + (defaultValue) ] @indent.begin -(defProc (block) @indent.begin) +(defProc + (block) @indent.begin) [ - (kEnd) - (kFinally) - (kDo) - (kUntil) - (kExcept) - (kElse) - (kThen) - (declSection) - "]" - ")" + (kEnd) + (kFinally) + (kDo) + (kUntil) + (kExcept) + (kElse) + (kThen) + (declSection) + "]" + ")" ] @indent.branch diff --git a/queries/pascal/injections.scm b/queries/pascal/injections.scm index 9832973b6..31d9d4cea 100644 --- a/queries/pascal/injections.scm +++ b/queries/pascal/injections.scm @@ -1,6 +1,5 @@ ((comment) @injection.content - (#set! injection.language "comment")) - + (#set! injection.language "comment")) ; There is no parser for assembly language yet. Add an injection here when we ; have a parser. ; ((asmBody) @injection.content diff --git a/queries/pascal/locals.scm b/queries/pascal/locals.scm index 7147a1086..bb12cb2d2 100644 --- a/queries/pascal/locals.scm +++ b/queries/pascal/locals.scm @@ -1,25 +1,55 @@ +(root) @local.scope -(root) @local.scope +(defProc) @local.scope -(defProc) @local.scope -(lambda) @local.scope -(interface (declProc) @local.scope) -(declSection (declProc) @local.scope) -(declClass (declProc) @local.scope) -(declHelper (declProc) @local.scope) -(declProcRef) @local.scope +(lambda) @local.scope -(exceptionHandler) @local.scope -(exceptionHandler variable: (identifier) @local.definition) +(interface + (declProc) @local.scope) -(declArg name: (identifier) @local.definition) -(declVar name: (identifier) @local.definition) -(declConst name: (identifier) @local.definition) -(declLabel name: (identifier) @local.definition) -(genericArg name: (identifier) @local.definition) -(declEnumValue name: (identifier) @local.definition) -(declType name: (identifier) @local.definition) -(declType name: (genericTpl entity: (identifier) @local.definition)) +(declSection + (declProc) @local.scope) -(declProc name: (identifier) @local.definition) -(identifier) @local.reference +(declClass + (declProc) @local.scope) + +(declHelper + (declProc) @local.scope) + +(declProcRef) @local.scope + +(exceptionHandler) @local.scope + +(exceptionHandler + variable: (identifier) @local.definition) + +(declArg + name: (identifier) @local.definition) + +(declVar + name: (identifier) @local.definition) + +(declConst + name: (identifier) @local.definition) + +(declLabel + name: (identifier) @local.definition) + +(genericArg + name: (identifier) @local.definition) + +(declEnumValue + name: (identifier) @local.definition) + +(declType + name: (identifier) @local.definition) + +(declType + name: + (genericTpl + entity: (identifier) @local.definition)) + +(declProc + name: (identifier) @local.definition) + +(identifier) @local.reference diff --git a/queries/pem/highlights.scm b/queries/pem/highlights.scm index f5d0d70f0..b8dbb0f11 100644 --- a/queries/pem/highlights.scm +++ b/queries/pem/highlights.scm @@ -1,4 +1,7 @@ -["BEGIN" "END"] @keyword +[ + "BEGIN" + "END" +] @keyword (dashes) @punctuation.delimiter diff --git a/queries/pem/injections.scm b/queries/pem/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/pem/injections.scm +++ b/queries/pem/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/perl/folds.scm b/queries/perl/folds.scm index df23f6317..21950324d 100644 --- a/queries/perl/folds.scm +++ b/queries/perl/folds.scm @@ -1,19 +1,25 @@ (comment)+ @fold + (pod) @fold ; fold the block-typed package statements only -(package_statement (block)) @fold +(package_statement + (block)) @fold -[(subroutine_declaration_statement) - (conditional_statement) - (loop_statement) - (for_statement) - (cstyle_for_statement) - (block_statement) - (phaser_statement)] @fold +[ + (subroutine_declaration_statement) + (conditional_statement) + (loop_statement) + (for_statement) + (cstyle_for_statement) + (block_statement) + (phaser_statement) +] @fold (anonymous_subroutine_expression) @fold ; perhaps folks want to fold these too? -[(anonymous_array_expression) - (anonymous_hash_expression)] @fold +[ + (anonymous_array_expression) + (anonymous_hash_expression) +] @fold diff --git a/queries/perl/highlights.scm b/queries/perl/highlights.scm index 7a0c4e530..a6405c948 100644 --- a/queries/perl/highlights.scm +++ b/queries/perl/highlights.scm @@ -1,43 +1,84 @@ -((source_file . (comment) @keyword.directive) +((source_file + . + (comment) @keyword.directive) (#lua-match? @keyword.directive "^#!/")) -[ "use" "no" "require" ] @keyword.import +[ + "use" + "no" + "require" +] @keyword.import -[ "if" "elsif" "unless" "else" ] @keyword.conditional +[ + "if" + "elsif" + "unless" + "else" +] @keyword.conditional -(conditional_expression [ "?" ":" ] @keyword.conditional.ternary) +(conditional_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) -[ "while" "until" "for" "foreach" ] @keyword.repeat +[ + "while" + "until" + "for" + "foreach" +] @keyword.repeat "return" @keyword.return "sub" @keyword.function -[ "map" "grep" "sort" ] @function.builtin +[ + "map" + "grep" + "sort" +] @function.builtin "package" @keyword.import [ "do" - "my" "our" "local" "state" - "last" "next" "redo" "goto" + "my" + "our" + "local" + "state" + "last" + "next" + "redo" + "goto" "undef" ] @keyword -(_ operator: _ @operator) +(_ + operator: _ @operator) + "\\" @operator (yadayada) @keyword.exception -(phaser_statement phase: _ @keyword.phaser) +(phaser_statement + phase: _ @keyword.phaser) [ - "or" "and" - "eq" "ne" "cmp" "lt" "le" "ge" "gt" + "or" + "and" + "eq" + "ne" + "cmp" + "lt" + "le" + "ge" + "gt" "isa" ] @keyword.operator (eof_marker) @keyword.directive + (data_section) @comment (pod) @none @@ -48,10 +89,10 @@ ] @number [ - (string_literal) - (interpolated_string_literal) - (quoted_word_list) - (command_string) + (string_literal) + (interpolated_string_literal) + (quoted_word_list) + (command_string) (heredoc_content) (replacement) (transliteration_content) @@ -63,54 +104,69 @@ (heredoc_end) ] @label -[(escape_sequence) (escaped_delimiter)] @string.escape +[ + (escape_sequence) + (escaped_delimiter) +] @string.escape -(_ modifiers: _ @character.special) -[ - (quoted_regexp) - (match_regexp) - (regexp_content) +(_ + modifiers: _ @character.special) + +[ + (quoted_regexp) + (match_regexp) + (regexp_content) ] @string.regexp (autoquoted_bareword) @string.special -(use_statement (package) @type) -(package_statement (package) @type) -(require_expression (bareword) @type) +(use_statement + (package) @type) + +(package_statement + (package) @type) + +(require_expression + (bareword) @type) + +(subroutine_declaration_statement + name: (bareword) @function) -(subroutine_declaration_statement name: (bareword) @function) (attribute_name) @attribute + (attribute_value) @string (label) @label -(statement_label label: _ @label) +(statement_label + label: _ @label) + +(relational_expression + operator: "isa" + right: (bareword) @type) + +(function_call_expression + (function) @function.call) -(relational_expression operator: "isa" right: (bareword) @type) +(method_call_expression + (method) @function.method.call) -(function_call_expression (function) @function.call) -(method_call_expression (method) @function.method.call) -(method_call_expression invocant: (bareword) @type) +(method_call_expression + invocant: (bareword) @type) -(func0op_call_expression function: _ @function.builtin) -(func1op_call_expression function: _ @function.builtin) +(func0op_call_expression + function: _ @function.builtin) + +(func1op_call_expression + function: _ @function.builtin) ; this was a regex for the CLI -([(function)(expression_statement (bareword))] @function.builtin - (#any-of? @function.builtin - "accept" "atan2" "bind" "binmode" "bless" "crypt" "chmod" "chown" "connect" - "die" "dbmopen" "exec" "fcntl" "flock" "formline" "getpriority" - "getprotobynumber" "gethostbyaddr" "getnetbyaddr" "getservbyname" - "getservbyport" "getsockopt" "glob" "index" "ioctl" "join" "kill" "link" - "listen" "mkdir" "msgctl" "msgget" "msgrcv" "msgsend" "open" "opendir" - "print" "printf" "push" "pack" "pipe" "return" "rename" "rindex" "read" - "recv" "reverse" "say" "select" "seek" "semctl" "semget" "semop" "send" - "setpgrp" "setpriority" "seekdir" "setsockopt" "shmctl" "shmread" "shmwrite" - "shutdown" "socket" "socketpair" "split" "sprintf" "splice" "substr" "system" - "symlink" "syscall" "sysopen" "sysseek" "sysread" "syswrite" "tie" "truncate" - "unlink" "unpack" "utime" "unshift" "vec" "warn" - "waitpid" -)) +([ + (function) + (expression_statement + (bareword)) +] @function.builtin + (#any-of? @function.builtin "accept" "atan2" "bind" "binmode" "bless" "crypt" "chmod" "chown" "connect" "die" "dbmopen" "exec" "fcntl" "flock" "formline" "getpriority" "getprotobynumber" "gethostbyaddr" "getnetbyaddr" "getservbyname" "getservbyport" "getsockopt" "glob" "index" "ioctl" "join" "kill" "link" "listen" "mkdir" "msgctl" "msgget" "msgrcv" "msgsend" "open" "opendir" "print" "printf" "push" "pack" "pipe" "return" "rename" "rindex" "read" "recv" "reverse" "say" "select" "seek" "semctl" "semget" "semop" "send" "setpgrp" "setpriority" "seekdir" "setsockopt" "shmctl" "shmread" "shmwrite" "shutdown" "socket" "socketpair" "split" "sprintf" "splice" "substr" "system" "symlink" "syscall" "sysopen" "sysseek" "sysread" "syswrite" "tie" "truncate" "unlink" "unpack" "utime" "unshift" "vec" "warn" "waitpid")) (function) @function @@ -119,42 +175,86 @@ (varname) "}" @punctuation.special) -(varname +(varname (block - "{" @punctuation.special + "{" @punctuation.special "}" @punctuation.special)) - -([(varname) (filehandle)] @variable.builtin +([ + (varname) + (filehandle) +] @variable.builtin (#any-of? @variable.builtin "ENV" "ARGV" "INC" "ARGVOUT" "SIG" "STDIN" "STDOUT" "STDERR" "a" "b" "_")) + ((varname) @variable.builtin ; highlights all the reserved ^ vars like ${^THINGS} (#lua-match? @variable.builtin "%^")) + ((varname) @variable.builtin ; highlights punc vars and also numeric only like $11 (#lua-match? @variable.builtin "^%A+$")) - (scalar) @variable.scalar -(scalar_deref_expression [ "$" "*"] @variable.scalar) -[(array) (arraylen)] @variable.array -(array_deref_expression [ "@" "*"] @variable.array) + +(scalar_deref_expression + [ + "$" + "*" + ] @variable.scalar) + +[ + (array) + (arraylen) +] @variable.array + +(array_deref_expression + [ + "@" + "*" + ] @variable.array) + (hash) @variable.hash -(hash_deref_expression [ "%" "*"] @variable.hash) -(array_element_expression array:(_) @variable.array) -(slice_expression array:(_) @variable.array) -(keyval_expression array:(_) @variable.array) +(hash_deref_expression + [ + "%" + "*" + ] @variable.hash) + +(array_element_expression + array: (_) @variable.array) + +(slice_expression + array: (_) @variable.array) + +(keyval_expression + array: (_) @variable.array) + +(hash_element_expression + hash: (_) @variable.hash) + +(slice_expression + hash: (_) @variable.hash) -(hash_element_expression hash:(_) @variable.hash) -(slice_expression hash:(_) @variable.hash) -(keyval_expression hash:(_) @variable.hash) +(keyval_expression + hash: (_) @variable.hash) (comment) @comment -([ "=>" "," ";" "->" ] @punctuation.delimiter) +([ + "=>" + "," + ";" + "->" +] @punctuation.delimiter) -( - [ "[" "]" "{" "}" "(" ")" ] @punctuation.bracket +([ + "[" + "]" + "{" + "}" + "(" + ")" +] @punctuation.bracket ; priority hack so nvim + ts-cli behave the same (#set! "priority" 90)) diff --git a/queries/perl/injections.scm b/queries/perl/injections.scm index ba5e45f45..48e6363b9 100644 --- a/queries/perl/injections.scm +++ b/queries/perl/injections.scm @@ -1,14 +1,14 @@ ; an injections.scm file for nvim-treesitter ((comment) @injection.content - (#set! injection.language "comment")) - + (#set! injection.language "comment")) + ((pod) @injection.content - (#set! injection.language "pod")) + (#set! injection.language "pod")) ((substitution_regexp (replacement) @injection.content (substitution_regexp_modifiers) @_modifiers) - ; match if there's a single `e` in the modifiers list + ; match if there's a single `e` in the modifiers list (#lua-match? @_modifiers "e") (#not-lua-match? @_modifiers "e.*e") (#set! injection.language "perl")) diff --git a/queries/php/highlights.scm b/queries/php/highlights.scm index aa3be62b9..cbc7e1839 100644 --- a/queries/php/highlights.scm +++ b/queries/php/highlights.scm @@ -1,68 +1,110 @@ ; Variables - (variable_name) @variable ; Constants - ((name) @constant - (#lua-match? @constant "^_?[A-Z][A-Z%d_]*$")) + (#lua-match? @constant "^_?[A-Z][A-Z%d_]*$")) + ((name) @constant.builtin - (#lua-match? @constant.builtin "^__[A-Z][A-Z%d_]+__$")) + (#lua-match? @constant.builtin "^__[A-Z][A-Z%d_]+__$")) -(const_declaration (const_element (name) @constant)) +(const_declaration + (const_element + (name) @constant)) ; Types - [ - (primitive_type) - (cast_type) - (bottom_type) - ] @type.builtin + (primitive_type) + (cast_type) + (bottom_type) +] @type.builtin + (named_type - [(name) @type - (qualified_name (name) @type)]) + [ + (name) @type + (qualified_name + (name) @type) + ]) + (class_declaration name: (name) @type) + (base_clause - [(name) @type - (qualified_name (name) @type)]) + [ + (name) @type + (qualified_name + (name) @type) + ]) + (enum_declaration name: (name) @type) + (interface_declaration name: (name) @type) + (namespace_use_clause - [(name) @type - (qualified_name (name) @type)]) -(namespace_aliasing_clause (name) @type.definition) + [ + (name) @type + (qualified_name + (name) @type) + ]) + +(namespace_aliasing_clause + (name) @type.definition) + (class_interface_clause - [(name) @type - (qualified_name (name) @type)]) + [ + (name) @type + (qualified_name + (name) @type) + ]) + (scoped_call_expression - scope: [(name) @type - (qualified_name (name) @type)]) + scope: + [ + (name) @type + (qualified_name + (name) @type) + ]) + (class_constant_access_expression - . [(name) @type - (qualified_name (name) @type)] + . + [ + (name) @type + (qualified_name + (name) @type) + ] (name) @constant) + (trait_declaration name: (name) @type) + (use_declaration - (name) @type) + (name) @type) + (binary_expression operator: "instanceof" - right: [(name) @type - (qualified_name (name) @type)]) + right: + [ + (name) @type + (qualified_name + (name) @type) + ]) ; Functions, methods, constructors +(array_creation_expression + "array" @function.builtin) -(array_creation_expression "array" @function.builtin) -(list_literal "list" @function.builtin) +(list_literal + "list" @function.builtin) (method_declaration name: (name) @function.method) (function_call_expression - function: (qualified_name (name) @function.call)) + function: + (qualified_name + (name) @function.call)) (function_call_expression (name) @function.call) @@ -77,14 +119,18 @@ name: (name) @function) (nullsafe_member_call_expression - name: (name) @function.method) + name: (name) @function.method) (method_declaration - name: (name) @constructor - (#eq? @constructor "__construct")) + name: (name) @constructor + (#eq? @constructor "__construct")) + (object_creation_expression - [(name) @constructor - (qualified_name (name) @constructor)]) + [ + (name) @constructor + (qualified_name + (name) @constructor) + ]) ; Parameters [ @@ -93,31 +139,35 @@ ] @variable.parameter (argument - (name) @variable.parameter) + (name) @variable.parameter) ; Member - (property_element (variable_name) @property) (member_access_expression - name: (variable_name (name)) @property) + name: + (variable_name + (name)) @property) (member_access_expression name: (name) @property) ; Variables - (relative_scope) @variable.builtin ((variable_name) @variable.builtin - (#eq? @variable.builtin "$this")) + (#eq? @variable.builtin "$this")) ; Namespace (namespace_definition - name: (namespace_name (name) @module)) + name: + (namespace_name + (name) @module)) + (namespace_name_as_prefix - (namespace_name (name) @module)) + (namespace_name + (name) @module)) ; Attributes (attribute_list) @attribute @@ -126,78 +176,88 @@ (conditional_expression) @keyword.conditional ; Directives -(declare_directive ["strict_types" "ticks" "encoding"] @variable.parameter) +(declare_directive + [ + "strict_types" + "ticks" + "encoding" + ] @variable.parameter) ; Basic tokens - [ - (string) - (encapsed_string) - (heredoc_body) - (nowdoc_body) - (shell_command_expression) ; backtick operator: `ls -la` - ] @string + (string) + (encapsed_string) + (heredoc_body) + (nowdoc_body) + (shell_command_expression) ; backtick operator: `ls -la` +] @string + (escape_sequence) @string.escape [ - (heredoc_start) - (heredoc_end) + (heredoc_start) + (heredoc_end) ] @label -(nowdoc "'" @label) +(nowdoc + "'" @label) (boolean) @boolean + (null) @constant.builtin + (integer) @number + (float) @number.float + (comment) @comment @spell (named_label_statement) @label -; Keywords +; Keywords [ - "and" - "as" - "instanceof" - "or" - "xor" + "and" + "as" + "instanceof" + "or" + "xor" ] @keyword.operator [ - "fn" - "function" + "fn" + "function" ] @keyword.function [ - "break" - "class" - "clone" - "declare" - "default" - "echo" - "enddeclare" - "enum" - "extends" - "global" - "goto" - "implements" - "insteadof" - "interface" - "namespace" - "new" - "trait" - "unset" - ] @keyword + "break" + "class" + "clone" + "declare" + "default" + "echo" + "enddeclare" + "enum" + "extends" + "global" + "goto" + "implements" + "insteadof" + "interface" + "namespace" + "new" + "trait" + "unset" +] @keyword [ - "abstract" - "const" - "final" - "private" - "protected" - "public" - "readonly" - "static" + "abstract" + "const" + "final" + "private" + "protected" + "public" + "readonly" + "static" ] @type.qualifier [ @@ -206,65 +266,64 @@ ] @keyword.return [ - "case" - "else" - "elseif" - "endif" - "endswitch" - "if" - "switch" - "match" + "case" + "else" + "elseif" + "endif" + "endswitch" + "if" + "switch" + "match" "??" - ] @keyword.conditional +] @keyword.conditional [ - "continue" - "do" - "endfor" - "endforeach" - "endwhile" - "for" - "foreach" - "while" - ] @keyword.repeat + "continue" + "do" + "endfor" + "endforeach" + "endwhile" + "for" + "foreach" + "while" +] @keyword.repeat [ - "catch" - "finally" - "throw" - "try" - ] @keyword.exception + "catch" + "finally" + "throw" + "try" +] @keyword.exception [ - "include_once" - "include" - "require_once" - "require" - "use" - ] @keyword.import + "include_once" + "include" + "require_once" + "require" + "use" +] @keyword.import [ - "," - ";" - ":" - "\\" - ] @punctuation.delimiter + "," + ";" + ":" + "\\" +] @punctuation.delimiter [ - (php_tag) - "?>" - "(" - ")" - "[" - "]" - "{" - "}" - "#[" - ] @punctuation.bracket + (php_tag) + "?>" + "(" + ")" + "[" + "]" + "{" + "}" + "#[" +] @punctuation.bracket [ "=" - "." "-" "*" @@ -272,7 +331,6 @@ "+" "%" "**" - "~" "|" "^" @@ -280,12 +338,9 @@ "<<" ">>" "<<<" - "->" "?->" - "=>" - "<" "<=" ">=" @@ -295,11 +350,9 @@ "!=" "===" "!==" - "!" "&&" "||" - ".=" "-=" "+=" @@ -315,7 +368,6 @@ "??=" "--" "++" - "@" "::" ] @operator diff --git a/queries/php/indents.scm b/queries/php/indents.scm index 53e78c341..a81faed62 100644 --- a/queries/php/indents.scm +++ b/queries/php/indents.scm @@ -18,19 +18,21 @@ "]" ] @indent.branch -[ - (comment) -] @indent.auto +(comment) @indent.auto -(compound_statement "}" @indent.end) +(compound_statement + "}" @indent.end) (ERROR "(" @indent.align - . (_) + . + (_) (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")")) + (ERROR "[" @indent.align - . (_) + . + (_) (#set! indent.open_delimiter "[") (#set! indent.close_delimiter "]")) diff --git a/queries/php/injections.scm b/queries/php/injections.scm index 0e78d45e5..0c9d25ce6 100644 --- a/queries/php/injections.scm +++ b/queries/php/injections.scm @@ -8,39 +8,40 @@ ((heredoc (heredoc_body) @injection.content (heredoc_end) @injection.language - (#set! injection.include-children) - (#downcase! @injection.language))) + (#set! injection.include-children) + (#downcase! @injection.language))) ((nowdoc (nowdoc_body) @injection.content (heredoc_end) @injection.language - (#set! injection.include-children) - (#downcase! @injection.language))) - -;; regex + (#set! injection.include-children) + (#downcase! @injection.language))) +; regex ((function_call_expression function: (_) @_preg_func_identifier - arguments: - (arguments . - (argument - (_ (string_value) @injection.content)))) - (#set! injection.language "regex") - (#lua-match? @_preg_func_identifier "^preg_")) - -;; bash + arguments: + (arguments + . + (argument + (_ + (string_value) @injection.content)))) + (#set! injection.language "regex") + (#lua-match? @_preg_func_identifier "^preg_")) +; bash ((function_call_expression function: (_) @_shell_func_identifier - arguments: - (arguments . - (argument - (_ (string_value) @injection.content)))) + arguments: + (arguments + . + (argument + (_ + (string_value) @injection.content)))) (#set! injection.language "bash") - (#any-of? @_shell_func_identifier "shell_exec" "escapeshellarg" - "escapeshellcmd" "exec" "passthru" "proc_open" "shell_exec" "system")) + (#any-of? @_shell_func_identifier "shell_exec" "escapeshellarg" "escapeshellcmd" "exec" "passthru" "proc_open" "shell_exec" "system")) -(expression_statement - (shell_command_expression +(expression_statement + (shell_command_expression (string_value) @injection.content) - (#set! injection.language "bash")) + (#set! injection.language "bash")) diff --git a/queries/php/locals.scm b/queries/php/locals.scm index c1403e40b..8d509b37c 100644 --- a/queries/php/locals.scm +++ b/queries/php/locals.scm @@ -1,17 +1,16 @@ ; Scopes ;------- - ((class_declaration name: (name) @local.definition.type) @local.scope - (#set! definition.type.scope "parent")) + (#set! definition.type.scope "parent")) ((method_declaration name: (name) @local.definition.method) @local.scope - (#set! definition.method.scope "parent")) + (#set! definition.method.scope "parent")) ((function_definition name: (name) @local.definition.function) @local.scope - (#set! definition.function.scope "parent")) + (#set! definition.function.scope "parent")) (anonymous_function_creation_expression (anonymous_function_use_clause @@ -20,7 +19,6 @@ ; Definitions ;------------ - (simple_parameter (variable_name (name) @local.definition.var)) @@ -33,7 +31,7 @@ (foreach_statement (variable_name (name) @local.reference - (#set! reference.kind "var")) + (#set! reference.kind "var")) (variable_name (name) @local.definition.var)) @@ -48,40 +46,41 @@ ; References ;------------ - (named_type (name) @local.reference - (#set! reference.kind "type")) + (#set! reference.kind "type")) (named_type (qualified_name) @local.reference - (#set! reference.kind "type")) + (#set! reference.kind "type")) (variable_name (name) @local.reference - (#set! reference.kind "var")) + (#set! reference.kind "var")) (member_access_expression name: (name) @local.reference - (#set! reference.kind "field")) + (#set! reference.kind "field")) (member_call_expression name: (name) @local.reference - (#set! reference.kind "method")) + (#set! reference.kind "method")) (function_call_expression - function: (qualified_name - (name) @local.reference + function: + (qualified_name + (name) @local.reference (#set! reference.kind "function"))) (object_creation_expression (qualified_name (name) @local.reference - (#set! reference.kind "type"))) + (#set! reference.kind "type"))) (scoped_call_expression - scope: (qualified_name - (name) @local.reference + scope: + (qualified_name + (name) @local.reference (#set! reference.kind "type")) name: (name) @local.reference - (#set! reference.kind "method")) + (#set! reference.kind "method")) diff --git a/queries/phpdoc/highlights.scm b/queries/phpdoc/highlights.scm index a30409314..076a7d528 100644 --- a/queries/phpdoc/highlights.scm +++ b/queries/phpdoc/highlights.scm @@ -1,22 +1,28 @@ (tag_name) @attribute @nospell + (tag - (tag_name) @_tag (#eq? @_tag "@param") - (variable_name) @variable.parameter -) + (tag_name) @_tag + (#eq? @_tag "@param") + (variable_name) @variable.parameter) + (tag - (tag_name) @_tag (#eq? @_tag "@property") - (variable_name) @property -) + (tag_name) @_tag + (#eq? @_tag "@property") + (variable_name) @property) + (tag - (tag_name) @_tag (#eq? @_tag "@var") - (variable_name) @variable -) + (tag_name) @_tag + (#eq? @_tag "@var") + (variable_name) @variable) + (tag - (tag_name) @_tag (#eq? @_tag "@function.method") - (name) @function.method -) + (tag_name) @_tag + (#eq? @_tag "@function.method") + (name) @function.method) + (parameter (variable_name) @variable.parameter) + (type_list [ (array_type) @@ -24,24 +30,36 @@ (named_type) (optional_type) ] @type) + (type_list) @nospell + (variable_name) @nospell + (tag - (description (text) @none @spell)) + (description + (text) @none @spell)) + (tag [ (author_name) (version) ] @none) + (tag - (email_address) @string.special.url -) + (email_address) @string.special.url) + +(type_list + "|" @keyword) + +(variable_name + "$" @keyword) -(type_list "|" @keyword) -(variable_name "$" @keyword) (tag (tag_name) @_tag_name - ["<" ">"] @keyword + [ + "<" + ">" + ] @keyword (#eq? @_tag_name "@author")) (text) @spell diff --git a/queries/pioasm/highlights.scm b/queries/pioasm/highlights.scm index 6d0479b37..8bb9dca01 100644 --- a/queries/pioasm/highlights.scm +++ b/queries/pioasm/highlights.scm @@ -1,34 +1,93 @@ -[ (line_comment) (block_comment) ] @comment @spell +[ + (line_comment) + (block_comment) +] @comment @spell (label_decl) @label (string) @string -(instruction opcode: _ @function.call) +(instruction + opcode: _ @function.call) -[ "pins" "x" "y" "null" "isr" "osr" "osre" "status" "pc" "exec" ] @constant.builtin -(wait_source [ "irq" "gpio" "pin" ] @constant.builtin) +[ + "pins" + "x" + "y" + "null" + "isr" + "osr" + "osre" + "status" + "pc" + "exec" +] @constant.builtin -(out_target "pindirs" @constant.builtin) -(set_target "pindirs" @constant.builtin) -(directive "pindirs" @attribute) +(wait_source + [ + "irq" + "gpio" + "pin" + ] @constant.builtin) + +(out_target + "pindirs" @constant.builtin) + +(set_target + "pindirs" @constant.builtin) + +(directive + "pindirs" @attribute) + +(condition + [ + "--" + "!=" + ] @operator) + +(expression + [ + "+" + "-" + "*" + "/" + "|" + "&" + "^" + "::" + ] @operator) -(condition [ "--" "!=" ] @operator) -(expression [ "+" "-" "*" "/" "|" "&" "^" "::" ] @operator) (not) @operator -[ (optional) (irq_modifiers) ] @type.qualifier +[ + (optional) + (irq_modifiers) +] @type.qualifier -[ "block" "noblock" "rel" ] @attribute +[ + "block" + "noblock" + "rel" +] @attribute -[ "iffull" "ifempty" ] @keyword.conditional +[ + "iffull" + "ifempty" +] @keyword.conditional "public" @keyword.storage (integer) @number -(directive (identifier) @variable) -(directive (symbol_def (identifier) @variable)) -(value (identifier) @variable) +(directive + (identifier) @variable) + +(directive + (symbol_def + (identifier) @variable)) + +(value + (identifier) @variable) -(directive directive: _ @keyword.directive) +(directive + directive: _ @keyword.directive) diff --git a/queries/pioasm/injections.scm b/queries/pioasm/injections.scm index 854886c65..84d17cf2d 100644 --- a/queries/pioasm/injections.scm +++ b/queries/pioasm/injections.scm @@ -1,14 +1,14 @@ -([ - (line_comment) - (block_comment) - ] @injection.content - (#set! injection.language "comment")) +([ + (line_comment) + (block_comment) +] @injection.content + (#set! injection.language "comment")) ((code_block (code_block_language) @_language (code_block_body) @injection.content) - (#eq? @_language "c-sdk") - (#set! injection.language "c")) + (#eq? @_language "c-sdk") + (#set! injection.language "c")) (code_block (code_block_language) @injection.language diff --git a/queries/po/folds.scm b/queries/po/folds.scm index 589696477..fd1fb1ebf 100644 --- a/queries/po/folds.scm +++ b/queries/po/folds.scm @@ -4,6 +4,5 @@ (msgid_plural) (msgstr) (msgstr_plural) - (message) ] @fold diff --git a/queries/po/highlights.scm b/queries/po/highlights.scm index d799d692b..0cc92e72a 100644 --- a/queries/po/highlights.scm +++ b/queries/po/highlights.scm @@ -1,5 +1,4 @@ ; Keywords - [ "msgctxt" "msgid" @@ -9,11 +8,12 @@ ] @keyword ; Punctuation - -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket ; Literals - (string) @string (escape_sequence) @string.escape @@ -21,9 +21,12 @@ (number) @number ; Comments - (comment) @comment @spell -(comment (reference (text) @string.special.path)) +(comment + (reference + (text) @string.special.path)) -(comment (flag (text) @keyword.directive)) +(comment + (flag + (text) @keyword.directive)) diff --git a/queries/po/injections.scm b/queries/po/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/po/injections.scm +++ b/queries/po/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/pod/highlights.scm b/queries/pod/highlights.scm index e5a192620..6e4779c85 100644 --- a/queries/pod/highlights.scm +++ b/queries/pod/highlights.scm @@ -1,8 +1,9 @@ ; A highlight file for nvim-treesitter to use - -[(pod_command) - (command) - (cut_command)] @keyword +[ + (pod_command) + (command) + (cut_command) +] @keyword ((command_paragraph (command) @keyword @@ -29,13 +30,15 @@ (#lua-match? @keyword "^=encoding") (content) @string.special) - -(verbatim_paragraph (content) @markup.raw) +(verbatim_paragraph + (content) @markup.raw) (interior_sequence (sequence_letter) @character - ["<" ">"] @punctuation.delimiter -) + [ + "<" + ">" + ] @punctuation.delimiter) (interior_sequence (sequence_letter) @character diff --git a/queries/poe_filter/highlights.scm b/queries/poe_filter/highlights.scm index 7db71d279..b0c715ac9 100644 --- a/queries/poe_filter/highlights.scm +++ b/queries/poe_filter/highlights.scm @@ -1,9 +1,20 @@ -["Show" "Hide" "Minimal"] @module +[ + "Show" + "Hide" + "Minimal" +] @module + +[ + "Import" + "Optional" +] @keyword.import + +(condition + (name) @keyword.conditional) -["Import" "Optional"] @keyword.import +(action + (name) @keyword) -(condition (name) @keyword.conditional) -(action (name) @keyword) (continue) @label (operator) @operator diff --git a/queries/poe_filter/injections.scm b/queries/poe_filter/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/poe_filter/injections.scm +++ b/queries/poe_filter/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/pony/folds.scm b/queries/pony/folds.scm index 1f7ba11b3..95b76eb69 100644 --- a/queries/pony/folds.scm +++ b/queries/pony/folds.scm @@ -1,20 +1,16 @@ [ - (use_statement) + (use_statement) (actor_definition) (class_definition) (primitive_definition) (interface_definition) (trait_definition) (struct_definition) - (constructor) (method) (behavior) - (parameters) - (type) - (if_statement) (iftype_statement) (elseif_block) @@ -30,10 +26,8 @@ (case_statement) (parenthesized_expression) (tuple_expression) - (array_literal) (object_literal) (string) - (block_comment) ] @fold diff --git a/queries/pony/highlights.scm b/queries/pony/highlights.scm index 1d0c86c35..5884a3e89 100644 --- a/queries/pony/highlights.scm +++ b/queries/pony/highlights.scm @@ -1,11 +1,7 @@ ; Includes - -[ - "use" -] @keyword.import +"use" @keyword.import ; Keywords - [ "type" "actor" @@ -25,25 +21,18 @@ "where" ] @keyword -[ - "fun" -] @keyword.function +"fun" @keyword.function -[ - "be" -] @keyword.coroutine +"be" @keyword.coroutine [ "in" "is" ] @keyword.operator -[ - "return" -] @keyword.return +"return" @keyword.return ; Qualifiers - [ "iso" "trn" @@ -59,7 +48,6 @@ ] @type.qualifier ; Conditionals - [ "if" "ifdef" @@ -70,14 +58,16 @@ "match" ] @keyword.conditional -(if_statement "end" @keyword.conditional) +(if_statement + "end" @keyword.conditional) -(iftype_statement "end" @keyword.conditional) +(iftype_statement + "end" @keyword.conditional) -(match_statement "end" @keyword.conditional) +(match_statement + "end" @keyword.conditional) ; Repeats - [ "repeat" "until" @@ -88,86 +78,112 @@ "break" ] @keyword.repeat -(do_block "end" @keyword.repeat) +(do_block + "end" @keyword.repeat) -(repeat_statement "end" @keyword.repeat) +(repeat_statement + "end" @keyword.repeat) ; Exceptions - [ "try" (error) "compile_error" ] @keyword.exception -(try_statement "end" @keyword.exception) +(try_statement + "end" @keyword.exception) -(recover_statement "end" @keyword.exception) +(recover_statement + "end" @keyword.exception) ; Attributes - (annotation) @attribute ; Variables - (identifier) @variable (this) @variable.builtin ; Fields +(field + name: (identifier) @variable.member) -(field name: (identifier) @variable.member) - -(member_expression "." (identifier) @variable.member) +(member_expression + "." + (identifier) @variable.member) ; Constructors - -(constructor "new" @keyword.operator (identifier) @constructor) +(constructor + "new" @keyword.operator + (identifier) @constructor) ; Methods +(method + (identifier) @function.method) -(method (identifier) @function.method) - -(behavior (identifier) @function.method) +(behavior + (identifier) @function.method) -(ffi_method (identifier) @function.method) +(ffi_method + (identifier) @function.method) -((ffi_method (string) @string.special) +((ffi_method + (string) @string.special) (#set! "priority" 105)) (call_expression callee: [ (identifier) @function.method.call - (ffi_identifier (identifier) @function.method.call) - (member_expression "." (identifier) @function.method.call) + (ffi_identifier + (identifier) @function.method.call) + (member_expression + "." + (identifier) @function.method.call) ]) ; Parameters +(parameter + name: (identifier) @variable.parameter) -(parameter name: (identifier) @variable.parameter) -(lambda_parameter name: (identifier) @variable.parameter) +(lambda_parameter + name: (identifier) @variable.parameter) ; Types +(type_alias + (identifier) @type.definition) -(type_alias (identifier) @type.definition) +(base_type + name: (identifier) @type) -(base_type name: (identifier) @type) +(generic_parameter + (identifier) @type) -(generic_parameter (identifier) @type) - -(lambda_type (identifier)? @function.method) +(lambda_type + (identifier)? @function.method) ((identifier) @type (#lua-match? @type "^_*[A-Z][a-zA-Z0-9_]*$")) ; Operators - (unary_expression - operator: ["not" "addressof" "digestof"] @keyword.operator) + operator: + [ + "not" + "addressof" + "digestof" + ] @keyword.operator) (binary_expression - operator: ["and" "or" "xor" "is" "isnt"] @keyword.operator) + operator: + [ + "and" + "or" + "xor" + "is" + "isnt" + ] @keyword.operator) [ "=" @@ -213,35 +229,57 @@ ] @operator ; Literals - (string) @string -(source_file (string) @string.documentation) -(actor_definition (string) @string.documentation) -(class_definition (string) @string.documentation) -(primitive_definition (string) @string.documentation) -(interface_definition (string) @string.documentation) -(trait_definition (string) @string.documentation) -(struct_definition (string) @string.documentation) -(type_alias (string) @string.documentation) -(field (string) @string.documentation) +(source_file + (string) @string.documentation) + +(actor_definition + (string) @string.documentation) + +(class_definition + (string) @string.documentation) + +(primitive_definition + (string) @string.documentation) + +(interface_definition + (string) @string.documentation) + +(trait_definition + (string) @string.documentation) + +(struct_definition + (string) @string.documentation) + +(type_alias + (string) @string.documentation) + +(field + (string) @string.documentation) (constructor [ - (string) @string.documentation - (block . (string) @string.documentation) + (string) @string.documentation + (block + . + (string) @string.documentation) ]) (method [ - (string) @string.documentation - (block . (string) @string.documentation) + (string) @string.documentation + (block + . + (string) @string.documentation) ]) (behavior [ - (string) @string.documentation - (block . (string) @string.documentation) + (string) @string.documentation + (block + . + (string) @string.documentation) ]) (character) @character @@ -255,12 +293,20 @@ (boolean) @boolean ; Punctuation +[ + "{" + "}" +] @punctuation.bracket -[ "{" "}" ] @punctuation.bracket - -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket [ "." @@ -281,7 +327,6 @@ ] @punctuation.special ; Comments - [ (line_comment) (block_comment) diff --git a/queries/pony/indents.scm b/queries/pony/indents.scm index c9b3e7a25..3bddd29de 100644 --- a/queries/pony/indents.scm +++ b/queries/pony/indents.scm @@ -1,18 +1,15 @@ [ - (use_statement) + (use_statement) (actor_definition) (class_definition) (primitive_definition) (interface_definition) (trait_definition) (struct_definition) - (constructor) (method) (behavior) - (parameters) - (if_block) (then_block) (elseif_block) @@ -23,22 +20,27 @@ (match_statement) (parenthesized_expression) (tuple_expression) - (array_literal) (object_literal) ] @indent.begin -(try_statement (block) @indent.begin) +(try_statement + (block) @indent.begin) -(repeat_statement (block) @indent.begin) +(repeat_statement + (block) @indent.begin) -(recover_statement (block) @indent.begin) +(recover_statement + (block) @indent.begin) -(return_statement (block) @indent.begin) +(return_statement + (block) @indent.begin) -(continue_statement (block) @indent.begin) +(continue_statement + (block) @indent.begin) -(break_statement (block) @indent.begin) +(break_statement + (block) @indent.begin) [ "}" @@ -46,11 +48,20 @@ ")" ] @indent.end -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch [ (ERROR) diff --git a/queries/pony/injections.scm b/queries/pony/injections.scm index 43ae7287b..3cd6aac8e 100644 --- a/queries/pony/injections.scm +++ b/queries/pony/injections.scm @@ -1,5 +1,5 @@ ([ (line_comment) (block_comment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) diff --git a/queries/pony/locals.scm b/queries/pony/locals.scm index 033dcb257..a27e501a3 100644 --- a/queries/pony/locals.scm +++ b/queries/pony/locals.scm @@ -1,18 +1,15 @@ ; Scopes - [ - (use_statement) + (use_statement) (actor_definition) (class_definition) (primitive_definition) (interface_definition) (trait_definition) (struct_definition) - (constructor) (method) (behavior) - (if_statement) (iftype_statement) (elseif_block) @@ -28,17 +25,14 @@ (case_statement) (parenthesized_expression) (tuple_expression) - (array_literal) - (object_literal) + (object_literal) ] @local.scope ; References - (identifier) @local.reference ; Definitions - (field name: (identifier) @local.definition.field) @@ -84,8 +78,9 @@ (for_statement [ (identifier) @local.definition.var - (tuple_expression (identifier) @local.definition.var) + (tuple_expression + (identifier) @local.definition.var) ]) -(with_elem +(with_elem (identifier) @local.definition.var) diff --git a/queries/prisma/folds.scm b/queries/prisma/folds.scm index 6b42d26cc..73be36016 100644 --- a/queries/prisma/folds.scm +++ b/queries/prisma/folds.scm @@ -1,7 +1,7 @@ [ - (generator_declaration) - (datasource_declaration) - (model_declaration) - (enum_declaration) - (view_declaration) + (generator_declaration) + (datasource_declaration) + (model_declaration) + (enum_declaration) + (view_declaration) ] @fold diff --git a/queries/prisma/highlights.scm b/queries/prisma/highlights.scm index cfdc3a668..ce9c25590 100644 --- a/queries/prisma/highlights.scm +++ b/queries/prisma/highlights.scm @@ -1,12 +1,12 @@ (variable) @variable [ - "datasource" - "enum" - "generator" - "model" - "type" - "view" + "datasource" + "enum" + "generator" + "model" + "type" + "view" ] @keyword (comment) @comment @spell @@ -19,9 +19,14 @@ ] @function (arguments) @property + (column_type) @type + (enumeral) @constant -(column_declaration (identifier) @variable) + +(column_declaration + (identifier) @variable) + (string) @string [ diff --git a/queries/promql/highlights.scm b/queries/promql/highlights.scm index d0af0356c..0f58f1578 100644 --- a/queries/promql/highlights.scm +++ b/queries/promql/highlights.scm @@ -1,5 +1,4 @@ ; highlights.scm - [ "*" "/" @@ -26,13 +25,17 @@ ] @punctuation.bracket (float_literal) @number.float + (string_literal) @string (metric_name) @type + (range_selection) @type + (subquery_range_selection) @type (label_name) @variable.member + (label_value) @string.regexp (function_name) @function.call diff --git a/queries/promql/injections.scm b/queries/promql/injections.scm index 408b1c7b5..4fbe37a00 100644 --- a/queries/promql/injections.scm +++ b/queries/promql/injections.scm @@ -1,3 +1,3 @@ ((label_value) @injection.content - (#set! injection.language "regex") - (#offset! @injection.content 0 1 0 -1)) + (#set! injection.language "regex") + (#offset! @injection.content 0 1 0 -1)) diff --git a/queries/properties/highlights.scm b/queries/properties/highlights.scm index 3414294b7..d819e20a5 100644 --- a/queries/properties/highlights.scm +++ b/queries/properties/highlights.scm @@ -4,25 +4,41 @@ (value) @string -(value (escape) @string.escape) +(value + (escape) @string.escape) ((value) @boolean - (#any-of? @boolean "true" "false")) + (#any-of? @boolean "true" "false")) ((value) @number - (#lua-match? @number "^%d+$")) + (#lua-match? @number "^%d+$")) (index) @number -(property [ "=" ":" ] @operator) +(property + [ + "=" + ":" + ] @operator) -[ "${" "}" ] @punctuation.special +[ + "${" + "}" +] @punctuation.special -(substitution ":" @punctuation.special) +(substitution + ":" @punctuation.special) -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "." "\\" ] @punctuation.delimiter +[ + "." + "\\" +] @punctuation.delimiter -((substitution (key) @constant) - (#lua-match? @constant "^[A-Z_][A-Z0-9_]*$")) +((substitution + (key) @constant) + (#lua-match? @constant "^[A-Z_][A-Z0-9_]*$")) diff --git a/queries/properties/injections.scm b/queries/properties/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/properties/injections.scm +++ b/queries/properties/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/properties/locals.scm b/queries/properties/locals.scm index f70e953db..91a3b9a86 100644 --- a/queries/properties/locals.scm +++ b/queries/properties/locals.scm @@ -1,3 +1,5 @@ -(property (key) @local.definition) +(property + (key) @local.definition) -(substitution (key) @local.reference) +(substitution + (key) @local.reference) diff --git a/queries/proto/highlights.scm b/queries/proto/highlights.scm index f3715d5db..102d5c20b 100644 --- a/queries/proto/highlights.scm +++ b/queries/proto/highlights.scm @@ -11,13 +11,9 @@ "to" ] @keyword -[ - "rpc" -] @keyword.function +"rpc" @keyword.function -[ - "returns" -] @keyword.return +"returns" @keyword.return [ "optional" @@ -75,8 +71,8 @@ ] @punctuation.bracket [ - ";" - "," + ";" + "," ] @punctuation.delimiter "=" @operator diff --git a/queries/prql/highlights.scm b/queries/prql/highlights.scm index 587e8f070..2ab793ce7 100644 --- a/queries/prql/highlights.scm +++ b/queries/prql/highlights.scm @@ -25,14 +25,13 @@ (keyword_case) @keyword.conditional [ - (literal_string) - (f_string) - (s_string) + (literal_string) + (f_string) + (s_string) ] @string (assignment alias: (field) @variable.member) - alias: (identifier) @variable.member (comment) @comment @spell @@ -99,18 +98,18 @@ alias: (identifier) @variable.member ] @function [ - (keyword_side) - (keyword_format) + (keyword_side) + (keyword_format) ] @attribute [ - (keyword_version) - (keyword_target) + (keyword_version) + (keyword_target) ] @type.qualifier (target) @function.builtin - [ +[ (date) (time) (timestamp) @@ -130,9 +129,7 @@ alias: (identifier) @variable.member (keyword_false) ] @boolean -[ - (keyword_in) -] @keyword.operator +(keyword_in) @keyword.operator (function_definition (keyword_let) @@ -145,7 +142,4 @@ alias: (identifier) @variable.member (keyword_let) name: (identifier) @constant) - - (keyword_null) @constant.builtin - - +(keyword_null) @constant.builtin diff --git a/queries/prql/injections.scm b/queries/prql/injections.scm index ac266cc2d..e6cbeda35 100644 --- a/queries/prql/injections.scm +++ b/queries/prql/injections.scm @@ -1,6 +1,6 @@ ((s_string) @injection.content - (#set! injection.language "sql") - (#offset! @injection.content 0 2 0 -1)) + (#set! injection.language "sql") + (#offset! @injection.content 0 2 0 -1)) (from_text (keyword_from_text) @@ -10,4 +10,4 @@ (#offset! @injection.content 0 3 0 -3)) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/psv/highlights.scm b/queries/psv/highlights.scm index b7303fe0b..1e886a0a4 100644 --- a/queries/psv/highlights.scm +++ b/queries/psv/highlights.scm @@ -1,3 +1,2 @@ ; inherits: tsv - "|" @punctuation.delimiter diff --git a/queries/pug/highlights.scm b/queries/pug/highlights.scm index 7ac2c7c63..3645a7e3e 100644 --- a/queries/pug/highlights.scm +++ b/queries/pug/highlights.scm @@ -1,6 +1,7 @@ (comment) @comment @spell (tag_name) @tag + ((tag_name) @constant.builtin ; https://www.script-example.com/html-tag-liste ; format-ignore @@ -17,6 +18,7 @@ "script" "noscript" "template" "slot" "canvas")) (id) @constant + (class) @property (doctype) @keyword.directive @@ -28,54 +30,89 @@ (attribute (attribute_name) @tag.attribute "=" @operator))) + ((tag - (attributes - (attribute (attribute_name) @keyword))) - (#match? @keyword "^(:|v-bind|v-|\\@)")) + (attributes + (attribute + (attribute_name) @keyword))) + (#match? @keyword "^(:|v-bind|v-|\\@)")) + (quoted_attribute_value) @string -(include (keyword) @keyword.import) -(extends (keyword) @keyword.import) +(include + (keyword) @keyword.import) + +(extends + (keyword) @keyword.import) + (filename) @string.special.path -(block_definition (keyword) @keyword) -(block_append (keyword)+ @keyword) -(block_prepend (keyword)+ @keyword) +(block_definition + (keyword) @keyword) + +(block_append + (keyword)+ @keyword) + +(block_prepend + (keyword)+ @keyword) + (block_name) @type -(conditional (keyword) @keyword.conditional) +(conditional + (keyword) @keyword.conditional) + (case (keyword) @keyword.conditional - (when (keyword) @keyword.conditional)+) + (when + (keyword) @keyword.conditional)+) + +(each + (keyword) @keyword.repeat) -(each (keyword) @keyword.repeat) -(while (keyword) @keyword.repeat) +(while + (keyword) @keyword.repeat) (mixin_use "+" @punctuation.delimiter (mixin_name) @function.call) + (mixin_definition (keyword) @keyword.function (mixin_name) @function) + (mixin_attributes (attribute_name) @variable.parameter) (filter ":" @punctuation.delimiter (filter_name) @function.method.call) + (filter (attributes - (attribute (attribute_name) @variable.parameter))) + (attribute + (attribute_name) @variable.parameter))) [ - "(" ")" - "#{" "}" - ;; unsupported - ; "!{" - ; "#[" "]" + "(" + ")" + "#{" + "}" + ; unsupported + ; "!{" + ; "#[" "]" ] @punctuation.bracket -[ "," "." "|" ] @punctuation.delimiter -(buffered_code "=" @punctuation.delimiter) -(unbuffered_code "-" @punctuation.delimiter) -(unescaped_buffered_code "!=" @punctuation.delimiter) +[ + "," + "." + "|" +] @punctuation.delimiter + +(buffered_code + "=" @punctuation.delimiter) + +(unbuffered_code + "-" @punctuation.delimiter) + +(unescaped_buffered_code + "!=" @punctuation.delimiter) diff --git a/queries/pug/injections.scm b/queries/pug/injections.scm index a307a4eb2..d4bd712b5 100644 --- a/queries/pug/injections.scm +++ b/queries/pug/injections.scm @@ -1,8 +1,8 @@ ((javascript) @injection.content - (#set! injection.language "javascript")) + (#set! injection.language "javascript")) ((attribute_name) @_attribute_name - (quoted_attribute_value + (quoted_attribute_value (attribute_value) @injection.content (#set! injection.language "javascript")) (#match? @_attribute_name "^(:|v-bind|v-|\\@)")) diff --git a/queries/puppet/highlights.scm b/queries/puppet/highlights.scm index aaf5dac39..8e99f1268 100644 --- a/queries/puppet/highlights.scm +++ b/queries/puppet/highlights.scm @@ -1,17 +1,17 @@ ; Variables - (identifier) @variable ; Includes - "include" @keyword.import -(include_statement (identifier) @type) +(include_statement + (identifier) @type) -(include_statement (class_identifier (identifier) @type . )) +(include_statement + (class_identifier + (identifier) @type .)) ; Keywords - [ "class" "inherits" @@ -33,68 +33,99 @@ "case" ] @keyword.conditional -(default_case "default" @keyword.conditional) +(default_case + "default" @keyword.conditional) ; Properties +(attribute + name: (identifier) @property) -(attribute name: (identifier) @property) -(attribute name: (variable (identifier) @property)) +(attribute + name: + (variable + (identifier) @property)) ; Parameters +(lambda + (variable + (identifier) @variable.parameter)) -(lambda (variable (identifier) @variable.parameter)) +(parameter + (variable + (identifier) @variable.parameter)) -(parameter (variable (identifier) @variable.parameter)) - -(function_call (identifier) @variable.parameter) +(function_call + (identifier) @variable.parameter) -(method_call (identifier) @variable.parameter) +(method_call + (identifier) @variable.parameter) ; Functions - (function_declaration - "function" . (identifier) @function) + "function" + . + (identifier) @function) (function_call - (identifier) @function.call "(") + (identifier) @function.call + "(") (defined_resource_type - "define" . (identifier) @function) + "define" + . + (identifier) @function) ; Methods - (function_declaration - "function" . (class_identifier (identifier) @function.method . )) + "function" + . + (class_identifier + (identifier) @function.method .)) (function_call - (class_identifier (identifier) @function.method.call . )) + (class_identifier + (identifier) @function.method.call .)) (defined_resource_type - "define" . (class_identifier (identifier) @function.method . )) + "define" + . + (class_identifier + (identifier) @function.method .)) (method_call - "." . (identifier) @function.method.call) + "." + . + (identifier) @function.method.call) ; Types - (type) @type (builtin_type) @type.builtin (class_definition (identifier) @type) + (class_definition - (class_identifier (identifier) @type . )) + (class_identifier + (identifier) @type .)) + +(class_inherits + (identifier) @type) -(class_inherits (identifier) @type) -(class_inherits (class_identifier (identifier) @type . )) +(class_inherits + (class_identifier + (identifier) @type .)) (resource_declaration (identifier) @type) + (resource_declaration - (class_identifier (identifier) @type . )) + (class_identifier + (identifier) @type .)) -(node_definition (node_name (identifier) @type)) +(node_definition + (node_name + (identifier) @type)) ((identifier) @type (#lua-match? @type "^[A-Z]")) @@ -103,11 +134,11 @@ (#any-of? @type.builtin "Boolean" "Integer" "Float" "String" "Array" "Hash" "Regexp" "Variant" "Data" "Undef" "Default" "File")) ; "Namespaces" - -(class_identifier . (identifier) @module) +(class_identifier + . + (identifier) @module) ; Operators - [ "or" "and" @@ -142,7 +173,6 @@ ] @operator ; Punctuation - [ "|" "." @@ -153,13 +183,26 @@ "=>" ] @punctuation.delimiter -[ "{" "}" ] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -(interpolation [ "${" "}" ] @punctuation.special) +(interpolation + [ + "${" + "}" + ] @punctuation.special) [ "$" @@ -168,7 +211,6 @@ ] @punctuation.special ; Literals - (number) @number (float) @number.float @@ -187,5 +229,4 @@ ] @variable.builtin ; Comments - (comment) @comment @spell diff --git a/queries/puppet/locals.scm b/queries/puppet/locals.scm index cc13bc77b..37ac2d851 100644 --- a/queries/puppet/locals.scm +++ b/queries/puppet/locals.scm @@ -1,5 +1,4 @@ ; Scopes - [ (block) (defined_resource_type) @@ -16,31 +15,50 @@ ] @local.scope ; References - [ (identifier) (class_identifier) - (variable) + (variable) ] @local.reference ; Definitions - -(attribute [(identifier) (variable)] @local.definition.field) +(attribute + [ + (identifier) + (variable) + ] @local.definition.field) (function_declaration - [(identifier) (class_identifier)] @local.definition.function) + [ + (identifier) + (class_identifier) + ] @local.definition.function) -(include_statement [(identifier) (class_identifier)] @local.definition.import) +(include_statement + [ + (identifier) + (class_identifier) + ] @local.definition.import) -(parameter (variable) @local.definition.parameter) +(parameter + (variable) @local.definition.parameter) (class_definition - [(identifier) (class_identifier)] @local.definition.type) + [ + (identifier) + (class_identifier) + ] @local.definition.type) (node_definition - (node_name (identifier) @local.definition.type)) + (node_name + (identifier) @local.definition.type)) (resource_declaration - [(identifier) (class_identifier)] @local.definition.type) + [ + (identifier) + (class_identifier) + ] @local.definition.type) -(assignment . (variable) @local.definition.var) +(assignment + . + (variable) @local.definition.var) diff --git a/queries/purescript/highlights.scm b/queries/purescript/highlights.scm index 247ea839e..b241ba852 100644 --- a/queries/purescript/highlights.scm +++ b/queries/purescript/highlights.scm @@ -1,152 +1,192 @@ ; ---------------------------------------------------------------------------- ; Literals and comments - [ (integer) (exp_negation) ] @number - (exp_literal (number)) @number.float - (char) @character - [ - (string) - (triple_quote_string) - ] @string - (comment) @comment @spell +(exp_literal + (number)) @number.float -; ---------------------------------------------------------------------------- -; Punctuation +(char) @character - [ - "(" - ")" - "{" - "}" - "[" - "]" - ] @punctuation.bracket +[ + (string) + (triple_quote_string) +] @string - [ - (comma) - ";" - (qualified_module) ; grabs the `.` (dot), ex: import System.IO - "." - ] @punctuation.delimiter +(comment) @comment @spell + +; ---------------------------------------------------------------------------- +; Punctuation +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket +[ + (comma) + ";" + (qualified_module) ; grabs the `.` (dot), ex: import System.IO + "." +] @punctuation.delimiter ; ---------------------------------------------------------------------------- ; Keywords, operators, includes +[ + "if" + "then" + "else" + "case" + "of" +] @keyword.conditional + +[ + "import" + "module" +] @keyword.import + +[ + (operator) + (constructor_operator) + (type_operator) + (all_names) + "=" + "|" + "::" + "∷" + "=>" + "⇒" + "<=" + "⇐" + "->" + "→" + "<-" + "←" + "\\" + "`" + "@" +] @operator - [ - "if" - "then" - "else" - "case" - "of" - ] @keyword.conditional +(qualified_module + (module) @constructor) - [ - "import" - "module" - ] @keyword.import +(module) @module - [ - (operator) - (constructor_operator) - (type_operator) - (all_names) +(qualified_type + (module) @module) - "=" - "|" - "::" - "∷" - "=>" - "⇒" - "<=" - "⇐" - "->" - "→" - "<-" - "←" - "\\" - "`" - "@" - ] @operator +(qualified_variable + (module) @module) - (qualified_module (module) @constructor) - (module) @module - (qualified_type (module) @module) - (qualified_variable (module) @module) - (import (module) @module) +(import + (module) @module) - [ - (where) - "let" - "in" - "class" - "instance" - "derive" - "foreign" - "data" - "newtype" - "type" - "as" - "hiding" - "do" - "ado" - "forall" - "∀" - "infix" - "infixl" - "infixr" - ] @keyword +[ + (where) + "let" + "in" + "class" + "instance" + "derive" + "foreign" + "data" + "newtype" + "type" + "as" + "hiding" + "do" + "ado" + "forall" + "∀" + "infix" + "infixl" + "infixr" +] @keyword - (class_instance "else" @keyword) +(class_instance + "else" @keyword) - (type_role_declaration - "role" @keyword - role: (type_role) @type.qualifier) +(type_role_declaration + "role" @keyword + role: (type_role) @type.qualifier) - (hole) @character.special +(hole) @character.special - ; `_` wildcards in if-then-else and case-of expressions, - ; as well as record updates and operator sections - (wildcard) @variable.parameter +; `_` wildcards in if-then-else and case-of expressions, +; as well as record updates and operator sections +(wildcard) @variable.parameter ; ---------------------------------------------------------------------------- ; Functions and variables +(variable) @variable + +(exp_apply + . + (exp_name + (variable) @function)) + +(exp_apply + . + (exp_name + (qualified_variable + (variable) @function))) + +(row_field + (field_name) @variable.member) + +(record_field + (field_name) @variable.member) + +(record_accessor + (variable) @variable.member) + +(exp_record_access + (variable) @variable.member) - (variable) @variable - (exp_apply . (exp_name (variable) @function)) - (exp_apply . (exp_name (qualified_variable (variable) @function))) +(signature + name: (variable) @type) - (row_field (field_name) @variable.member) - (record_field (field_name) @variable.member) - (record_accessor (variable) @variable.member) - (exp_record_access (variable) @variable.member) +(kind_declaration + (class_name) @type) - (signature name: (variable) @type) - (kind_declaration (class_name) @type) - (function name: (variable) @function) - (foreign_import (variable) @function) - (class_instance (instance_name) @function) - (derive_declaration (instance_name) @function) +(function + name: (variable) @function) - ; true or false - ((variable) @boolean +(foreign_import + (variable) @function) + +(class_instance + (instance_name) @function) + +(derive_declaration + (instance_name) @function) + +; true or false +((variable) @boolean (#any-of? @boolean "true" "false")) - ; The former one works for `tree-sitter highlight` but not in Helix/Kakoune. - ; The latter two work in Helix (but not Kakoune) and are a good compromise between not highlighting anything at all - ; as an operator and leaving it to the child nodes, and highlighting everything as an operator. - (exp_ticked (_) @operator) - (exp_ticked (exp_name (variable) @operator)) - (exp_ticked (exp_name (qualified_variable (variable) @operator))) +; The former one works for `tree-sitter highlight` but not in Helix/Kakoune. +; The latter two work in Helix (but not Kakoune) and are a good compromise between not highlighting anything at all +; as an operator and leaving it to the child nodes, and highlighting everything as an operator. +(exp_ticked + (_) @operator) -; ---------------------------------------------------------------------------- -; Types +(exp_ticked + (exp_name + (variable) @operator)) - (type) @type +(exp_ticked + (exp_name + (qualified_variable + (variable) @operator))) - (constructor) @constructor +; ---------------------------------------------------------------------------- +; Types +(type) @type +(constructor) @constructor diff --git a/queries/purescript/injections.scm b/queries/purescript/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/purescript/injections.scm +++ b/queries/purescript/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/purescript/locals.scm b/queries/purescript/locals.scm index 0d42125e2..16265231d 100644 --- a/queries/purescript/locals.scm +++ b/queries/purescript/locals.scm @@ -1,4 +1,11 @@ -(signature name: (variable)) @local.definition.type -(function name: (variable)) @local.definition.function -(pat_name (variable)) @local.definition -(exp_name (variable)) @local.reference +(signature + name: (variable)) @local.definition.type + +(function + name: (variable)) @local.definition.function + +(pat_name + (variable)) @local.definition + +(exp_name + (variable)) @local.reference diff --git a/queries/pymanifest/highlights.scm b/queries/pymanifest/highlights.scm index 0f76a9383..11d8b605f 100644 --- a/queries/pymanifest/highlights.scm +++ b/queries/pymanifest/highlights.scm @@ -9,11 +9,16 @@ (char_sequence) @string.special (char_sequence - [ "[" "]" ] @punctuation.bracket) + [ + "[" + "]" + ] @punctuation.bracket) -(char_sequence "!" @operator) +(char_sequence + "!" @operator) -(char_range "-" @operator) +(char_range + "-" @operator) (escaped_char) @string.escape diff --git a/queries/pymanifest/injections.scm b/queries/pymanifest/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/pymanifest/injections.scm +++ b/queries/pymanifest/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/python/folds.scm b/queries/python/folds.scm index 78e1e2c00..7c547db38 100644 --- a/queries/python/folds.scm +++ b/queries/python/folds.scm @@ -1,28 +1,23 @@ [ (function_definition) (class_definition) - (while_statement) (for_statement) (if_statement) (with_statement) (try_statement) (match_statement) - (import_from_statement) (parameters) (argument_list) - (parenthesized_expression) (generator_expression) (list_comprehension) (set_comprehension) (dictionary_comprehension) - (tuple) (list) (set) (dictionary) - (string) ] @fold diff --git a/queries/python/highlights.scm b/queries/python/highlights.scm index 8d272185c..1d149162d 100644 --- a/queries/python/highlights.scm +++ b/queries/python/highlights.scm @@ -1,20 +1,20 @@ -;; From tree-sitter-python licensed under MIT License +; From tree-sitter-python licensed under MIT License ; Copyright (c) 2016 Max Brunsfeld - ; Variables (identifier) @variable ; Reset highlighting in f-string interpolations (interpolation) @none -;; Identifier naming conventions +; Identifier naming conventions ((identifier) @type - (#lua-match? @type "^[A-Z].*[a-z]")) + (#lua-match? @type "^[A-Z].*[a-z]")) + ((identifier) @constant - (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) + (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) ((identifier) @constant.builtin - (#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$")) + (#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$")) ((identifier) @constant.builtin ; format-ignore @@ -26,160 +26,188 @@ "_" @constant.builtin ; match wildcard ((attribute - attribute: (identifier) @variable.member) - (#lua-match? @variable.member "^[%l_].*$")) + attribute: (identifier) @variable.member) + (#lua-match? @variable.member "^[%l_].*$")) ((assignment left: (identifier) @type.definition - (type (identifier) @_annotation)) - (#eq? @_annotation "TypeAlias")) + (type + (identifier) @_annotation)) + (#eq? @_annotation "TypeAlias")) ((assignment left: (identifier) @type.definition - right: (call - function: (identifier) @_func)) - (#any-of? @_func "TypeVar" "NewType")) + right: + (call + function: (identifier) @_func)) + (#any-of? @_func "TypeVar" "NewType")) ; Function calls - (call function: (identifier) @function.call) (call - function: (attribute - attribute: (identifier) @function.method.call)) + function: + (attribute + attribute: (identifier) @function.method.call)) ((call - function: (identifier) @constructor) - (#lua-match? @constructor "^%u")) + function: (identifier) @constructor) + (#lua-match? @constructor "^%u")) ((call - function: (attribute - attribute: (identifier) @constructor)) - (#lua-match? @constructor "^%u")) - -;; Decorators + function: + (attribute + attribute: (identifier) @constructor)) + (#lua-match? @constructor "^%u")) -((decorator "@" @attribute) - (#set! "priority" 101)) +; Decorators +((decorator + "@" @attribute) + (#set! "priority" 101)) (decorator (identifier) @attribute) + (decorator (attribute attribute: (identifier) @attribute)) + (decorator - (call (identifier) @attribute)) + (call + (identifier) @attribute)) + (decorator - (call (attribute - attribute: (identifier) @attribute))) + (call + (attribute + attribute: (identifier) @attribute))) ((decorator (identifier) @attribute.builtin) - (#any-of? @attribute.builtin "classmethod" "property")) - -;; Builtin functions + (#any-of? @attribute.builtin "classmethod" "property")) +; Builtin functions ((call function: (identifier) @function.builtin) - (#any-of? @function.builtin - "abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr" "classmethod" - "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec" "filter" "float" "format" - "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id" "input" "int" "isinstance" "issubclass" - "iter" "len" "list" "locals" "map" "max" "memoryview" "min" "next" "object" "oct" "open" "ord" "pow" - "print" "property" "range" "repr" "reversed" "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" - "sum" "super" "tuple" "type" "vars" "zip" "__import__")) - -;; Function definitions + (#any-of? @function.builtin "abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr" "classmethod" "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec" "filter" "float" "format" "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id" "input" "int" "isinstance" "issubclass" "iter" "len" "list" "locals" "map" "max" "memoryview" "min" "next" "object" "oct" "open" "ord" "pow" "print" "property" "range" "repr" "reversed" "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type" "vars" "zip" "__import__")) +; Function definitions (function_definition name: (identifier) @function) -(type (identifier) @type) +(type + (identifier) @type) + (type (subscript (identifier) @type)) ; type subscript: Tuple[int] ((call function: (identifier) @_isinstance - arguments: (argument_list - (_) - (identifier) @type)) - (#eq? @_isinstance "isinstance")) + arguments: + (argument_list + (_) + (identifier) @type)) + (#eq? @_isinstance "isinstance")) -;; Normal parameters +; Normal parameters (parameters (identifier) @variable.parameter) -;; Lambda parameters + +; Lambda parameters (lambda_parameters (identifier) @variable.parameter) + (lambda_parameters (tuple_pattern (identifier) @variable.parameter)) + ; Default parameters (keyword_argument name: (identifier) @variable.parameter) + ; Naming parameters on call-site (default_parameter name: (identifier) @variable.parameter) + (typed_parameter (identifier) @variable.parameter) + (typed_default_parameter name: (identifier) @variable.parameter) + ; Variadic parameters *args, **kwargs (parameters - (list_splat_pattern ; *args + (list_splat_pattern + ; *args (identifier) @variable.parameter)) + (parameters - (dictionary_splat_pattern ; **kwargs + (dictionary_splat_pattern + ; **kwargs (identifier) @variable.parameter)) + (lambda_parameters (list_splat_pattern (identifier) @variable.parameter)) + (lambda_parameters (dictionary_splat_pattern (identifier) @variable.parameter)) +; Literals +(none) @constant.builtin -;; Literals +[ + (true) + (false) +] @boolean -(none) @constant.builtin -[(true) (false)] @boolean ((identifier) @variable.builtin - (#eq? @variable.builtin "self")) + (#eq? @variable.builtin "self")) + ((identifier) @variable.builtin - (#eq? @variable.builtin "cls")) + (#eq? @variable.builtin "cls")) (integer) @number + (float) @number.float (comment) @comment @spell -((module . (comment) @keyword.directive) +((module + . + (comment) @keyword.directive) (#lua-match? @keyword.directive "^#!/")) (string) @string + [ (escape_sequence) (escape_interpolation) ] @string.escape ; doc-strings - -(module . (expression_statement (string) @string.documentation @spell)) +(module + . + (expression_statement + (string) @string.documentation @spell)) (class_definition body: (block - . (expression_statement (string) @string.documentation @spell))) + . + (expression_statement + (string) @string.documentation @spell))) (function_definition body: (block - . (expression_statement (string) @string.documentation @spell))) + . + (expression_statement + (string) @string.documentation @spell))) ; Tokens - [ "-" "-=" @@ -229,7 +257,6 @@ "or" "is not" "not in" - "del" ] @keyword.operator @@ -260,19 +287,36 @@ "return" "yield" ] @keyword.return -(yield "from" @keyword.return) + +(yield + "from" @keyword.return) (future_import_statement "from" @keyword.import "__future__" @constant.builtin) -(import_from_statement "from" @keyword.import) + +(import_from_statement + "from" @keyword.import) + "import" @keyword.import -(aliased_import "as" @keyword.import) +(aliased_import + "as" @keyword.import) -["if" "elif" "else" "match" "case"] @keyword.conditional +[ + "if" + "elif" + "else" + "match" + "case" +] @keyword.conditional -["for" "while" "break" "continue"] @keyword.repeat +[ + "for" + "while" + "break" + "continue" +] @keyword.repeat [ "try" @@ -282,13 +326,21 @@ "finally" ] @keyword.exception -(raise_statement "from" @keyword.exception) +(raise_statement + "from" @keyword.exception) (try_statement (else_clause "else" @keyword.exception)) -["(" ")" "[" "]" "{" "}"] @punctuation.bracket +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket (interpolation "{" @punctuation.special @@ -296,40 +348,52 @@ (type_conversion) @function.macro -["," "." ":" ";" (ellipsis)] @punctuation.delimiter - -;; Class definitions +[ + "," + "." + ":" + ";" + (ellipsis) +] @punctuation.delimiter -(class_definition name: (identifier) @type) +; Class definitions +(class_definition + name: (identifier) @type) (class_definition - body: (block - (function_definition - name: (identifier) @function.method))) + body: + (block + (function_definition + name: (identifier) @function.method))) (class_definition - superclasses: (argument_list - (identifier) @type)) + superclasses: + (argument_list + (identifier) @type)) ((class_definition - body: (block - (expression_statement - (assignment - left: (identifier) @variable.member)))) - (#lua-match? @variable.member "^%l.*$")) + body: + (block + (expression_statement + (assignment + left: (identifier) @variable.member)))) + (#lua-match? @variable.member "^%l.*$")) + ((class_definition - body: (block - (expression_statement - (assignment - left: (_ - (identifier) @variable.member))))) - (#lua-match? @variable.member "^%l.*$")) + body: + (block + (expression_statement + (assignment + left: + (_ + (identifier) @variable.member))))) + (#lua-match? @variable.member "^%l.*$")) ((class_definition (block (function_definition name: (identifier) @constructor))) - (#any-of? @constructor "__new__" "__init__")) + (#any-of? @constructor "__new__" "__init__")) ((identifier) @type.builtin ; format-ignore @@ -350,10 +414,14 @@ "bool" "int" "float" "complex" "list" "tuple" "range" "str" "bytes" "bytearray" "memoryview" "set" "frozenset" "dict" "type" "object")) -;; Regex from the `re` module - +; Regex from the `re` module (call - function: (attribute - object: (identifier) @_re) - arguments: (argument_list . (string (string_content) @string.regexp)) + function: + (attribute + object: (identifier) @_re) + arguments: + (argument_list + . + (string + (string_content) @string.regexp)) (#eq? @_re "re")) diff --git a/queries/python/indents.scm b/queries/python/indents.scm index 338473f00..b89030425 100644 --- a/queries/python/indents.scm +++ b/queries/python/indents.scm @@ -1,82 +1,106 @@ [ (import_from_statement) - (parenthesized_expression) (generator_expression) (list_comprehension) (set_comprehension) (dictionary_comprehension) - (tuple_pattern) (list_pattern) (binary_operator) - (lambda) - (concatenated_string) ] @indent.begin ((list) @indent.align - (#set! indent.open_delimiter "[") - (#set! indent.close_delimiter "]") -) + (#set! indent.open_delimiter "[") + (#set! indent.close_delimiter "]")) + ((dictionary) @indent.align - (#set! indent.open_delimiter "{") - (#set! indent.close_delimiter "}") -) + (#set! indent.open_delimiter "{") + (#set! indent.close_delimiter "}")) + ((set) @indent.align - (#set! indent.open_delimiter "{") - (#set! indent.close_delimiter "}") -) + (#set! indent.open_delimiter "{") + (#set! indent.close_delimiter "}")) ((for_statement) @indent.begin - (#set! indent.immediate 1)) + (#set! indent.immediate 1)) + ((if_statement) @indent.begin - (#set! indent.immediate 1)) + (#set! indent.immediate 1)) + ((while_statement) @indent.begin - (#set! indent.immediate 1)) + (#set! indent.immediate 1)) + ((try_statement) @indent.begin - (#set! indent.immediate 1)) -(ERROR "try" ":" @indent.begin (#set! indent.immediate 1)) + (#set! indent.immediate 1)) + +(ERROR + "try" + ":" @indent.begin + (#set! indent.immediate 1)) + ((function_definition) @indent.begin - (#set! indent.immediate 1)) + (#set! indent.immediate 1)) + ((class_definition) @indent.begin - (#set! indent.immediate 1)) + (#set! indent.immediate 1)) + ((with_statement) @indent.begin - (#set! indent.immediate 1)) + (#set! indent.immediate 1)) + ((match_statement) @indent.begin - (#set! indent.immediate 1)) + (#set! indent.immediate 1)) + ((case_clause) @indent.begin - (#set! indent.immediate 1)) + (#set! indent.immediate 1)) (if_statement condition: (parenthesized_expression) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")") - (#set! indent.avoid_last_matching_next 1) -) + (#set! indent.avoid_last_matching_next 1)) + (while_statement condition: (parenthesized_expression) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")") - (#set! indent.avoid_last_matching_next 1) -) + (#set! indent.avoid_last_matching_next 1)) + +(ERROR + "(" @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")") + . + (_)) -(ERROR "(" @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")") . (_)) ((argument_list) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) + ((parameters) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")") - (#set! indent.avoid_last_matching_next 1)) + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")") + (#set! indent.avoid_last_matching_next 1)) + ((tuple) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) -(ERROR "[" @indent.align (#set! indent.open_delimiter "[") (#set! indent.close_delimiter "]") . (_)) +(ERROR + "[" @indent.align + (#set! indent.open_delimiter "[") + (#set! indent.close_delimiter "]") + . + (_)) -(ERROR "{" @indent.align (#set! indent.open_delimiter "{") (#set! indent.close_delimiter "}") . (_)) +(ERROR + "{" @indent.align + (#set! indent.open_delimiter "{") + (#set! indent.close_delimiter "}") + . + (_)) [ (break_statement) @@ -84,22 +108,37 @@ ] @indent.dedent (ERROR - (_) @indent.branch ":" . + (_) @indent.branch + ":" + . (#lua-match? @indent.branch "^else")) (ERROR - (_) @indent.branch @indent.dedent ":" . + (_) @indent.branch @indent.dedent + ":" + . (#lua-match? @indent.branch "^elif")) -(parenthesized_expression ")" @indent.end) -(generator_expression ")" @indent.end) -(list_comprehension "]" @indent.end) -(set_comprehension "}" @indent.end) -(dictionary_comprehension "}" @indent.end) +(parenthesized_expression + ")" @indent.end) + +(generator_expression + ")" @indent.end) -(tuple_pattern ")" @indent.end) -(list_pattern "]" @indent.end) +(list_comprehension + "]" @indent.end) +(set_comprehension + "}" @indent.end) + +(dictionary_comprehension + "}" @indent.end) + +(tuple_pattern + ")" @indent.end) + +(list_pattern + "]" @indent.end) (return_statement [ @@ -111,10 +150,12 @@ "}" "]" ] @indent.end .) - (attribute + (attribute attribute: (_) @indent.end) (call - arguments: (_ ")" @indent.end)) + arguments: + (_ + ")" @indent.end)) "return" @indent.end ] .) @@ -129,4 +170,3 @@ ] @indent.branch (string) @indent.auto - diff --git a/queries/python/injections.scm b/queries/python/injections.scm index 87d1c3478..3db20929e 100644 --- a/queries/python/injections.scm +++ b/queries/python/injections.scm @@ -1,15 +1,21 @@ (call - function: (attribute - object: (identifier) @_re) - arguments: (argument_list . (string - (string_content) @injection.content)) + function: + (attribute + object: (identifier) @_re) + arguments: + (argument_list + . + (string + (string_content) @injection.content)) (#eq? @_re "re") (#set! injection.language "regex")) ((binary_operator - left: (string (string_content) @injection.content) + left: + (string + (string_content) @injection.content) operator: "%") - (#set! injection.language "printf")) + (#set! injection.language "printf")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/python/locals.scm b/queries/python/locals.scm index 40c57dd44..80b4021c1 100644 --- a/queries/python/locals.scm +++ b/queries/python/locals.scm @@ -1,25 +1,35 @@ -;;; Program structure +; Program structure (module) @local.scope (class_definition - body: (block - (expression_statement - (assignment - left: (identifier) @local.definition.field)))) @local.scope + body: + (block + (expression_statement + (assignment + left: (identifier) @local.definition.field)))) @local.scope + (class_definition - body: (block - (expression_statement - (assignment - left: (_ - (identifier) @local.definition.field))))) @local.scope + body: + (block + (expression_statement + (assignment + left: + (_ + (identifier) @local.definition.field))))) @local.scope ; Imports (aliased_import alias: (identifier) @local.definition.import) + (import_statement - name: (dotted_name ((identifier) @local.definition.import))) + name: + (dotted_name + ((identifier) @local.definition.import))) + (import_from_statement - name: (dotted_name ((identifier) @local.definition.import))) + name: + (dotted_name + ((identifier) @local.definition.import))) ; Function with parameters, defines parameters (parameters @@ -47,69 +57,81 @@ ; Function defines function and scope ((function_definition name: (identifier) @local.definition.function) @local.scope - (#set! definition.function.scope "parent")) - + (#set! definition.function.scope "parent")) ((class_definition name: (identifier) @local.definition.type) @local.scope - (#set! definition.type.scope "parent")) + (#set! definition.type.scope "parent")) (class_definition - body: (block - (function_definition - name: (identifier) @local.definition.method))) + body: + (block + (function_definition + name: (identifier) @local.definition.method))) -;;; Loops +; Loops ; not a scope! (for_statement - left: (pattern_list - (identifier) @local.definition.var)) + left: + (pattern_list + (identifier) @local.definition.var)) + (for_statement - left: (tuple_pattern - (identifier) @local.definition.var)) + left: + (tuple_pattern + (identifier) @local.definition.var)) + (for_statement left: (identifier) @local.definition.var) ; not a scope! ;(while_statement) @local.scope - ; for in list comprehension (for_in_clause left: (identifier) @local.definition.var) + (for_in_clause - left: (tuple_pattern - (identifier) @local.definition.var)) + left: + (tuple_pattern + (identifier) @local.definition.var)) + (for_in_clause - left: (pattern_list - (identifier) @local.definition.var)) + left: + (pattern_list + (identifier) @local.definition.var)) (dictionary_comprehension) @local.scope + (list_comprehension) @local.scope -(set_comprehension) @local.scope -;;; Assignments +(set_comprehension) @local.scope +; Assignments (assignment - left: (identifier) @local.definition.var) + left: (identifier) @local.definition.var) (assignment - left: (pattern_list - (identifier) @local.definition.var)) + left: + (pattern_list + (identifier) @local.definition.var)) + (assignment - left: (tuple_pattern - (identifier) @local.definition.var)) + left: + (tuple_pattern + (identifier) @local.definition.var)) (assignment - left: (attribute - (identifier) - (identifier) @local.definition.field)) + left: + (attribute + (identifier) + (identifier) @local.definition.field)) ; Walrus operator x := 1 (named_expression (identifier) @local.definition.var) -(as_pattern +(as_pattern alias: (as_pattern_target) @local.definition.var) -;;; REFERENCES +; REFERENCES (identifier) @local.reference diff --git a/queries/ql/folds.scm b/queries/ql/folds.scm index 1a31eeb20..eb7f27273 100644 --- a/queries/ql/folds.scm +++ b/queries/ql/folds.scm @@ -1,7 +1,7 @@ [ - (module) - (classlessPredicate) - (dataclass) - (charpred) - (memberPredicate) + (module) + (classlessPredicate) + (dataclass) + (charpred) + (memberPredicate) ] @fold diff --git a/queries/ql/highlights.scm b/queries/ql/highlights.scm index d7d9500b0..39b7bc101 100644 --- a/queries/ql/highlights.scm +++ b/queries/ql/highlights.scm @@ -11,7 +11,6 @@ "order" "select" "where" - (predicate) (result) (specialId) @@ -106,26 +105,43 @@ "|" ] @punctuation.delimiter -(moduleExpr (simpleId) @module) -(module name: (moduleName) @module) +(moduleExpr + (simpleId) @module) + +(module + name: (moduleName) @module) + +(dataclass + name: (className) @type) + +(typeExpr + name: (className) @type) -(dataclass name: (className) @type) -(typeExpr name: (className) @type) +(datatype + name: (className) @type.definition) -(datatype name: (className) @type.definition) +(importModuleExpr + qualName: (simpleId) @variable) -(importModuleExpr qualName: (simpleId) @variable) (varName) @variable (integer) @number + (float) @number.float (string) @string -(aritylessPredicateExpr (literalId) @function) -(memberPredicate name: (predicateName) @function) -(classlessPredicate name: (predicateName) @function) -(charpred (className) @function) +(aritylessPredicateExpr + (literalId) @function) + +(memberPredicate + name: (predicateName) @function) + +(classlessPredicate + name: (predicateName) @function) + +(charpred + (className) @function) [ (line_comment) diff --git a/queries/ql/injections.scm b/queries/ql/injections.scm index baed9196d..090116c89 100644 --- a/queries/ql/injections.scm +++ b/queries/ql/injections.scm @@ -2,5 +2,5 @@ (line_comment) (block_comment) (qldoc) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) diff --git a/queries/ql/locals.scm b/queries/ql/locals.scm index f9b1195ae..239420151 100644 --- a/queries/ql/locals.scm +++ b/queries/ql/locals.scm @@ -1,30 +1,49 @@ ; SCOPES (module) @local.scope + (dataclass) @local.scope + (datatype) @local.scope -;; TODO does not work + +; TODO does not work ;(classMember (body) @local.scope) -(memberPredicate (body) @local.scope) -(classlessPredicate (body) @local.scope) -(quantified (conjunction) @local.scope) +(memberPredicate + (body) @local.scope) + +(classlessPredicate + (body) @local.scope) + +(quantified + (conjunction) @local.scope) + (select) @local.scope ; DEFINITIONS - ; module -(module name: (moduleName) @local.definition.namespace) +(module + name: (moduleName) @local.definition.namespace) ; classes -(dataclass name: (className) @local.definition.type) -(datatype name: (className) @local.definition.type) +(dataclass + name: (className) @local.definition.type) + +(datatype + name: (className) @local.definition.type) ; predicates -(charpred (className) @local.definition.method) -(memberPredicate name: (predicateName) @local.definition.method) -(classlessPredicate name: (predicateName) @local.definition.function) +(charpred + (className) @local.definition.method) + +(memberPredicate + name: (predicateName) @local.definition.method) + +(classlessPredicate + name: (predicateName) @local.definition.function) ; variables -(varDecl (varName (simpleId) @local.definition.var)) +(varDecl + (varName + (simpleId) @local.definition.var)) ; REFERENCES (simpleId) @local.reference diff --git a/queries/qmldir/highlights.scm b/queries/qmldir/highlights.scm index a716e8c9e..780dbb3d4 100644 --- a/queries/qmldir/highlights.scm +++ b/queries/qmldir/highlights.scm @@ -1,24 +1,20 @@ ; Preproc - -(command (identifier) @keyword.directive) +(command + (identifier) @keyword.directive) ; Keywords - (keyword) @keyword ; Literals - (number) @number (float) @number.float ; Variables - [ (identifier) (unit) ] @variable ; Comments - (comment) @comment @spell diff --git a/queries/qmldir/injections.scm b/queries/qmldir/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/qmldir/injections.scm +++ b/queries/qmldir/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/qmljs/highlights.scm b/queries/qmljs/highlights.scm index 0b15f46cf..a6a17b25a 100644 --- a/queries/qmljs/highlights.scm +++ b/queries/qmljs/highlights.scm @@ -1,39 +1,44 @@ ; inherits: ecma - "pragma" @keyword.import -;;; Annotations - +; Annotations (ui_annotation "@" @operator - type_name: [ - (identifier) @attribute - (nested_identifier (identifier) @attribute) - ]) + type_name: + [ + (identifier) @attribute + (nested_identifier + (identifier) @attribute) + ]) -;; type -(ui_property +; type +(ui_property type: (type_identifier) @type) -;;; Properties - +; Properties (ui_object_definition_binding - name: [ - (identifier) @property - (nested_identifier (identifier) @property) - ]) + name: + [ + (identifier) @property + (nested_identifier + (identifier) @property) + ]) (ui_binding - name: [ - (identifier) @property - (nested_identifier (identifier) @property) - ]) + name: + [ + (identifier) @property + (nested_identifier + (identifier) @property) + ]) -;; locals query appears not working unless id: <ref> isn't a parameter. +; locals query appears not working unless id: <ref> isn't a parameter. (ui_binding name: (identifier) @property (#eq? @property "id") - value: (expression_statement (identifier) @variable)) + value: + (expression_statement + (identifier) @variable)) (ui_property name: (identifier) @property) @@ -42,47 +47,44 @@ name: (identifier) @property) (ui_list_property_type - ["<" ">"] @punctuation.bracket) - -;;; Signals + [ + "<" + ">" + ] @punctuation.bracket) +; Signals (ui_signal name: (identifier) @function) (ui_signal_parameter (identifier) @variable) -;;; ui_object_definition +; ui_object_definition (ui_object_definition type_name: (identifier) @type) + (ui_object_definition type_name: (nested_identifier) @type) -;;; namespace +; namespace (nested_identifier (nested_identifier - (identifier) @module) -) + (identifier) @module)) ; Properties ;----------- - (property_identifier) @property -;;; function +; function (call_expression - function: (member_expression - object: (identifier) @variable - property:(property_identifier) @function - ) -) -;;; js - - + function: + (member_expression + object: (identifier) @variable + property: (property_identifier) @function)) +; js ; Literals ;--------- - [ (true) (false) @@ -101,26 +103,24 @@ ] @string (regex) @string.regexp + (number) @number ; Tokens ;------- - [ "abstract" - "private" "protected" "public" - "default" "readonly" "required" ] @type.qualifier ; from typescript - (type_identifier) @type + (predefined_type) @type.builtin ((identifier) @type @@ -131,12 +131,13 @@ ">" @punctuation.bracket) ; Variables +(required_parameter + (identifier) @variable) -(required_parameter (identifier) @variable) -(optional_parameter (identifier) @variable) +(optional_parameter + (identifier) @variable) ; Keywords - [ "on" "property" diff --git a/queries/query/highlights.scm b/queries/query/highlights.scm index 8601b1365..cdedb23e2 100644 --- a/queries/query/highlights.scm +++ b/queries/query/highlights.scm @@ -1,14 +1,30 @@ (string) @string + (escape_sequence) @string.escape -(capture (identifier) @type) -(anonymous_node (identifier) @string) -(predicate name: (identifier) @function.call) -(named_node name: (identifier) @variable) -(field_definition name: (identifier) @property) -(negated_field "!" @operator (identifier) @property) + +(capture + (identifier) @type) + +(anonymous_node + (identifier) @string) + +(predicate + name: (identifier) @function.call) + +(named_node + name: (identifier) @variable) + +(field_definition + name: (identifier) @property) + +(negated_field + "!" @operator + (identifier) @property) + (comment) @comment @spell (quantifier) @operator + (predicate_type) @punctuation.special "." @operator @@ -21,33 +37,51 @@ ] @punctuation.bracket ":" @punctuation.delimiter -["@" "#"] @punctuation.special + +[ + "@" + "#" +] @punctuation.special + "_" @constant -((parameters (identifier) @number) - (#match? @number "^[-+]?[0-9]+(.[0-9]+)?$")) +((parameters + (identifier) @number) + (#match? @number "^[-+]?[0-9]+(.[0-9]+)?$")) -((program . (comment)* . (comment) @keyword.import) - (#lua-match? @keyword.import "^;+ *inherits *:")) +((program + . + (comment)* + . + (comment) @keyword.import) + (#lua-match? @keyword.import "^;+ *inherits *:")) -((program . (comment)* . (comment) @keyword.directive) - (#lua-match? @keyword.directive "^;+ *extends *$")) +((program + . + (comment)* + . + (comment) @keyword.directive) + (#lua-match? @keyword.directive "^;+ *extends *$")) ((comment) @keyword.directive (#lua-match? @keyword.directive "^;+%s*format%-ignore%s*$")) ((predicate name: (identifier) @_name - parameters: (parameters (string "\"" @string "\"" @string) @string.regexp)) - (#any-of? @_name - "match" - "not-match" - "vim-match" - "not-vim-match" - "lua-match" - "not-lua-match")) + parameters: + (parameters + (string + "\"" @string + "\"" @string) @string.regexp)) + (#any-of? @_name "match" "not-match" "vim-match" "not-vim-match" "lua-match" "not-lua-match")) ((predicate name: (identifier) @_name - parameters: (parameters (string "\"" @string "\"" @string) @string.regexp . (string) .)) - (#any-of? @_name "gsub" "not-gsub")) + parameters: + (parameters + (string + "\"" @string + "\"" @string) @string.regexp + . + (string) .)) + (#any-of? @_name "gsub" "not-gsub")) diff --git a/queries/query/indents.scm b/queries/query/indents.scm index 0ee125be7..925d77060 100644 --- a/queries/query/indents.scm +++ b/queries/query/indents.scm @@ -1,12 +1,8 @@ -[ - (list) -] @indent.begin +(list) @indent.begin [ "[" "]" ] @indent.begin -[ - "]" -] @indent.branch +"]" @indent.branch diff --git a/queries/query/injections.scm b/queries/query/injections.scm index 150919ec0..dd1a8556c 100644 --- a/queries/query/injections.scm +++ b/queries/query/injections.scm @@ -1,23 +1,31 @@ -((predicate +((predicate name: (identifier) @_name - parameters: (parameters (string) @injection.content)) - (#any-of? @_name "match" "not-match" "vim-match" "not-vim-match") - (#set! injection.language "regex") - (#offset! @injection.content 0 1 0 -1)) + parameters: + (parameters + (string) @injection.content)) + (#any-of? @_name "match" "not-match" "vim-match" "not-vim-match") + (#set! injection.language "regex") + (#offset! @injection.content 0 1 0 -1)) ((predicate name: (identifier) @_name - parameters: (parameters (string) @injection.content)) - (#any-of? @_name "lua-match" "not-lua-match") - (#set! injection.language "luap") - (#offset! @injection.content 0 1 0 -1)) + parameters: + (parameters + (string) @injection.content)) + (#any-of? @_name "lua-match" "not-lua-match") + (#set! injection.language "luap") + (#offset! @injection.content 0 1 0 -1)) ((predicate - name: (identifier) @_name - parameters: (parameters (string) @injection.content . (string) .)) - (#any-of? @_name "gsub" "not-gsub") - (#set! injection.language "luap") - (#offset! @injection.content 0 1 0 -1)) + name: (identifier) @_name + parameters: + (parameters + (string) @injection.content + . + (string) .)) + (#any-of? @_name "gsub" "not-gsub") + (#set! injection.language "luap") + (#offset! @injection.content 0 1 0 -1)) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/query/locals.scm b/queries/query/locals.scm index 21d5fd7c9..eca196aba 100644 --- a/queries/query/locals.scm +++ b/queries/query/locals.scm @@ -1,7 +1,13 @@ (program) @local.scope -(program (named_node) @local.scope) -(program (anonymous_node) @local.scope) -(program (grouping) @local.scope) + +(program + (named_node) @local.scope) + +(program + (anonymous_node) @local.scope) + +(program + (grouping) @local.scope) (identifier) @local.reference diff --git a/queries/r/highlights.scm b/queries/r/highlights.scm index 03cf01bd7..cbb87f033 100755 --- a/queries/r/highlights.scm +++ b/queries/r/highlights.scm @@ -1,5 +1,4 @@ ; highlights.scm - ; Literals (integer) @number @@ -8,96 +7,114 @@ (complex) @number (string) @string -(string (escape_sequence) @string.escape) + +(string + (escape_sequence) @string.escape) (comment) @comment @spell -((program . (comment) @keyword.directive) +((program + . + (comment) @keyword.directive) (#lua-match? @keyword.directive "^#!/")) (identifier) @variable -((dollar (identifier) @variable.builtin) - (#eq? @variable.builtin "self")) +((dollar + (identifier) @variable.builtin) + (#eq? @variable.builtin "self")) -((dollar _ (identifier) @variable.member)) +((dollar + _ + (identifier) @variable.member)) ; Parameters - -(formal_parameters (identifier) @variable.parameter) +(formal_parameters + (identifier) @variable.parameter) (formal_parameters - (default_parameter name: (identifier) @variable.parameter)) + (default_parameter + name: (identifier) @variable.parameter)) -(default_argument name: (identifier) @variable.parameter) +(default_argument + name: (identifier) @variable.parameter) ; Namespace +(namespace_get + namespace: (identifier) @module) -(namespace_get namespace: (identifier) @module) -(namespace_get_internal namespace: (identifier) @module) +(namespace_get_internal + namespace: (identifier) @module) ; Operators [ - "=" - "<-" - "<<-" - "->" + "=" + "<-" + "<<-" + "->" ] @operator -(unary operator: [ - "-" - "+" - "!" - "~" - "?" -] @operator) +(unary + operator: + [ + "-" + "+" + "!" + "~" + "?" + ] @operator) -(binary operator: [ - "-" - "+" - "*" - "/" - "^" - "<" - ">" - "<=" - ">=" - "==" - "!=" - "||" - "|" - "&&" - "&" - ":" - "~" -] @operator) +(binary + operator: + [ + "-" + "+" + "*" + "/" + "^" + "<" + ">" + "<=" + ">=" + "==" + "!=" + "||" + "|" + "&&" + "&" + ":" + "~" + ] @operator) [ "|>" (special) ] @operator -(lambda_function "\\" @operator) +(lambda_function + "\\" @operator) [ - "(" - ")" - "[" - "]" - "{" - "}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket -(dollar _ "$" @operator) +(dollar + _ + "$" @operator) (subset2 "[[" @punctuation.bracket "]]" @punctuation.bracket) [ - (dots) - (break) - (next) + (dots) + (break) + (next) ] @keyword [ @@ -128,14 +145,19 @@ "function" @keyword.function ; Functions/Methods - -(call function: (identifier) @function.call) +(call + function: (identifier) @function.call) (call - (namespace_get function: (identifier) @function.call)) + (namespace_get + function: (identifier) @function.call)) (call - (namespace_get_internal function: (identifier) @function.call)) + (namespace_get_internal + function: (identifier) @function.call)) (call - function: ((dollar _ (identifier) @function.method.call))) + function: + ((dollar + _ + (identifier) @function.method.call))) diff --git a/queries/r/indents.scm b/queries/r/indents.scm index 3b9e495ad..742b645e2 100644 --- a/queries/r/indents.scm +++ b/queries/r/indents.scm @@ -12,22 +12,22 @@ "for" ] @indent.begin -((binary operator: (special)) @indent.begin) +((binary + operator: (special)) @indent.begin) [ "}" ")" ] @indent.branch -((formal_parameters (identifier)) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) +((formal_parameters + (identifier)) @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) [ ")" "}" ] @indent.end -[ - (comment) -] @indent.ignore +(comment) @indent.ignore diff --git a/queries/r/injections.scm b/queries/r/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/r/injections.scm +++ b/queries/r/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/r/locals.scm b/queries/r/locals.scm index 38977b7b7..e98f773f5 100755 --- a/queries/r/locals.scm +++ b/queries/r/locals.scm @@ -1,11 +1,16 @@ ; locals.scm - (function_definition) @local.scope -(formal_parameters (identifier) @local.definition.parameter) +(formal_parameters + (identifier) @local.definition.parameter) + +(left_assignment + name: (identifier) @local.definition) + +(equals_assignment + name: (identifier) @local.definition) -(left_assignment name: (identifier) @local.definition) -(equals_assignment name: (identifier) @local.definition) -(right_assignment name: (identifier) @local.definition) +(right_assignment + name: (identifier) @local.definition) (identifier) @local.reference diff --git a/queries/racket/folds.scm b/queries/racket/folds.scm index 64a9a08e6..115809a77 100644 --- a/queries/racket/folds.scm +++ b/queries/racket/folds.scm @@ -1 +1,2 @@ -(program (list) @fold) +(program + (list) @fold) diff --git a/queries/racket/highlights.scm b/queries/racket/highlights.scm index fdd392077..2de4d2efa 100644 --- a/queries/racket/highlights.scm +++ b/queries/racket/highlights.scm @@ -1,133 +1,120 @@ -;; A highlight query can override the highlights queries before it. -;; So the order is important. -;; We should highlight general rules, then highlight special forms. - -;;------------------------------------------------------------------;; -;; Basic highlights ;; -;;------------------------------------------------------------------;; - -;; basic ;; - +; A highlight query can override the highlights queries before it. +; So the order is important. +; We should highlight general rules, then highlight special forms. +;------------------------------------------------------------------;; +; Basic highlights ;; +;------------------------------------------------------------------;; +; basic ;; (number) @number + (character) @character + (boolean) @boolean -(keyword) @string.special.symbol -;; string ;; +(keyword) @string.special.symbol -[(string) - (here_string) - (byte_string)] @string +; string ;; +[ + (string) + (here_string) + (byte_string) +] @string (escape_sequence) @string.escape (regex) @string.regexp -;; comment ;; - -[(comment) - (block_comment) - (sexp_comment)] @comment +; comment ;; +[ + (comment) + (block_comment) + (sexp_comment) +] @comment -[(comment) - (block_comment)] @spell - -;; symbol ;; +[ + (comment) + (block_comment) +] @spell +; symbol ;; (symbol) @variable ((symbol) @comment - (#lua-match? @comment "^#[cC][iIsS]$")) - -;; extension ;; + (#lua-match? @comment "^#[cC][iIsS]$")) +; extension ;; (extension) @keyword -(lang_name) @variable.builtin -;; quote ;; +(lang_name) @variable.builtin +; quote ;; (quote) @string.special.symbol -;; list ;; - -["(" ")" "[" "]" "{" "}"] @punctuation.bracket - -;; procedure ;; +; list ;; +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket +; procedure ;; (list - . - (symbol) @function) - -;;------------------------------------------------------------------;; -;; Builtin highlights ;; -;;------------------------------------------------------------------;; - -;; The following lists are generated by a racket script: -;; https://gist.github.com/6cdh/65619e761753eb4166d15185a6236040 -;; Don't edit them directly. - -;; keyword ;; + . + (symbol) @function) +;------------------------------------------------------------------;; +; Builtin highlights ;; +;------------------------------------------------------------------;; +; The following lists are generated by a racket script: +; https://gist.github.com/6cdh/65619e761753eb4166d15185a6236040 +; Don't edit them directly. +; keyword ;; (list . (symbol) @keyword - (#any-of? @keyword - "#%app" "#%datum" "#%declare" "#%expression" "#%module-begin" "#%plain-app" "#%plain-lambda" "#%plain-module-begin" "#%printing-module-begin" "#%provide" "#%require" "#%stratified-body" "#%top" "#%top-interaction" "#%variable-reference" "->" "->*" "->*m" "->d" "->dm" "->i" "->m" "..." ":do-in" "==" "=>" "_" "absent" "abstract" "all-defined-out" "all-from-out" "and" "any" "augment" "augment*" "augment-final" "augment-final*" "augride" "augride*" "begin" "begin-for-syntax" "begin0" "case" "case->" "case->m" "case-lambda" "class" "class*" "class-field-accessor" "class-field-mutator" "class/c" "class/derived" "combine-in" "combine-out" "command-line" "compound-unit" "compound-unit/infer" "cond" "cons/dc" "contract" "contract-out" "contract-pos/neg-doubling" "contract-struct" "contracted" "current-contract-region" "define" "define-compound-unit" "define-compound-unit/infer" "define-contract-struct" "define-custom-hash-types" "define-custom-set-types" "define-for-syntax" "define-local-member-name" "define-logger" "define-match-expander" "define-member-name" "define-module-boundary-contract" "define-namespace-anchor" "define-opt/c" "define-sequence-syntax" "define-serializable-class" "define-serializable-class*" "define-signature" "define-signature-form" "define-splicing-for-clause-syntax" "define-struct" "define-struct/contract" "define-struct/derived" "define-syntax" "define-syntax-rule" "define-syntaxes" "define-unit" "define-unit-binding" "define-unit-from-context" "define-unit/contract" "define-unit/new-import-export" "define-unit/s" "define-values" "define-values-for-export" "define-values-for-syntax" "define-values/invoke-unit" "define-values/invoke-unit/infer" "define/augment" "define/augment-final" "define/augride" "define/contract" "define/final-prop" "define/match" "define/overment" "define/override" "define/override-final" "define/private" "define/public" "define/public-final" "define/pubment" "define/subexpression-pos-prop" "define/subexpression-pos-prop/name" "delay" "delay/idle" "delay/name" "delay/strict" "delay/sync" "delay/thread" "do" "else" "except" "except-in" "except-out" "export" "extends" "failure-cont" "field" "field-bound?" "file" "flat-murec-contract" "flat-rec-contract" "for" "for*" "for*/and" "for*/async" "for*/first" "for*/fold" "for*/fold/derived" "for*/foldr" "for*/foldr/derived" "for*/hash" "for*/hasheq" "for*/hasheqv" "for*/last" "for*/list" "for*/lists" "for*/mutable-set" "for*/mutable-seteq" "for*/mutable-seteqv" "for*/or" "for*/product" "for*/set" "for*/seteq" "for*/seteqv" "for*/stream" "for*/sum" "for*/vector" "for*/weak-set" "for*/weak-seteq" "for*/weak-seteqv" "for-label" "for-meta" "for-space" "for-syntax" "for-template" "for/and" "for/async" "for/first" "for/fold" "for/fold/derived" "for/foldr" "for/foldr/derived" "for/hash" "for/hasheq" "for/hasheqv" "for/last" "for/list" "for/lists" "for/mutable-set" "for/mutable-seteq" "for/mutable-seteqv" "for/or" "for/product" "for/set" "for/seteq" "for/seteqv" "for/stream" "for/sum" "for/vector" "for/weak-set" "for/weak-seteq" "for/weak-seteqv" "gen:custom-write" "gen:dict" "gen:equal+hash" "gen:set" "gen:stream" "generic" "get-field" "hash/dc" "if" "implies" "import" "include" "include-at/relative-to" "include-at/relative-to/reader" "include/reader" "inherit" "inherit-field" "inherit/inner" "inherit/super" "init" "init-depend" "init-field" "init-rest" "inner" "inspect" "instantiate" "interface" "interface*" "invariant-assertion" "invoke-unit" "invoke-unit/infer" "lambda" "lazy" "let" "let*" "let*-values" "let-syntax" "let-syntaxes" "let-values" "let/cc" "let/ec" "letrec" "letrec-syntax" "letrec-syntaxes" "letrec-syntaxes+values" "letrec-values" "lib" "link" "local" "local-require" "log-debug" "log-error" "log-fatal" "log-info" "log-warning" "match" "match*" "match*/derived" "match-define" "match-define-values" "match-lambda" "match-lambda*" "match-lambda**" "match-let" "match-let*" "match-let*-values" "match-let-values" "match-letrec" "match-letrec-values" "match/derived" "match/values" "member-name-key" "mixin" "module" "module*" "module+" "nand" "new" "nor" "object-contract" "object/c" "only" "only-in" "only-meta-in" "only-space-in" "open" "opt/c" "or" "overment" "overment*" "override" "override*" "override-final" "override-final*" "parameterize" "parameterize*" "parameterize-break" "parametric->/c" "place" "place*" "place/context" "planet" "prefix" "prefix-in" "prefix-out" "private" "private*" "prompt-tag/c" "prop:dict/contract" "protect-out" "provide" "provide-signature-elements" "provide/contract" "public" "public*" "public-final" "public-final*" "pubment" "pubment*" "quasiquote" "quasisyntax" "quasisyntax/loc" "quote" "quote-syntax" "quote-syntax/prune" "recontract-out" "recursive-contract" "relative-in" "rename" "rename-in" "rename-inner" "rename-out" "rename-super" "require" "send" "send*" "send+" "send-generic" "send/apply" "send/keyword-apply" "set!" "set!-values" "set-field!" "shared" "stream" "stream*" "stream-cons" "stream-lazy" "struct" "struct*" "struct-copy" "struct-field-index" "struct-guard/c" "struct-out" "struct/c" "struct/contract" "struct/ctc" "struct/dc" "struct/derived" "submod" "super" "super-instantiate" "super-make-object" "super-new" "syntax" "syntax-case" "syntax-case*" "syntax-id-rules" "syntax-rules" "syntax/loc" "tag" "this" "this%" "thunk" "thunk*" "time" "unconstrained-domain->" "unit" "unit-from-context" "unit/c" "unit/new-import-export" "unit/s" "unless" "unquote" "unquote-splicing" "unsyntax" "unsyntax-splicing" "values/drop" "when" "with-continuation-mark" "with-contract" "with-contract-continuation-mark" "with-handlers" "with-handlers*" "with-method" "with-syntax" "~?" "~@" "λ" - )) - -;; builtin procedures - + (#any-of? @keyword "#%app" "#%datum" "#%declare" "#%expression" "#%module-begin" "#%plain-app" "#%plain-lambda" "#%plain-module-begin" "#%printing-module-begin" "#%provide" "#%require" "#%stratified-body" "#%top" "#%top-interaction" "#%variable-reference" "->" "->*" "->*m" "->d" "->dm" "->i" "->m" "..." ":do-in" "==" "=>" "_" "absent" "abstract" "all-defined-out" "all-from-out" "and" "any" "augment" "augment*" "augment-final" "augment-final*" "augride" "augride*" "begin" "begin-for-syntax" "begin0" "case" "case->" "case->m" "case-lambda" "class" "class*" "class-field-accessor" "class-field-mutator" "class/c" "class/derived" "combine-in" "combine-out" "command-line" "compound-unit" "compound-unit/infer" "cond" "cons/dc" "contract" "contract-out" "contract-pos/neg-doubling" "contract-struct" "contracted" "current-contract-region" "define" "define-compound-unit" "define-compound-unit/infer" "define-contract-struct" "define-custom-hash-types" "define-custom-set-types" "define-for-syntax" "define-local-member-name" "define-logger" "define-match-expander" "define-member-name" "define-module-boundary-contract" "define-namespace-anchor" "define-opt/c" "define-sequence-syntax" "define-serializable-class" "define-serializable-class*" "define-signature" "define-signature-form" "define-splicing-for-clause-syntax" "define-struct" "define-struct/contract" "define-struct/derived" "define-syntax" "define-syntax-rule" "define-syntaxes" "define-unit" "define-unit-binding" "define-unit-from-context" "define-unit/contract" "define-unit/new-import-export" "define-unit/s" "define-values" "define-values-for-export" "define-values-for-syntax" "define-values/invoke-unit" "define-values/invoke-unit/infer" "define/augment" "define/augment-final" "define/augride" "define/contract" "define/final-prop" "define/match" "define/overment" "define/override" "define/override-final" "define/private" "define/public" "define/public-final" "define/pubment" "define/subexpression-pos-prop" "define/subexpression-pos-prop/name" "delay" "delay/idle" "delay/name" "delay/strict" "delay/sync" "delay/thread" "do" "else" "except" "except-in" "except-out" "export" "extends" "failure-cont" "field" "field-bound?" "file" "flat-murec-contract" "flat-rec-contract" "for" "for*" "for*/and" "for*/async" "for*/first" "for*/fold" "for*/fold/derived" "for*/foldr" "for*/foldr/derived" "for*/hash" "for*/hasheq" "for*/hasheqv" "for*/last" "for*/list" "for*/lists" "for*/mutable-set" "for*/mutable-seteq" "for*/mutable-seteqv" "for*/or" "for*/product" "for*/set" "for*/seteq" "for*/seteqv" "for*/stream" "for*/sum" "for*/vector" "for*/weak-set" "for*/weak-seteq" "for*/weak-seteqv" "for-label" "for-meta" "for-space" "for-syntax" "for-template" "for/and" "for/async" "for/first" "for/fold" "for/fold/derived" "for/foldr" "for/foldr/derived" "for/hash" "for/hasheq" "for/hasheqv" "for/last" "for/list" "for/lists" "for/mutable-set" "for/mutable-seteq" "for/mutable-seteqv" "for/or" "for/product" "for/set" "for/seteq" "for/seteqv" "for/stream" "for/sum" "for/vector" "for/weak-set" "for/weak-seteq" "for/weak-seteqv" "gen:custom-write" "gen:dict" "gen:equal+hash" "gen:set" "gen:stream" "generic" "get-field" "hash/dc" "if" "implies" "import" "include" "include-at/relative-to" "include-at/relative-to/reader" "include/reader" "inherit" "inherit-field" "inherit/inner" "inherit/super" "init" "init-depend" "init-field" "init-rest" "inner" "inspect" "instantiate" "interface" "interface*" "invariant-assertion" "invoke-unit" "invoke-unit/infer" "lambda" "lazy" "let" "let*" "let*-values" "let-syntax" "let-syntaxes" "let-values" "let/cc" "let/ec" "letrec" "letrec-syntax" "letrec-syntaxes" "letrec-syntaxes+values" "letrec-values" "lib" "link" "local" "local-require" "log-debug" "log-error" "log-fatal" "log-info" "log-warning" "match" "match*" "match*/derived" "match-define" "match-define-values" "match-lambda" "match-lambda*" "match-lambda**" "match-let" "match-let*" "match-let*-values" "match-let-values" "match-letrec" "match-letrec-values" "match/derived" "match/values" "member-name-key" "mixin" "module" "module*" "module+" "nand" "new" "nor" "object-contract" "object/c" "only" "only-in" "only-meta-in" "only-space-in" "open" "opt/c" "or" "overment" "overment*" "override" "override*" "override-final" "override-final*" "parameterize" "parameterize*" "parameterize-break" "parametric->/c" "place" "place*" "place/context" "planet" "prefix" "prefix-in" "prefix-out" "private" "private*" "prompt-tag/c" "prop:dict/contract" "protect-out" "provide" "provide-signature-elements" "provide/contract" "public" "public*" "public-final" "public-final*" "pubment" "pubment*" "quasiquote" "quasisyntax" "quasisyntax/loc" "quote" "quote-syntax" "quote-syntax/prune" "recontract-out" "recursive-contract" "relative-in" "rename" "rename-in" "rename-inner" "rename-out" "rename-super" "require" "send" "send*" "send+" "send-generic" "send/apply" "send/keyword-apply" "set!" "set!-values" "set-field!" "shared" "stream" "stream*" "stream-cons" "stream-lazy" "struct" "struct*" "struct-copy" "struct-field-index" "struct-guard/c" "struct-out" "struct/c" "struct/contract" "struct/ctc" "struct/dc" "struct/derived" "submod" "super" "super-instantiate" "super-make-object" "super-new" "syntax" "syntax-case" "syntax-case*" "syntax-id-rules" "syntax-rules" "syntax/loc" "tag" "this" "this%" "thunk" "thunk*" "time" "unconstrained-domain->" "unit" "unit-from-context" "unit/c" "unit/new-import-export" "unit/s" "unless" "unquote" "unquote-splicing" "unsyntax" "unsyntax-splicing" "values/drop" "when" "with-continuation-mark" "with-contract" "with-contract-continuation-mark" "with-handlers" "with-handlers*" "with-method" "with-syntax" "~?" "~@" "λ") + ) +; builtin procedures ((symbol) @function.builtin - (#any-of? @function.builtin - "*" "*list/c" "+" "-" "/" "<" "</c" "<=" "<=/c" "=" "=/c" ">" ">/c" ">=" ">=/c" "abort-current-continuation" "abs" "absolute-path?" "acos" "add-between" "add1" "alarm-evt" "and/c" "andmap" "angle" "any/c" "append" "append*" "append-map" "apply" "argmax" "argmin" "arithmetic-shift" "arity-at-least" "arity-at-least-value" "arity-at-least?" "arity-checking-wrapper" "arity-includes?" "arity=?" "arrow-contract-info" "arrow-contract-info-accepts-arglist" "arrow-contract-info-chaperone-procedure" "arrow-contract-info-check-first-order" "arrow-contract-info?" "asin" "assert-unreachable" "assf" "assoc" "assq" "assv" "atan" "bad-number-of-results" "banner" "base->-doms/c" "base->-rngs/c" "base->?" "between/c" "bitwise-and" "bitwise-bit-field" "bitwise-bit-set?" "bitwise-ior" "bitwise-not" "bitwise-xor" "blame-add-car-context" "blame-add-cdr-context" "blame-add-context" "blame-add-missing-party" "blame-add-nth-arg-context" "blame-add-range-context" "blame-add-unknown-context" "blame-context" "blame-contract" "blame-fmt->-string" "blame-missing-party?" "blame-negative" "blame-original?" "blame-positive" "blame-replace-negative" "blame-replaced-negative?" "blame-source" "blame-swap" "blame-swapped?" "blame-update" "blame-value" "blame?" "boolean=?" "boolean?" "bound-identifier=?" "box" "box-cas!" "box-immutable" "box-immutable/c" "box/c" "box?" "break-enabled" "break-parameterization?" "break-thread" "build-chaperone-contract-property" "build-compound-type-name" "build-contract-property" "build-flat-contract-property" "build-list" "build-path" "build-path/convention-type" "build-string" "build-vector" "byte-pregexp" "byte-pregexp?" "byte-ready?" "byte-regexp" "byte-regexp?" "byte?" "bytes" "bytes->immutable-bytes" "bytes->list" "bytes->path" "bytes->path-element" "bytes->string/latin-1" "bytes->string/locale" "bytes->string/utf-8" "bytes-append" "bytes-append*" "bytes-close-converter" "bytes-convert" "bytes-convert-end" "bytes-converter?" "bytes-copy" "bytes-copy!" "bytes-environment-variable-name?" "bytes-fill!" "bytes-join" "bytes-length" "bytes-no-nuls?" "bytes-open-converter" "bytes-ref" "bytes-set!" "bytes-utf-8-index" "bytes-utf-8-length" "bytes-utf-8-ref" "bytes<?" "bytes=?" "bytes>?" "bytes?" "caaaar" "caaadr" "caaar" "caadar" "caaddr" "caadr" "caar" "cadaar" "cadadr" "cadar" "caddar" "cadddr" "caddr" "cadr" "call-in-continuation" "call-in-nested-thread" "call-with-atomic-output-file" "call-with-break-parameterization" "call-with-composable-continuation" "call-with-continuation-barrier" "call-with-continuation-prompt" "call-with-current-continuation" "call-with-default-reading-parameterization" "call-with-escape-continuation" "call-with-exception-handler" "call-with-file-lock/timeout" "call-with-immediate-continuation-mark" "call-with-input-bytes" "call-with-input-file" "call-with-input-file*" "call-with-input-string" "call-with-output-bytes" "call-with-output-file" "call-with-output-file*" "call-with-output-string" "call-with-parameterization" "call-with-semaphore" "call-with-semaphore/enable-break" "call-with-values" "call/cc" "call/ec" "car" "cartesian-product" "cdaaar" "cdaadr" "cdaar" "cdadar" "cdaddr" "cdadr" "cdar" "cddaar" "cddadr" "cddar" "cdddar" "cddddr" "cdddr" "cddr" "cdr" "ceiling" "channel-get" "channel-put" "channel-put-evt" "channel-put-evt?" "channel-try-get" "channel/c" "channel?" "chaperone-box" "chaperone-channel" "chaperone-continuation-mark-key" "chaperone-contract-property?" "chaperone-contract?" "chaperone-evt" "chaperone-hash" "chaperone-hash-set" "chaperone-of?" "chaperone-procedure" "chaperone-procedure*" "chaperone-prompt-tag" "chaperone-struct" "chaperone-struct-type" "chaperone-vector" "chaperone-vector*" "chaperone?" "char->integer" "char-alphabetic?" "char-blank?" "char-ci<=?" "char-ci<?" "char-ci=?" "char-ci>=?" "char-ci>?" "char-downcase" "char-foldcase" "char-general-category" "char-graphic?" "char-in" "char-in/c" "char-iso-control?" "char-lower-case?" "char-numeric?" "char-punctuation?" "char-ready?" "char-symbolic?" "char-title-case?" "char-titlecase" "char-upcase" "char-upper-case?" "char-utf-8-length" "char-whitespace?" "char<=?" "char<?" "char=?" "char>=?" "char>?" "char?" "check-duplicate-identifier" "check-duplicates" "checked-procedure-check-and-extract" "choice-evt" "class->interface" "class-info" "class-seal" "class-unseal" "class?" "cleanse-path" "close-input-port" "close-output-port" "coerce-chaperone-contract" "coerce-chaperone-contracts" "coerce-contract" "coerce-contract/f" "coerce-contracts" "coerce-flat-contract" "coerce-flat-contracts" "collect-garbage" "collection-file-path" "collection-path" "combinations" "combine-output" "compile" "compile-allow-set!-undefined" "compile-context-preservation-enabled" "compile-enforce-module-constants" "compile-syntax" "compile-target-machine?" "compiled-expression-recompile" "compiled-expression?" "compiled-module-expression?" "complete-path?" "complex?" "compose" "compose1" "conjoin" "conjugate" "cons" "cons/c" "cons?" "const" "continuation-mark-key/c" "continuation-mark-key?" "continuation-mark-set->context" "continuation-mark-set->iterator" "continuation-mark-set->list" "continuation-mark-set->list*" "continuation-mark-set-first" "continuation-mark-set?" "continuation-marks" "continuation-prompt-available?" "continuation-prompt-tag?" "continuation?" "contract-custom-write-property-proc" "contract-equivalent?" "contract-exercise" "contract-first-order" "contract-first-order-passes?" "contract-late-neg-projection" "contract-name" "contract-proc" "contract-projection" "contract-property?" "contract-random-generate" "contract-random-generate-env?" "contract-random-generate-fail?" "contract-random-generate-get-current-environment" "contract-random-generate-stash" "contract-random-generate/choose" "contract-stronger?" "contract-struct-exercise" "contract-struct-generate" "contract-struct-late-neg-projection" "contract-struct-list-contract?" "contract-val-first-projection" "contract?" "convert-stream" "copy-directory/files" "copy-file" "copy-port" "cos" "cosh" "count" "current-blame-format" "current-break-parameterization" "current-code-inspector" "current-command-line-arguments" "current-compile" "current-compile-realm" "current-compile-target-machine" "current-compiled-file-roots" "current-continuation-marks" "current-custodian" "current-directory" "current-directory-for-user" "current-drive" "current-environment-variables" "current-error-message-adjuster" "current-error-port" "current-eval" "current-evt-pseudo-random-generator" "current-force-delete-permissions" "current-future" "current-gc-milliseconds" "current-get-interaction-evt" "current-get-interaction-input-port" "current-inexact-milliseconds" "current-inexact-monotonic-milliseconds" "current-input-port" "current-inspector" "current-library-collection-links" "current-library-collection-paths" "current-load" "current-load-extension" "current-load-relative-directory" "current-load/use-compiled" "current-locale" "current-logger" "current-memory-use" "current-milliseconds" "current-module-declare-name" "current-module-declare-source" "current-module-name-resolver" "current-module-path-for-load" "current-namespace" "current-output-port" "current-parameterization" "current-plumber" "current-preserved-thread-cell-values" "current-print" "current-process-milliseconds" "current-prompt-read" "current-pseudo-random-generator" "current-read-interaction" "current-reader-guard" "current-readtable" "current-seconds" "current-security-guard" "current-subprocess-custodian-mode" "current-subprocess-keep-file-descriptors" "current-thread" "current-thread-group" "current-thread-initial-stack-size" "current-write-relative-directory" "curry" "curryr" "custodian-box-value" "custodian-box?" "custodian-limit-memory" "custodian-managed-list" "custodian-memory-accounting-available?" "custodian-require-memory" "custodian-shut-down?" "custodian-shutdown-all" "custodian?" "custom-print-quotable-accessor" "custom-print-quotable?" "custom-write-accessor" "custom-write-property-proc" "custom-write?" "date" "date*" "date*-nanosecond" "date*-time-zone-name" "date*?" "date-day" "date-dst?" "date-hour" "date-minute" "date-month" "date-second" "date-time-zone-offset" "date-week-day" "date-year" "date-year-day" "date?" "datum->syntax" "datum-intern-literal" "default-continuation-prompt-tag" "degrees->radians" "delete-directory" "delete-directory/files" "delete-file" "denominator" "dict->list" "dict-can-functional-set?" "dict-can-remove-keys?" "dict-clear" "dict-clear!" "dict-copy" "dict-count" "dict-empty?" "dict-for-each" "dict-has-key?" "dict-implements/c" "dict-implements?" "dict-iter-contract" "dict-iterate-first" "dict-iterate-key" "dict-iterate-next" "dict-iterate-value" "dict-key-contract" "dict-keys" "dict-map" "dict-mutable?" "dict-ref" "dict-ref!" "dict-remove" "dict-remove!" "dict-set" "dict-set!" "dict-set*" "dict-set*!" "dict-update" "dict-update!" "dict-value-contract" "dict-values" "dict?" "directory-exists?" "directory-list" "disjoin" "display" "display-lines" "display-lines-to-file" "display-to-file" "displayln" "double-flonum?" "drop" "drop-common-prefix" "drop-right" "dropf" "dropf-right" "dump-memory-stats" "dup-input-port" "dup-output-port" "dynamic->*" "dynamic-get-field" "dynamic-object/c" "dynamic-place" "dynamic-place*" "dynamic-require" "dynamic-require-for-syntax" "dynamic-send" "dynamic-set-field!" "dynamic-wind" "eighth" "empty?" "environment-variables-copy" "environment-variables-names" "environment-variables-ref" "environment-variables-set!" "environment-variables?" "eof-evt" "eof-object?" "ephemeron-value" "ephemeron?" "eprintf" "eq-contract-val" "eq-contract?" "eq-hash-code" "eq?" "equal-contract-val" "equal-contract?" "equal-hash-code" "equal-secondary-hash-code" "equal?" "equal?/recur" "eqv-hash-code" "eqv?" "error" "error-contract->adjusted-string" "error-display-handler" "error-escape-handler" "error-message->adjusted-string" "error-print-context-length" "error-print-source-location" "error-print-width" "error-syntax->string-handler" "error-value->string-handler" "eval" "eval-jit-enabled" "eval-syntax" "even?" "evt/c" "evt?" "exact->inexact" "exact-ceiling" "exact-floor" "exact-integer?" "exact-nonnegative-integer?" "exact-positive-integer?" "exact-round" "exact-truncate" "exact?" "executable-yield-handler" "exit" "exit-handler" "exn" "exn-continuation-marks" "exn-message" "exn:break" "exn:break-continuation" "exn:break:hang-up" "exn:break:hang-up?" "exn:break:terminate" "exn:break:terminate?" "exn:break?" "exn:fail" "exn:fail:contract" "exn:fail:contract:arity" "exn:fail:contract:arity?" "exn:fail:contract:blame" "exn:fail:contract:blame-object" "exn:fail:contract:blame?" "exn:fail:contract:continuation" "exn:fail:contract:continuation?" "exn:fail:contract:divide-by-zero" "exn:fail:contract:divide-by-zero?" "exn:fail:contract:non-fixnum-result" "exn:fail:contract:non-fixnum-result?" "exn:fail:contract:variable" "exn:fail:contract:variable-id" "exn:fail:contract:variable?" "exn:fail:contract?" "exn:fail:filesystem" "exn:fail:filesystem:errno" "exn:fail:filesystem:errno-errno" "exn:fail:filesystem:errno?" "exn:fail:filesystem:exists" "exn:fail:filesystem:exists?" "exn:fail:filesystem:missing-module" "exn:fail:filesystem:missing-module-path" "exn:fail:filesystem:missing-module?" "exn:fail:filesystem:version" "exn:fail:filesystem:version?" "exn:fail:filesystem?" "exn:fail:network" "exn:fail:network:errno" "exn:fail:network:errno-errno" "exn:fail:network:errno?" "exn:fail:network?" "exn:fail:object" "exn:fail:object?" "exn:fail:out-of-memory" "exn:fail:out-of-memory?" "exn:fail:read" "exn:fail:read-srclocs" "exn:fail:read:eof" "exn:fail:read:eof?" "exn:fail:read:non-char" "exn:fail:read:non-char?" "exn:fail:read?" "exn:fail:syntax" "exn:fail:syntax-exprs" "exn:fail:syntax:missing-module" "exn:fail:syntax:missing-module-path" "exn:fail:syntax:missing-module?" "exn:fail:syntax:unbound" "exn:fail:syntax:unbound?" "exn:fail:syntax?" "exn:fail:unsupported" "exn:fail:unsupported?" "exn:fail:user" "exn:fail:user?" "exn:fail?" "exn:misc:match?" "exn:missing-module-accessor" "exn:missing-module?" "exn:srclocs-accessor" "exn:srclocs?" "exn?" "exp" "expand" "expand-once" "expand-syntax" "expand-syntax-once" "expand-syntax-to-top-form" "expand-to-top-form" "expand-user-path" "explode-path" "expt" "false?" "field-names" "fifth" "file->bytes" "file->bytes-lines" "file->lines" "file->list" "file->string" "file->value" "file-exists?" "file-name-from-path" "file-or-directory-identity" "file-or-directory-modify-seconds" "file-or-directory-permissions" "file-or-directory-stat" "file-or-directory-type" "file-position" "file-position*" "file-size" "file-stream-buffer-mode" "file-stream-port?" "file-truncate" "filename-extension" "filesystem-change-evt" "filesystem-change-evt-cancel" "filesystem-change-evt?" "filesystem-root-list" "filter" "filter-map" "filter-not" "filter-read-input-port" "find-compiled-file-roots" "find-executable-path" "find-files" "find-library-collection-links" "find-library-collection-paths" "find-relative-path" "find-system-path" "findf" "first" "first-or/c" "fixnum?" "flat-contract" "flat-contract-predicate" "flat-contract-property?" "flat-contract-with-explanation" "flat-contract?" "flat-named-contract" "flatten" "floating-point-bytes->real" "flonum?" "floor" "flush-output" "fold-files" "foldl" "foldr" "for-each" "force" "format" "fourth" "fprintf" "free-identifier=?" "free-label-identifier=?" "free-template-identifier=?" "free-transformer-identifier=?" "fsemaphore-count" "fsemaphore-post" "fsemaphore-try-wait?" "fsemaphore-wait" "fsemaphore?" "future" "future?" "futures-enabled?" "gcd" "generate-member-key" "generate-temporaries" "generic-set?" "generic?" "gensym" "get-output-bytes" "get-output-string" "get-preference" "get/build-late-neg-projection" "get/build-val-first-projection" "getenv" "global-port-print-handler" "group-by" "guard-evt" "handle-evt" "handle-evt?" "has-blame?" "has-contract?" "hash" "hash->list" "hash-clear" "hash-clear!" "hash-copy" "hash-copy-clear" "hash-count" "hash-empty?" "hash-ephemeron?" "hash-eq?" "hash-equal?" "hash-eqv?" "hash-for-each" "hash-has-key?" "hash-iterate-first" "hash-iterate-key" "hash-iterate-key+value" "hash-iterate-next" "hash-iterate-pair" "hash-iterate-value" "hash-keys" "hash-keys-subset?" "hash-map" "hash-placeholder?" "hash-ref" "hash-ref!" "hash-ref-key" "hash-remove" "hash-remove!" "hash-set" "hash-set!" "hash-set*" "hash-set*!" "hash-strong?" "hash-update" "hash-update!" "hash-values" "hash-weak?" "hash/c" "hash?" "hasheq" "hasheqv" "identifier-binding" "identifier-binding-portal-syntax" "identifier-binding-symbol" "identifier-distinct-binding" "identifier-label-binding" "identifier-prune-lexical-context" "identifier-prune-to-source-module" "identifier-remove-from-definition-context" "identifier-template-binding" "identifier-transformer-binding" "identifier?" "identity" "if/c" "imag-part" "immutable?" "impersonate-box" "impersonate-channel" "impersonate-continuation-mark-key" "impersonate-hash" "impersonate-hash-set" "impersonate-procedure" "impersonate-procedure*" "impersonate-prompt-tag" "impersonate-struct" "impersonate-vector" "impersonate-vector*" "impersonator-contract?" "impersonator-ephemeron" "impersonator-of?" "impersonator-property-accessor-procedure?" "impersonator-property?" "impersonator?" "implementation?" "implementation?/c" "in-bytes" "in-bytes-lines" "in-combinations" "in-cycle" "in-dict" "in-dict-keys" "in-dict-pairs" "in-dict-values" "in-directory" "in-ephemeron-hash" "in-ephemeron-hash-keys" "in-ephemeron-hash-pairs" "in-ephemeron-hash-values" "in-hash" "in-hash-keys" "in-hash-pairs" "in-hash-values" "in-immutable-hash" "in-immutable-hash-keys" "in-immutable-hash-pairs" "in-immutable-hash-values" "in-immutable-set" "in-inclusive-range" "in-indexed" "in-input-port-bytes" "in-input-port-chars" "in-lines" "in-list" "in-mlist" "in-mutable-hash" "in-mutable-hash-keys" "in-mutable-hash-pairs" "in-mutable-hash-values" "in-mutable-set" "in-naturals" "in-parallel" "in-permutations" "in-port" "in-producer" "in-range" "in-sequences" "in-set" "in-slice" "in-stream" "in-string" "in-syntax" "in-value" "in-values*-sequence" "in-values-sequence" "in-vector" "in-weak-hash" "in-weak-hash-keys" "in-weak-hash-pairs" "in-weak-hash-values" "in-weak-set" "inclusive-range" "index-of" "index-where" "indexes-of" "indexes-where" "inexact->exact" "inexact-real?" "inexact?" "infinite?" "input-port-append" "input-port?" "inspector-superior?" "inspector?" "instanceof/c" "integer->char" "integer->integer-bytes" "integer-bytes->integer" "integer-in" "integer-length" "integer-sqrt" "integer-sqrt/remainder" "integer?" "interface->method-names" "interface-extension?" "interface?" "internal-definition-context-add-scopes" "internal-definition-context-binding-identifiers" "internal-definition-context-introduce" "internal-definition-context-seal" "internal-definition-context-splice-binding-identifier" "internal-definition-context?" "is-a?" "is-a?/c" "keyword->string" "keyword-apply" "keyword-apply/dict" "keyword<?" "keyword?" "keywords-match" "kill-thread" "last" "last-pair" "lcm" "length" "liberal-define-context?" "link-exists?" "list" "list*" "list*of" "list->bytes" "list->mutable-set" "list->mutable-seteq" "list->mutable-seteqv" "list->set" "list->seteq" "list->seteqv" "list->string" "list->vector" "list->weak-set" "list->weak-seteq" "list->weak-seteqv" "list-contract?" "list-prefix?" "list-ref" "list-set" "list-tail" "list-update" "list/c" "list?" "listen-port-number?" "listof" "load" "load-extension" "load-on-demand-enabled" "load-relative" "load-relative-extension" "load/cd" "load/use-compiled" "local-expand" "local-expand/capture-lifts" "local-transformer-expand" "local-transformer-expand/capture-lifts" "locale-string-encoding" "log" "log-all-levels" "log-level-evt" "log-level?" "log-max-level" "log-message" "log-receiver?" "logger-name" "logger?" "magnitude" "make-arity-at-least" "make-base-empty-namespace" "make-base-namespace" "make-bytes" "make-channel" "make-chaperone-contract" "make-continuation-mark-key" "make-continuation-prompt-tag" "make-contract" "make-custodian" "make-custodian-box" "make-custom-hash" "make-custom-hash-types" "make-custom-set" "make-custom-set-types" "make-date" "make-date*" "make-derived-parameter" "make-directory" "make-directory*" "make-do-sequence" "make-empty-namespace" "make-environment-variables" "make-ephemeron" "make-ephemeron-hash" "make-ephemeron-hasheq" "make-ephemeron-hasheqv" "make-exn" "make-exn:break" "make-exn:break:hang-up" "make-exn:break:terminate" "make-exn:fail" "make-exn:fail:contract" "make-exn:fail:contract:arity" "make-exn:fail:contract:blame" "make-exn:fail:contract:continuation" "make-exn:fail:contract:divide-by-zero" "make-exn:fail:contract:non-fixnum-result" "make-exn:fail:contract:variable" "make-exn:fail:filesystem" "make-exn:fail:filesystem:errno" "make-exn:fail:filesystem:exists" "make-exn:fail:filesystem:missing-module" "make-exn:fail:filesystem:version" "make-exn:fail:network" "make-exn:fail:network:errno" "make-exn:fail:object" "make-exn:fail:out-of-memory" "make-exn:fail:read" "make-exn:fail:read:eof" "make-exn:fail:read:non-char" "make-exn:fail:syntax" "make-exn:fail:syntax:missing-module" "make-exn:fail:syntax:unbound" "make-exn:fail:unsupported" "make-exn:fail:user" "make-file-or-directory-link" "make-flat-contract" "make-fsemaphore" "make-generic" "make-handle-get-preference-locked" "make-hash" "make-hash-placeholder" "make-hasheq" "make-hasheq-placeholder" "make-hasheqv" "make-hasheqv-placeholder" "make-immutable-custom-hash" "make-immutable-hash" "make-immutable-hasheq" "make-immutable-hasheqv" "make-impersonator-property" "make-input-port" "make-input-port/read-to-peek" "make-inspector" "make-interned-syntax-introducer" "make-keyword-procedure" "make-known-char-range-list" "make-limited-input-port" "make-list" "make-lock-file-name" "make-log-receiver" "make-logger" "make-mixin-contract" "make-mutable-custom-set" "make-none/c" "make-object" "make-output-port" "make-parameter" "make-parent-directory*" "make-phantom-bytes" "make-pipe" "make-pipe-with-specials" "make-placeholder" "make-plumber" "make-polar" "make-portal-syntax" "make-prefab-struct" "make-primitive-class" "make-proj-contract" "make-pseudo-random-generator" "make-reader-graph" "make-readtable" "make-rectangular" "make-rename-transformer" "make-resolved-module-path" "make-security-guard" "make-semaphore" "make-set!-transformer" "make-shared-bytes" "make-sibling-inspector" "make-special-comment" "make-srcloc" "make-string" "make-struct-field-accessor" "make-struct-field-mutator" "make-struct-type" "make-struct-type-property" "make-syntax-delta-introducer" "make-syntax-introducer" "make-temporary-directory" "make-temporary-directory*" "make-temporary-file" "make-temporary-file*" "make-tentative-pretty-print-output-port" "make-thread-cell" "make-thread-group" "make-vector" "make-weak-box" "make-weak-custom-hash" "make-weak-custom-set" "make-weak-hash" "make-weak-hasheq" "make-weak-hasheqv" "make-will-executor" "map" "match-equality-test" "matches-arity-exactly?" "max" "mcar" "mcdr" "mcons" "member" "member-name-key-hash-code" "member-name-key=?" "member-name-key?" "memf" "memory-order-acquire" "memory-order-release" "memq" "memv" "merge-input" "method-in-interface?" "min" "module->exports" "module->imports" "module->indirect-exports" "module->language-info" "module->namespace" "module->realm" "module-compiled-cross-phase-persistent?" "module-compiled-exports" "module-compiled-imports" "module-compiled-indirect-exports" "module-compiled-language-info" "module-compiled-name" "module-compiled-realm" "module-compiled-submodules" "module-declared?" "module-path-index-join" "module-path-index-resolve" "module-path-index-split" "module-path-index-submodule" "module-path-index?" "module-path?" "module-predefined?" "module-provide-protected?" "modulo" "mpair?" "mutable-set" "mutable-seteq" "mutable-seteqv" "n->th" "nack-guard-evt" "namespace-anchor->empty-namespace" "namespace-anchor->namespace" "namespace-anchor?" "namespace-attach-module" "namespace-attach-module-declaration" "namespace-base-phase" "namespace-call-with-registry-lock" "namespace-mapped-symbols" "namespace-module-identifier" "namespace-module-registry" "namespace-require" "namespace-require/constant" "namespace-require/copy" "namespace-require/expansion-time" "namespace-set-variable-value!" "namespace-symbol->identifier" "namespace-syntax-introduce" "namespace-undefine-variable!" "namespace-unprotect-module" "namespace-variable-value" "namespace?" "nan?" "natural-number/c" "natural?" "negate" "negative-integer?" "negative?" "new-∀/c" "new-∃/c" "newline" "ninth" "non-empty-listof" "non-empty-string?" "none/c" "nonnegative-integer?" "nonpositive-integer?" "normal-case-path" "normalize-arity" "normalize-path" "normalized-arity?" "not" "not/c" "null?" "number->string" "number?" "numerator" "object->vector" "object-info" "object-interface" "object-method-arity-includes?" "object-name" "object-or-false=?" "object=-hash-code" "object=?" "object?" "odd?" "one-of/c" "open-input-bytes" "open-input-file" "open-input-output-file" "open-input-string" "open-output-bytes" "open-output-file" "open-output-nowhere" "open-output-string" "or/c" "order-of-magnitude" "ormap" "output-port?" "pair?" "parameter-procedure=?" "parameter/c" "parameter?" "parameterization?" "parse-command-line" "partition" "path->bytes" "path->complete-path" "path->directory-path" "path->string" "path-add-extension" "path-add-suffix" "path-convention-type" "path-element->bytes" "path-element->string" "path-element?" "path-for-some-system?" "path-get-extension" "path-has-extension?" "path-list-string->path-list" "path-only" "path-replace-extension" "path-replace-suffix" "path-string?" "path<?" "path?" "pathlist-closure" "peek-byte" "peek-byte-or-special" "peek-bytes" "peek-bytes!" "peek-bytes!-evt" "peek-bytes-avail!" "peek-bytes-avail!*" "peek-bytes-avail!-evt" "peek-bytes-avail!/enable-break" "peek-bytes-evt" "peek-char" "peek-char-or-special" "peek-string" "peek-string!" "peek-string!-evt" "peek-string-evt" "peeking-input-port" "permutations" "phantom-bytes?" "pipe-content-length" "place-break" "place-channel" "place-channel-get" "place-channel-put" "place-channel-put/get" "place-channel?" "place-dead-evt" "place-enabled?" "place-kill" "place-location?" "place-message-allowed?" "place-wait" "place?" "placeholder-get" "placeholder-set!" "placeholder?" "plumber-add-flush!" "plumber-flush-all" "plumber-flush-handle-remove!" "plumber-flush-handle?" "plumber?" "poll-guard-evt" "port->bytes" "port->bytes-lines" "port->lines" "port->list" "port->string" "port-closed-evt" "port-closed?" "port-commit-peeked" "port-count-lines!" "port-count-lines-enabled" "port-counts-lines?" "port-display-handler" "port-file-identity" "port-file-unlock" "port-next-location" "port-number?" "port-print-handler" "port-progress-evt" "port-provides-progress-evts?" "port-read-handler" "port-try-file-lock?" "port-waiting-peer?" "port-write-handler" "port-writes-atomic?" "port-writes-special?" "port?" "portal-syntax-content" "portal-syntax?" "positive-integer?" "positive?" "prefab-key->struct-type" "prefab-key?" "prefab-struct-key" "preferences-lock-file-mode" "pregexp" "pregexp?" "pretty-display" "pretty-format" "pretty-print" "pretty-print-.-symbol-without-bars" "pretty-print-abbreviate-read-macros" "pretty-print-columns" "pretty-print-current-style-table" "pretty-print-depth" "pretty-print-exact-as-decimal" "pretty-print-extend-style-table" "pretty-print-handler" "pretty-print-newline" "pretty-print-post-print-hook" "pretty-print-pre-print-hook" "pretty-print-print-hook" "pretty-print-print-line" "pretty-print-remap-stylable" "pretty-print-show-inexactness" "pretty-print-size-hook" "pretty-print-style-table?" "pretty-printing" "pretty-write" "primitive-closure?" "primitive-result-arity" "primitive?" "print" "print-as-expression" "print-boolean-long-form" "print-box" "print-graph" "print-hash-table" "print-mpair-curly-braces" "print-pair-curly-braces" "print-reader-abbreviations" "print-struct" "print-syntax-width" "print-unreadable" "print-value-columns" "print-vector-length" "printable/c" "printf" "println" "procedure->method" "procedure-arity" "procedure-arity-includes/c" "procedure-arity-includes?" "procedure-arity-mask" "procedure-arity?" "procedure-closure-contents-eq?" "procedure-extract-target" "procedure-impersonator*?" "procedure-keywords" "procedure-realm" "procedure-reduce-arity" "procedure-reduce-arity-mask" "procedure-reduce-keyword-arity" "procedure-reduce-keyword-arity-mask" "procedure-rename" "procedure-result-arity" "procedure-specialize" "procedure-struct-type?" "procedure?" "process" "process*" "process*/ports" "process/ports" "processor-count" "progress-evt?" "promise-forced?" "promise-running?" "promise/c" "promise/name?" "promise?" "prop:arrow-contract-get-info" "prop:arrow-contract?" "prop:orc-contract-get-subcontracts" "prop:orc-contract?" "prop:recursive-contract-unroll" "prop:recursive-contract?" "proper-subset?" "property/c" "pseudo-random-generator->vector" "pseudo-random-generator-vector?" "pseudo-random-generator?" "put-preferences" "putenv" "quotient" "quotient/remainder" "radians->degrees" "raise" "raise-argument-error" "raise-argument-error*" "raise-arguments-error" "raise-arguments-error*" "raise-arity-error" "raise-arity-error*" "raise-arity-mask-error" "raise-arity-mask-error*" "raise-blame-error" "raise-contract-error" "raise-mismatch-error" "raise-not-cons-blame-error" "raise-range-error" "raise-range-error*" "raise-result-arity-error" "raise-result-arity-error*" "raise-result-error" "raise-result-error*" "raise-syntax-error" "raise-type-error" "raise-user-error" "random" "random-seed" "range" "rational?" "rationalize" "read" "read-accept-bar-quote" "read-accept-box" "read-accept-compiled" "read-accept-dot" "read-accept-graph" "read-accept-infix-dot" "read-accept-lang" "read-accept-quasiquote" "read-accept-reader" "read-byte" "read-byte-or-special" "read-bytes" "read-bytes!" "read-bytes!-evt" "read-bytes-avail!" "read-bytes-avail!*" "read-bytes-avail!-evt" "read-bytes-avail!/enable-break" "read-bytes-evt" "read-bytes-line" "read-bytes-line-evt" "read-case-sensitive" "read-cdot" "read-char" "read-char-or-special" "read-curly-brace-as-paren" "read-curly-brace-with-tag" "read-decimal-as-inexact" "read-eval-print-loop" "read-installation-configuration-table" "read-language" "read-line" "read-line-evt" "read-on-demand-source" "read-single-flonum" "read-square-bracket-as-paren" "read-square-bracket-with-tag" "read-string" "read-string!" "read-string!-evt" "read-string-evt" "read-syntax" "read-syntax-accept-graph" "read-syntax/recursive" "read/recursive" "readtable-mapping" "readtable?" "real->decimal-string" "real->double-flonum" "real->floating-point-bytes" "real->single-flonum" "real-in" "real-part" "real?" "reencode-input-port" "reencode-output-port" "regexp" "regexp-match" "regexp-match*" "regexp-match-evt" "regexp-match-exact?" "regexp-match-peek" "regexp-match-peek-immediate" "regexp-match-peek-positions" "regexp-match-peek-positions*" "regexp-match-peek-positions-immediate" "regexp-match-peek-positions-immediate/end" "regexp-match-peek-positions/end" "regexp-match-positions" "regexp-match-positions*" "regexp-match-positions/end" "regexp-match/end" "regexp-match?" "regexp-max-lookbehind" "regexp-quote" "regexp-replace" "regexp-replace*" "regexp-replace-quote" "regexp-replaces" "regexp-split" "regexp-try-match" "regexp?" "relative-path?" "relocate-input-port" "relocate-output-port" "remainder" "remf" "remf*" "remove" "remove*" "remove-duplicates" "remq" "remq*" "remv" "remv*" "rename-contract" "rename-file-or-directory" "rename-transformer-target" "rename-transformer?" "replace-evt" "reroot-path" "resolve-path" "resolved-module-path-name" "resolved-module-path?" "rest" "reverse" "round" "second" "seconds->date" "security-guard?" "semaphore-peek-evt" "semaphore-peek-evt?" "semaphore-post" "semaphore-try-wait?" "semaphore-wait" "semaphore-wait/enable-break" "semaphore?" "sequence->list" "sequence->stream" "sequence-add-between" "sequence-andmap" "sequence-append" "sequence-count" "sequence-filter" "sequence-fold" "sequence-for-each" "sequence-generate" "sequence-generate*" "sequence-length" "sequence-map" "sequence-ormap" "sequence-ref" "sequence-tail" "sequence/c" "sequence?" "set" "set!-transformer-procedure" "set!-transformer?" "set->list" "set->stream" "set-add" "set-add!" "set-box!" "set-box*!" "set-clear" "set-clear!" "set-copy" "set-copy-clear" "set-count" "set-empty?" "set-eq?" "set-equal?" "set-eqv?" "set-first" "set-for-each" "set-implements/c" "set-implements?" "set-intersect" "set-intersect!" "set-map" "set-mcar!" "set-mcdr!" "set-member?" "set-mutable?" "set-phantom-bytes!" "set-port-next-location!" "set-remove" "set-remove!" "set-rest" "set-subtract" "set-subtract!" "set-symmetric-difference" "set-symmetric-difference!" "set-union" "set-union!" "set-weak?" "set/c" "set=?" "set?" "seteq" "seteqv" "seventh" "sgn" "sha1-bytes" "sha224-bytes" "sha256-bytes" "shared-bytes" "shell-execute" "shrink-path-wrt" "shuffle" "simple-form-path" "simplify-path" "sin" "single-flonum-available?" "single-flonum?" "sinh" "sixth" "skip-projection-wrapper?" "sleep" "some-system-path->string" "sort" "special-comment-value" "special-comment?" "special-filter-input-port" "split-at" "split-at-right" "split-common-prefix" "split-path" "splitf-at" "splitf-at-right" "sqr" "sqrt" "srcloc" "srcloc->string" "srcloc-column" "srcloc-line" "srcloc-position" "srcloc-source" "srcloc-span" "srcloc?" "stop-after" "stop-before" "stream->list" "stream-add-between" "stream-andmap" "stream-append" "stream-count" "stream-empty?" "stream-filter" "stream-first" "stream-fold" "stream-for-each" "stream-force" "stream-length" "stream-map" "stream-ormap" "stream-ref" "stream-rest" "stream-tail" "stream-take" "stream/c" "stream?" "string" "string->bytes/latin-1" "string->bytes/locale" "string->bytes/utf-8" "string->immutable-string" "string->keyword" "string->list" "string->number" "string->path" "string->path-element" "string->some-system-path" "string->symbol" "string->uninterned-symbol" "string->unreadable-symbol" "string-append" "string-append*" "string-append-immutable" "string-ci<=?" "string-ci<?" "string-ci=?" "string-ci>=?" "string-ci>?" "string-contains?" "string-copy" "string-copy!" "string-downcase" "string-environment-variable-name?" "string-fill!" "string-foldcase" "string-join" "string-len/c" "string-length" "string-locale-ci<?" "string-locale-ci=?" "string-locale-ci>?" "string-locale-downcase" "string-locale-upcase" "string-locale<?" "string-locale=?" "string-locale>?" "string-no-nuls?" "string-normalize-nfc" "string-normalize-nfd" "string-normalize-nfkc" "string-normalize-nfkd" "string-normalize-spaces" "string-port?" "string-prefix?" "string-ref" "string-replace" "string-set!" "string-split" "string-suffix?" "string-titlecase" "string-trim" "string-upcase" "string-utf-8-length" "string<=?" "string<?" "string=?" "string>=?" "string>?" "string?" "struct->vector" "struct-accessor-procedure?" "struct-constructor-procedure?" "struct-info" "struct-mutator-procedure?" "struct-predicate-procedure?" "struct-type-authentic?" "struct-type-info" "struct-type-make-constructor" "struct-type-make-predicate" "struct-type-property-accessor-procedure?" "struct-type-property-predicate-procedure?" "struct-type-property/c" "struct-type-property?" "struct-type-sealed?" "struct-type?" "struct?" "sub1" "subbytes" "subclass?" "subclass?/c" "subprocess" "subprocess-group-enabled" "subprocess-kill" "subprocess-pid" "subprocess-status" "subprocess-wait" "subprocess?" "subset?" "substring" "suggest/c" "symbol->string" "symbol-interned?" "symbol-unreadable?" "symbol<?" "symbol=?" "symbol?" "symbols" "sync" "sync/enable-break" "sync/timeout" "sync/timeout/enable-break" "syntax->datum" "syntax->list" "syntax-arm" "syntax-binding-set" "syntax-binding-set->syntax" "syntax-binding-set-extend" "syntax-binding-set?" "syntax-column" "syntax-debug-info" "syntax-deserialize" "syntax-disarm" "syntax-e" "syntax-line" "syntax-local-apply-transformer" "syntax-local-bind-syntaxes" "syntax-local-certifier" "syntax-local-context" "syntax-local-expand-expression" "syntax-local-get-shadower" "syntax-local-identifier-as-binding" "syntax-local-introduce" "syntax-local-lift-context" "syntax-local-lift-expression" "syntax-local-lift-module" "syntax-local-lift-module-end-declaration" "syntax-local-lift-provide" "syntax-local-lift-require" "syntax-local-lift-values-expression" "syntax-local-make-definition-context" "syntax-local-make-delta-introducer" "syntax-local-module-defined-identifiers" "syntax-local-module-exports" "syntax-local-module-interned-scope-symbols" "syntax-local-module-required-identifiers" "syntax-local-name" "syntax-local-phase-level" "syntax-local-submodules" "syntax-local-transforming-module-provides?" "syntax-local-value" "syntax-local-value/immediate" "syntax-original?" "syntax-position" "syntax-property" "syntax-property-preserved?" "syntax-property-remove" "syntax-property-symbol-keys" "syntax-protect" "syntax-rearm" "syntax-recertify" "syntax-serialize" "syntax-shift-phase-level" "syntax-source" "syntax-source-module" "syntax-span" "syntax-taint" "syntax-tainted?" "syntax-track-origin" "syntax-transforming-module-expression?" "syntax-transforming-with-lifts?" "syntax-transforming?" "syntax/c" "syntax?" "system" "system*" "system*/exit-code" "system-big-endian?" "system-idle-evt" "system-language+country" "system-library-subpath" "system-path-convention-type" "system-type" "system/exit-code" "tail-marks-match?" "take" "take-common-prefix" "take-right" "takef" "takef-right" "tan" "tanh" "tcp-abandon-port" "tcp-accept" "tcp-accept-evt" "tcp-accept-ready?" "tcp-accept/enable-break" "tcp-addresses" "tcp-close" "tcp-connect" "tcp-connect/enable-break" "tcp-listen" "tcp-listener?" "tcp-port?" "tentative-pretty-print-port-cancel" "tentative-pretty-print-port-transfer" "tenth" "terminal-port?" "third" "thread" "thread-cell-ref" "thread-cell-set!" "thread-cell-values?" "thread-cell?" "thread-dead-evt" "thread-dead?" "thread-group?" "thread-receive" "thread-receive-evt" "thread-resume" "thread-resume-evt" "thread-rewind-receive" "thread-running?" "thread-send" "thread-suspend" "thread-suspend-evt" "thread-try-receive" "thread-wait" "thread/suspend-to-kill" "thread?" "time-apply" "touch" "transplant-input-port" "transplant-output-port" "truncate" "udp-addresses" "udp-bind!" "udp-bound?" "udp-close" "udp-connect!" "udp-connected?" "udp-multicast-interface" "udp-multicast-join-group!" "udp-multicast-leave-group!" "udp-multicast-loopback?" "udp-multicast-set-interface!" "udp-multicast-set-loopback!" "udp-multicast-set-ttl!" "udp-multicast-ttl" "udp-open-socket" "udp-receive!" "udp-receive!*" "udp-receive!-evt" "udp-receive!/enable-break" "udp-receive-ready-evt" "udp-send" "udp-send*" "udp-send-evt" "udp-send-ready-evt" "udp-send-to" "udp-send-to*" "udp-send-to-evt" "udp-send-to/enable-break" "udp-send/enable-break" "udp-set-receive-buffer-size!" "udp-set-ttl!" "udp-ttl" "udp?" "unbox" "unbox*" "uncaught-exception-handler" "unit?" "unquoted-printing-string" "unquoted-printing-string-value" "unquoted-printing-string?" "unsupplied-arg?" "use-collection-link-paths" "use-compiled-file-check" "use-compiled-file-paths" "use-user-specific-search-paths" "value-blame" "value-contract" "values" "variable-reference->empty-namespace" "variable-reference->module-base-phase" "variable-reference->module-declaration-inspector" "variable-reference->module-path-index" "variable-reference->module-source" "variable-reference->namespace" "variable-reference->phase" "variable-reference->resolved-module-path" "variable-reference-constant?" "variable-reference-from-unsafe?" "variable-reference?" "vector" "vector*-length" "vector*-ref" "vector*-set!" "vector->immutable-vector" "vector->list" "vector->pseudo-random-generator" "vector->pseudo-random-generator!" "vector->values" "vector-append" "vector-argmax" "vector-argmin" "vector-cas!" "vector-copy" "vector-copy!" "vector-count" "vector-drop" "vector-drop-right" "vector-empty?" "vector-fill!" "vector-filter" "vector-filter-not" "vector-immutable" "vector-immutable/c" "vector-immutableof" "vector-length" "vector-map" "vector-map!" "vector-member" "vector-memq" "vector-memv" "vector-ref" "vector-set!" "vector-set*!" "vector-set-performance-stats!" "vector-sort" "vector-sort!" "vector-split-at" "vector-split-at-right" "vector-take" "vector-take-right" "vector/c" "vector?" "vectorof" "version" "void" "void?" "weak-box-value" "weak-box?" "weak-set" "weak-seteq" "weak-seteqv" "will-execute" "will-executor?" "will-register" "will-try-execute" "with-input-from-bytes" "with-input-from-file" "with-input-from-string" "with-output-to-bytes" "with-output-to-file" "with-output-to-string" "would-be-future" "wrap-evt" "write" "write-byte" "write-bytes" "write-bytes-avail" "write-bytes-avail*" "write-bytes-avail-evt" "write-bytes-avail/enable-break" "write-char" "write-special" "write-special-avail*" "write-special-evt" "write-string" "write-to-file" "writeln" "xor" "zero?" "~.a" "~.s" "~.v" "~a" "~e" "~r" "~s" "~v" - )) - -;; operators ;; - + (#any-of? @function.builtin "*" "*list/c" "+" "-" "/" "<" "</c" "<=" "<=/c" "=" "=/c" ">" ">/c" ">=" ">=/c" "abort-current-continuation" "abs" "absolute-path?" "acos" "add-between" "add1" "alarm-evt" "and/c" "andmap" "angle" "any/c" "append" "append*" "append-map" "apply" "argmax" "argmin" "arithmetic-shift" "arity-at-least" "arity-at-least-value" "arity-at-least?" "arity-checking-wrapper" "arity-includes?" "arity=?" "arrow-contract-info" "arrow-contract-info-accepts-arglist" "arrow-contract-info-chaperone-procedure" "arrow-contract-info-check-first-order" "arrow-contract-info?" "asin" "assert-unreachable" "assf" "assoc" "assq" "assv" "atan" "bad-number-of-results" "banner" "base->-doms/c" "base->-rngs/c" "base->?" "between/c" "bitwise-and" "bitwise-bit-field" "bitwise-bit-set?" "bitwise-ior" "bitwise-not" "bitwise-xor" "blame-add-car-context" "blame-add-cdr-context" "blame-add-context" "blame-add-missing-party" "blame-add-nth-arg-context" "blame-add-range-context" "blame-add-unknown-context" "blame-context" "blame-contract" "blame-fmt->-string" "blame-missing-party?" "blame-negative" "blame-original?" "blame-positive" "blame-replace-negative" "blame-replaced-negative?" "blame-source" "blame-swap" "blame-swapped?" "blame-update" "blame-value" "blame?" "boolean=?" "boolean?" "bound-identifier=?" "box" "box-cas!" "box-immutable" "box-immutable/c" "box/c" "box?" "break-enabled" "break-parameterization?" "break-thread" "build-chaperone-contract-property" "build-compound-type-name" "build-contract-property" "build-flat-contract-property" "build-list" "build-path" "build-path/convention-type" "build-string" "build-vector" "byte-pregexp" "byte-pregexp?" "byte-ready?" "byte-regexp" "byte-regexp?" "byte?" "bytes" "bytes->immutable-bytes" "bytes->list" "bytes->path" "bytes->path-element" "bytes->string/latin-1" "bytes->string/locale" "bytes->string/utf-8" "bytes-append" "bytes-append*" "bytes-close-converter" "bytes-convert" "bytes-convert-end" "bytes-converter?" "bytes-copy" "bytes-copy!" "bytes-environment-variable-name?" "bytes-fill!" "bytes-join" "bytes-length" "bytes-no-nuls?" "bytes-open-converter" "bytes-ref" "bytes-set!" "bytes-utf-8-index" "bytes-utf-8-length" "bytes-utf-8-ref" "bytes<?" "bytes=?" "bytes>?" "bytes?" "caaaar" "caaadr" "caaar" "caadar" "caaddr" "caadr" "caar" "cadaar" "cadadr" "cadar" "caddar" "cadddr" "caddr" "cadr" "call-in-continuation" "call-in-nested-thread" "call-with-atomic-output-file" "call-with-break-parameterization" "call-with-composable-continuation" "call-with-continuation-barrier" "call-with-continuation-prompt" "call-with-current-continuation" "call-with-default-reading-parameterization" "call-with-escape-continuation" "call-with-exception-handler" "call-with-file-lock/timeout" "call-with-immediate-continuation-mark" "call-with-input-bytes" "call-with-input-file" "call-with-input-file*" "call-with-input-string" "call-with-output-bytes" "call-with-output-file" "call-with-output-file*" "call-with-output-string" "call-with-parameterization" "call-with-semaphore" "call-with-semaphore/enable-break" "call-with-values" "call/cc" "call/ec" "car" "cartesian-product" "cdaaar" "cdaadr" "cdaar" "cdadar" "cdaddr" "cdadr" "cdar" "cddaar" "cddadr" "cddar" "cdddar" "cddddr" "cdddr" "cddr" "cdr" "ceiling" "channel-get" "channel-put" "channel-put-evt" "channel-put-evt?" "channel-try-get" "channel/c" "channel?" "chaperone-box" "chaperone-channel" "chaperone-continuation-mark-key" "chaperone-contract-property?" "chaperone-contract?" "chaperone-evt" "chaperone-hash" "chaperone-hash-set" "chaperone-of?" "chaperone-procedure" "chaperone-procedure*" "chaperone-prompt-tag" "chaperone-struct" "chaperone-struct-type" "chaperone-vector" "chaperone-vector*" "chaperone?" "char->integer" "char-alphabetic?" "char-blank?" "char-ci<=?" "char-ci<?" "char-ci=?" "char-ci>=?" "char-ci>?" "char-downcase" "char-foldcase" "char-general-category" "char-graphic?" "char-in" "char-in/c" "char-iso-control?" "char-lower-case?" "char-numeric?" "char-punctuation?" "char-ready?" "char-symbolic?" "char-title-case?" "char-titlecase" "char-upcase" "char-upper-case?" "char-utf-8-length" "char-whitespace?" "char<=?" "char<?" "char=?" "char>=?" "char>?" "char?" "check-duplicate-identifier" "check-duplicates" "checked-procedure-check-and-extract" "choice-evt" "class->interface" "class-info" "class-seal" "class-unseal" "class?" "cleanse-path" "close-input-port" "close-output-port" "coerce-chaperone-contract" "coerce-chaperone-contracts" "coerce-contract" "coerce-contract/f" "coerce-contracts" "coerce-flat-contract" "coerce-flat-contracts" "collect-garbage" "collection-file-path" "collection-path" "combinations" "combine-output" "compile" "compile-allow-set!-undefined" "compile-context-preservation-enabled" "compile-enforce-module-constants" "compile-syntax" "compile-target-machine?" "compiled-expression-recompile" "compiled-expression?" "compiled-module-expression?" "complete-path?" "complex?" "compose" "compose1" "conjoin" "conjugate" "cons" "cons/c" "cons?" "const" "continuation-mark-key/c" "continuation-mark-key?" "continuation-mark-set->context" "continuation-mark-set->iterator" "continuation-mark-set->list" "continuation-mark-set->list*" "continuation-mark-set-first" "continuation-mark-set?" "continuation-marks" "continuation-prompt-available?" "continuation-prompt-tag?" "continuation?" "contract-custom-write-property-proc" "contract-equivalent?" "contract-exercise" "contract-first-order" "contract-first-order-passes?" "contract-late-neg-projection" "contract-name" "contract-proc" "contract-projection" "contract-property?" "contract-random-generate" "contract-random-generate-env?" "contract-random-generate-fail?" "contract-random-generate-get-current-environment" "contract-random-generate-stash" "contract-random-generate/choose" "contract-stronger?" "contract-struct-exercise" "contract-struct-generate" "contract-struct-late-neg-projection" "contract-struct-list-contract?" "contract-val-first-projection" "contract?" "convert-stream" "copy-directory/files" "copy-file" "copy-port" "cos" "cosh" "count" "current-blame-format" "current-break-parameterization" "current-code-inspector" "current-command-line-arguments" "current-compile" "current-compile-realm" "current-compile-target-machine" "current-compiled-file-roots" "current-continuation-marks" "current-custodian" "current-directory" "current-directory-for-user" "current-drive" "current-environment-variables" "current-error-message-adjuster" "current-error-port" "current-eval" "current-evt-pseudo-random-generator" "current-force-delete-permissions" "current-future" "current-gc-milliseconds" "current-get-interaction-evt" "current-get-interaction-input-port" "current-inexact-milliseconds" "current-inexact-monotonic-milliseconds" "current-input-port" "current-inspector" "current-library-collection-links" "current-library-collection-paths" "current-load" "current-load-extension" "current-load-relative-directory" "current-load/use-compiled" "current-locale" "current-logger" "current-memory-use" "current-milliseconds" "current-module-declare-name" "current-module-declare-source" "current-module-name-resolver" "current-module-path-for-load" "current-namespace" "current-output-port" "current-parameterization" "current-plumber" "current-preserved-thread-cell-values" "current-print" "current-process-milliseconds" "current-prompt-read" "current-pseudo-random-generator" "current-read-interaction" "current-reader-guard" "current-readtable" "current-seconds" "current-security-guard" "current-subprocess-custodian-mode" "current-subprocess-keep-file-descriptors" "current-thread" "current-thread-group" "current-thread-initial-stack-size" "current-write-relative-directory" "curry" "curryr" "custodian-box-value" "custodian-box?" "custodian-limit-memory" "custodian-managed-list" "custodian-memory-accounting-available?" "custodian-require-memory" "custodian-shut-down?" "custodian-shutdown-all" "custodian?" "custom-print-quotable-accessor" "custom-print-quotable?" "custom-write-accessor" "custom-write-property-proc" "custom-write?" "date" "date*" "date*-nanosecond" "date*-time-zone-name" "date*?" "date-day" "date-dst?" "date-hour" "date-minute" "date-month" "date-second" "date-time-zone-offset" "date-week-day" "date-year" "date-year-day" "date?" "datum->syntax" "datum-intern-literal" "default-continuation-prompt-tag" "degrees->radians" "delete-directory" "delete-directory/files" "delete-file" "denominator" "dict->list" "dict-can-functional-set?" "dict-can-remove-keys?" "dict-clear" "dict-clear!" "dict-copy" "dict-count" "dict-empty?" "dict-for-each" "dict-has-key?" "dict-implements/c" "dict-implements?" "dict-iter-contract" "dict-iterate-first" "dict-iterate-key" "dict-iterate-next" "dict-iterate-value" "dict-key-contract" "dict-keys" "dict-map" "dict-mutable?" "dict-ref" "dict-ref!" "dict-remove" "dict-remove!" "dict-set" "dict-set!" "dict-set*" "dict-set*!" "dict-update" "dict-update!" "dict-value-contract" "dict-values" "dict?" "directory-exists?" "directory-list" "disjoin" "display" "display-lines" "display-lines-to-file" "display-to-file" "displayln" "double-flonum?" "drop" "drop-common-prefix" "drop-right" "dropf" "dropf-right" "dump-memory-stats" "dup-input-port" "dup-output-port" "dynamic->*" "dynamic-get-field" "dynamic-object/c" "dynamic-place" "dynamic-place*" "dynamic-require" "dynamic-require-for-syntax" "dynamic-send" "dynamic-set-field!" "dynamic-wind" "eighth" "empty?" "environment-variables-copy" "environment-variables-names" "environment-variables-ref" "environment-variables-set!" "environment-variables?" "eof-evt" "eof-object?" "ephemeron-value" "ephemeron?" "eprintf" "eq-contract-val" "eq-contract?" "eq-hash-code" "eq?" "equal-contract-val" "equal-contract?" "equal-hash-code" "equal-secondary-hash-code" "equal?" "equal?/recur" "eqv-hash-code" "eqv?" "error" "error-contract->adjusted-string" "error-display-handler" "error-escape-handler" "error-message->adjusted-string" "error-print-context-length" "error-print-source-location" "error-print-width" "error-syntax->string-handler" "error-value->string-handler" "eval" "eval-jit-enabled" "eval-syntax" "even?" "evt/c" "evt?" "exact->inexact" "exact-ceiling" "exact-floor" "exact-integer?" "exact-nonnegative-integer?" "exact-positive-integer?" "exact-round" "exact-truncate" "exact?" "executable-yield-handler" "exit" "exit-handler" "exn" "exn-continuation-marks" "exn-message" "exn:break" "exn:break-continuation" "exn:break:hang-up" "exn:break:hang-up?" "exn:break:terminate" "exn:break:terminate?" "exn:break?" "exn:fail" "exn:fail:contract" "exn:fail:contract:arity" "exn:fail:contract:arity?" "exn:fail:contract:blame" "exn:fail:contract:blame-object" "exn:fail:contract:blame?" "exn:fail:contract:continuation" "exn:fail:contract:continuation?" "exn:fail:contract:divide-by-zero" "exn:fail:contract:divide-by-zero?" "exn:fail:contract:non-fixnum-result" "exn:fail:contract:non-fixnum-result?" "exn:fail:contract:variable" "exn:fail:contract:variable-id" "exn:fail:contract:variable?" "exn:fail:contract?" "exn:fail:filesystem" "exn:fail:filesystem:errno" "exn:fail:filesystem:errno-errno" "exn:fail:filesystem:errno?" "exn:fail:filesystem:exists" "exn:fail:filesystem:exists?" "exn:fail:filesystem:missing-module" "exn:fail:filesystem:missing-module-path" "exn:fail:filesystem:missing-module?" "exn:fail:filesystem:version" "exn:fail:filesystem:version?" "exn:fail:filesystem?" "exn:fail:network" "exn:fail:network:errno" "exn:fail:network:errno-errno" "exn:fail:network:errno?" "exn:fail:network?" "exn:fail:object" "exn:fail:object?" "exn:fail:out-of-memory" "exn:fail:out-of-memory?" "exn:fail:read" "exn:fail:read-srclocs" "exn:fail:read:eof" "exn:fail:read:eof?" "exn:fail:read:non-char" "exn:fail:read:non-char?" "exn:fail:read?" "exn:fail:syntax" "exn:fail:syntax-exprs" "exn:fail:syntax:missing-module" "exn:fail:syntax:missing-module-path" "exn:fail:syntax:missing-module?" "exn:fail:syntax:unbound" "exn:fail:syntax:unbound?" "exn:fail:syntax?" "exn:fail:unsupported" "exn:fail:unsupported?" "exn:fail:user" "exn:fail:user?" "exn:fail?" "exn:misc:match?" "exn:missing-module-accessor" "exn:missing-module?" "exn:srclocs-accessor" "exn:srclocs?" "exn?" "exp" "expand" "expand-once" "expand-syntax" "expand-syntax-once" "expand-syntax-to-top-form" "expand-to-top-form" "expand-user-path" "explode-path" "expt" "false?" "field-names" "fifth" "file->bytes" "file->bytes-lines" "file->lines" "file->list" "file->string" "file->value" "file-exists?" "file-name-from-path" "file-or-directory-identity" "file-or-directory-modify-seconds" "file-or-directory-permissions" "file-or-directory-stat" "file-or-directory-type" "file-position" "file-position*" "file-size" "file-stream-buffer-mode" "file-stream-port?" "file-truncate" "filename-extension" "filesystem-change-evt" "filesystem-change-evt-cancel" "filesystem-change-evt?" "filesystem-root-list" "filter" "filter-map" "filter-not" "filter-read-input-port" "find-compiled-file-roots" "find-executable-path" "find-files" "find-library-collection-links" "find-library-collection-paths" "find-relative-path" "find-system-path" "findf" "first" "first-or/c" "fixnum?" "flat-contract" "flat-contract-predicate" "flat-contract-property?" "flat-contract-with-explanation" "flat-contract?" "flat-named-contract" "flatten" "floating-point-bytes->real" "flonum?" "floor" "flush-output" "fold-files" "foldl" "foldr" "for-each" "force" "format" "fourth" "fprintf" "free-identifier=?" "free-label-identifier=?" "free-template-identifier=?" "free-transformer-identifier=?" "fsemaphore-count" "fsemaphore-post" "fsemaphore-try-wait?" "fsemaphore-wait" "fsemaphore?" "future" "future?" "futures-enabled?" "gcd" "generate-member-key" "generate-temporaries" "generic-set?" "generic?" "gensym" "get-output-bytes" "get-output-string" "get-preference" "get/build-late-neg-projection" "get/build-val-first-projection" "getenv" "global-port-print-handler" "group-by" "guard-evt" "handle-evt" "handle-evt?" "has-blame?" "has-contract?" "hash" "hash->list" "hash-clear" "hash-clear!" "hash-copy" "hash-copy-clear" "hash-count" "hash-empty?" "hash-ephemeron?" "hash-eq?" "hash-equal?" "hash-eqv?" "hash-for-each" "hash-has-key?" "hash-iterate-first" "hash-iterate-key" "hash-iterate-key+value" "hash-iterate-next" "hash-iterate-pair" "hash-iterate-value" "hash-keys" "hash-keys-subset?" "hash-map" "hash-placeholder?" "hash-ref" "hash-ref!" "hash-ref-key" "hash-remove" "hash-remove!" "hash-set" "hash-set!" "hash-set*" "hash-set*!" "hash-strong?" "hash-update" "hash-update!" "hash-values" "hash-weak?" "hash/c" "hash?" "hasheq" "hasheqv" "identifier-binding" "identifier-binding-portal-syntax" "identifier-binding-symbol" "identifier-distinct-binding" "identifier-label-binding" "identifier-prune-lexical-context" "identifier-prune-to-source-module" "identifier-remove-from-definition-context" "identifier-template-binding" "identifier-transformer-binding" "identifier?" "identity" "if/c" "imag-part" "immutable?" "impersonate-box" "impersonate-channel" "impersonate-continuation-mark-key" "impersonate-hash" "impersonate-hash-set" "impersonate-procedure" "impersonate-procedure*" "impersonate-prompt-tag" "impersonate-struct" "impersonate-vector" "impersonate-vector*" "impersonator-contract?" "impersonator-ephemeron" "impersonator-of?" "impersonator-property-accessor-procedure?" "impersonator-property?" "impersonator?" "implementation?" "implementation?/c" "in-bytes" "in-bytes-lines" "in-combinations" "in-cycle" "in-dict" "in-dict-keys" "in-dict-pairs" "in-dict-values" "in-directory" "in-ephemeron-hash" "in-ephemeron-hash-keys" "in-ephemeron-hash-pairs" "in-ephemeron-hash-values" "in-hash" "in-hash-keys" "in-hash-pairs" "in-hash-values" "in-immutable-hash" "in-immutable-hash-keys" "in-immutable-hash-pairs" "in-immutable-hash-values" "in-immutable-set" "in-inclusive-range" "in-indexed" "in-input-port-bytes" "in-input-port-chars" "in-lines" "in-list" "in-mlist" "in-mutable-hash" "in-mutable-hash-keys" "in-mutable-hash-pairs" "in-mutable-hash-values" "in-mutable-set" "in-naturals" "in-parallel" "in-permutations" "in-port" "in-producer" "in-range" "in-sequences" "in-set" "in-slice" "in-stream" "in-string" "in-syntax" "in-value" "in-values*-sequence" "in-values-sequence" "in-vector" "in-weak-hash" "in-weak-hash-keys" "in-weak-hash-pairs" "in-weak-hash-values" "in-weak-set" "inclusive-range" "index-of" "index-where" "indexes-of" "indexes-where" "inexact->exact" "inexact-real?" "inexact?" "infinite?" "input-port-append" "input-port?" "inspector-superior?" "inspector?" "instanceof/c" "integer->char" "integer->integer-bytes" "integer-bytes->integer" "integer-in" "integer-length" "integer-sqrt" "integer-sqrt/remainder" "integer?" "interface->method-names" "interface-extension?" "interface?" "internal-definition-context-add-scopes" "internal-definition-context-binding-identifiers" "internal-definition-context-introduce" "internal-definition-context-seal" "internal-definition-context-splice-binding-identifier" "internal-definition-context?" "is-a?" "is-a?/c" "keyword->string" "keyword-apply" "keyword-apply/dict" "keyword<?" "keyword?" "keywords-match" "kill-thread" "last" "last-pair" "lcm" "length" "liberal-define-context?" "link-exists?" "list" "list*" "list*of" "list->bytes" "list->mutable-set" "list->mutable-seteq" "list->mutable-seteqv" "list->set" "list->seteq" "list->seteqv" "list->string" "list->vector" "list->weak-set" "list->weak-seteq" "list->weak-seteqv" "list-contract?" "list-prefix?" "list-ref" "list-set" "list-tail" "list-update" "list/c" "list?" "listen-port-number?" "listof" "load" "load-extension" "load-on-demand-enabled" "load-relative" "load-relative-extension" "load/cd" "load/use-compiled" "local-expand" "local-expand/capture-lifts" "local-transformer-expand" "local-transformer-expand/capture-lifts" "locale-string-encoding" "log" "log-all-levels" "log-level-evt" "log-level?" "log-max-level" "log-message" "log-receiver?" "logger-name" "logger?" "magnitude" "make-arity-at-least" "make-base-empty-namespace" "make-base-namespace" "make-bytes" "make-channel" "make-chaperone-contract" "make-continuation-mark-key" "make-continuation-prompt-tag" "make-contract" "make-custodian" "make-custodian-box" "make-custom-hash" "make-custom-hash-types" "make-custom-set" "make-custom-set-types" "make-date" "make-date*" "make-derived-parameter" "make-directory" "make-directory*" "make-do-sequence" "make-empty-namespace" "make-environment-variables" "make-ephemeron" "make-ephemeron-hash" "make-ephemeron-hasheq" "make-ephemeron-hasheqv" "make-exn" "make-exn:break" "make-exn:break:hang-up" "make-exn:break:terminate" "make-exn:fail" "make-exn:fail:contract" "make-exn:fail:contract:arity" "make-exn:fail:contract:blame" "make-exn:fail:contract:continuation" "make-exn:fail:contract:divide-by-zero" "make-exn:fail:contract:non-fixnum-result" "make-exn:fail:contract:variable" "make-exn:fail:filesystem" "make-exn:fail:filesystem:errno" "make-exn:fail:filesystem:exists" "make-exn:fail:filesystem:missing-module" "make-exn:fail:filesystem:version" "make-exn:fail:network" "make-exn:fail:network:errno" "make-exn:fail:object" "make-exn:fail:out-of-memory" "make-exn:fail:read" "make-exn:fail:read:eof" "make-exn:fail:read:non-char" "make-exn:fail:syntax" "make-exn:fail:syntax:missing-module" "make-exn:fail:syntax:unbound" "make-exn:fail:unsupported" "make-exn:fail:user" "make-file-or-directory-link" "make-flat-contract" "make-fsemaphore" "make-generic" "make-handle-get-preference-locked" "make-hash" "make-hash-placeholder" "make-hasheq" "make-hasheq-placeholder" "make-hasheqv" "make-hasheqv-placeholder" "make-immutable-custom-hash" "make-immutable-hash" "make-immutable-hasheq" "make-immutable-hasheqv" "make-impersonator-property" "make-input-port" "make-input-port/read-to-peek" "make-inspector" "make-interned-syntax-introducer" "make-keyword-procedure" "make-known-char-range-list" "make-limited-input-port" "make-list" "make-lock-file-name" "make-log-receiver" "make-logger" "make-mixin-contract" "make-mutable-custom-set" "make-none/c" "make-object" "make-output-port" "make-parameter" "make-parent-directory*" "make-phantom-bytes" "make-pipe" "make-pipe-with-specials" "make-placeholder" "make-plumber" "make-polar" "make-portal-syntax" "make-prefab-struct" "make-primitive-class" "make-proj-contract" "make-pseudo-random-generator" "make-reader-graph" "make-readtable" "make-rectangular" "make-rename-transformer" "make-resolved-module-path" "make-security-guard" "make-semaphore" "make-set!-transformer" "make-shared-bytes" "make-sibling-inspector" "make-special-comment" "make-srcloc" "make-string" "make-struct-field-accessor" "make-struct-field-mutator" "make-struct-type" "make-struct-type-property" "make-syntax-delta-introducer" "make-syntax-introducer" "make-temporary-directory" "make-temporary-directory*" "make-temporary-file" "make-temporary-file*" "make-tentative-pretty-print-output-port" "make-thread-cell" "make-thread-group" "make-vector" "make-weak-box" "make-weak-custom-hash" "make-weak-custom-set" "make-weak-hash" "make-weak-hasheq" "make-weak-hasheqv" "make-will-executor" "map" "match-equality-test" "matches-arity-exactly?" "max" "mcar" "mcdr" "mcons" "member" "member-name-key-hash-code" "member-name-key=?" "member-name-key?" "memf" "memory-order-acquire" "memory-order-release" "memq" "memv" "merge-input" "method-in-interface?" "min" "module->exports" "module->imports" "module->indirect-exports" "module->language-info" "module->namespace" "module->realm" "module-compiled-cross-phase-persistent?" "module-compiled-exports" "module-compiled-imports" "module-compiled-indirect-exports" "module-compiled-language-info" "module-compiled-name" "module-compiled-realm" "module-compiled-submodules" "module-declared?" "module-path-index-join" "module-path-index-resolve" "module-path-index-split" "module-path-index-submodule" "module-path-index?" "module-path?" "module-predefined?" "module-provide-protected?" "modulo" "mpair?" "mutable-set" "mutable-seteq" "mutable-seteqv" "n->th" "nack-guard-evt" "namespace-anchor->empty-namespace" "namespace-anchor->namespace" "namespace-anchor?" "namespace-attach-module" "namespace-attach-module-declaration" "namespace-base-phase" "namespace-call-with-registry-lock" "namespace-mapped-symbols" "namespace-module-identifier" "namespace-module-registry" "namespace-require" "namespace-require/constant" "namespace-require/copy" "namespace-require/expansion-time" "namespace-set-variable-value!" "namespace-symbol->identifier" "namespace-syntax-introduce" "namespace-undefine-variable!" "namespace-unprotect-module" "namespace-variable-value" "namespace?" "nan?" "natural-number/c" "natural?" "negate" "negative-integer?" "negative?" "new-∀/c" "new-∃/c" "newline" "ninth" "non-empty-listof" "non-empty-string?" "none/c" "nonnegative-integer?" "nonpositive-integer?" "normal-case-path" "normalize-arity" "normalize-path" "normalized-arity?" "not" "not/c" "null?" "number->string" "number?" "numerator" "object->vector" "object-info" "object-interface" "object-method-arity-includes?" "object-name" "object-or-false=?" "object=-hash-code" "object=?" "object?" "odd?" "one-of/c" "open-input-bytes" "open-input-file" "open-input-output-file" "open-input-string" "open-output-bytes" "open-output-file" "open-output-nowhere" "open-output-string" "or/c" "order-of-magnitude" "ormap" "output-port?" "pair?" "parameter-procedure=?" "parameter/c" "parameter?" "parameterization?" "parse-command-line" "partition" "path->bytes" "path->complete-path" "path->directory-path" "path->string" "path-add-extension" "path-add-suffix" "path-convention-type" "path-element->bytes" "path-element->string" "path-element?" "path-for-some-system?" "path-get-extension" "path-has-extension?" "path-list-string->path-list" "path-only" "path-replace-extension" "path-replace-suffix" "path-string?" "path<?" "path?" "pathlist-closure" "peek-byte" "peek-byte-or-special" "peek-bytes" "peek-bytes!" "peek-bytes!-evt" "peek-bytes-avail!" "peek-bytes-avail!*" "peek-bytes-avail!-evt" "peek-bytes-avail!/enable-break" "peek-bytes-evt" "peek-char" "peek-char-or-special" "peek-string" "peek-string!" "peek-string!-evt" "peek-string-evt" "peeking-input-port" "permutations" "phantom-bytes?" "pipe-content-length" "place-break" "place-channel" "place-channel-get" "place-channel-put" "place-channel-put/get" "place-channel?" "place-dead-evt" "place-enabled?" "place-kill" "place-location?" "place-message-allowed?" "place-wait" "place?" "placeholder-get" "placeholder-set!" "placeholder?" "plumber-add-flush!" "plumber-flush-all" "plumber-flush-handle-remove!" "plumber-flush-handle?" "plumber?" "poll-guard-evt" "port->bytes" "port->bytes-lines" "port->lines" "port->list" "port->string" "port-closed-evt" "port-closed?" "port-commit-peeked" "port-count-lines!" "port-count-lines-enabled" "port-counts-lines?" "port-display-handler" "port-file-identity" "port-file-unlock" "port-next-location" "port-number?" "port-print-handler" "port-progress-evt" "port-provides-progress-evts?" "port-read-handler" "port-try-file-lock?" "port-waiting-peer?" "port-write-handler" "port-writes-atomic?" "port-writes-special?" "port?" "portal-syntax-content" "portal-syntax?" "positive-integer?" "positive?" "prefab-key->struct-type" "prefab-key?" "prefab-struct-key" "preferences-lock-file-mode" "pregexp" "pregexp?" "pretty-display" "pretty-format" "pretty-print" "pretty-print-.-symbol-without-bars" "pretty-print-abbreviate-read-macros" "pretty-print-columns" "pretty-print-current-style-table" "pretty-print-depth" "pretty-print-exact-as-decimal" "pretty-print-extend-style-table" "pretty-print-handler" "pretty-print-newline" "pretty-print-post-print-hook" "pretty-print-pre-print-hook" "pretty-print-print-hook" "pretty-print-print-line" "pretty-print-remap-stylable" "pretty-print-show-inexactness" "pretty-print-size-hook" "pretty-print-style-table?" "pretty-printing" "pretty-write" "primitive-closure?" "primitive-result-arity" "primitive?" "print" "print-as-expression" "print-boolean-long-form" "print-box" "print-graph" "print-hash-table" "print-mpair-curly-braces" "print-pair-curly-braces" "print-reader-abbreviations" "print-struct" "print-syntax-width" "print-unreadable" "print-value-columns" "print-vector-length" "printable/c" "printf" "println" "procedure->method" "procedure-arity" "procedure-arity-includes/c" "procedure-arity-includes?" "procedure-arity-mask" "procedure-arity?" "procedure-closure-contents-eq?" "procedure-extract-target" "procedure-impersonator*?" "procedure-keywords" "procedure-realm" "procedure-reduce-arity" "procedure-reduce-arity-mask" "procedure-reduce-keyword-arity" "procedure-reduce-keyword-arity-mask" "procedure-rename" "procedure-result-arity" "procedure-specialize" "procedure-struct-type?" "procedure?" "process" "process*" "process*/ports" "process/ports" "processor-count" "progress-evt?" "promise-forced?" "promise-running?" "promise/c" "promise/name?" "promise?" "prop:arrow-contract-get-info" "prop:arrow-contract?" "prop:orc-contract-get-subcontracts" "prop:orc-contract?" "prop:recursive-contract-unroll" "prop:recursive-contract?" "proper-subset?" "property/c" "pseudo-random-generator->vector" "pseudo-random-generator-vector?" "pseudo-random-generator?" "put-preferences" "putenv" "quotient" "quotient/remainder" "radians->degrees" "raise" "raise-argument-error" "raise-argument-error*" "raise-arguments-error" "raise-arguments-error*" "raise-arity-error" "raise-arity-error*" "raise-arity-mask-error" "raise-arity-mask-error*" "raise-blame-error" "raise-contract-error" "raise-mismatch-error" "raise-not-cons-blame-error" "raise-range-error" "raise-range-error*" "raise-result-arity-error" "raise-result-arity-error*" "raise-result-error" "raise-result-error*" "raise-syntax-error" "raise-type-error" "raise-user-error" "random" "random-seed" "range" "rational?" "rationalize" "read" "read-accept-bar-quote" "read-accept-box" "read-accept-compiled" "read-accept-dot" "read-accept-graph" "read-accept-infix-dot" "read-accept-lang" "read-accept-quasiquote" "read-accept-reader" "read-byte" "read-byte-or-special" "read-bytes" "read-bytes!" "read-bytes!-evt" "read-bytes-avail!" "read-bytes-avail!*" "read-bytes-avail!-evt" "read-bytes-avail!/enable-break" "read-bytes-evt" "read-bytes-line" "read-bytes-line-evt" "read-case-sensitive" "read-cdot" "read-char" "read-char-or-special" "read-curly-brace-as-paren" "read-curly-brace-with-tag" "read-decimal-as-inexact" "read-eval-print-loop" "read-installation-configuration-table" "read-language" "read-line" "read-line-evt" "read-on-demand-source" "read-single-flonum" "read-square-bracket-as-paren" "read-square-bracket-with-tag" "read-string" "read-string!" "read-string!-evt" "read-string-evt" "read-syntax" "read-syntax-accept-graph" "read-syntax/recursive" "read/recursive" "readtable-mapping" "readtable?" "real->decimal-string" "real->double-flonum" "real->floating-point-bytes" "real->single-flonum" "real-in" "real-part" "real?" "reencode-input-port" "reencode-output-port" "regexp" "regexp-match" "regexp-match*" "regexp-match-evt" "regexp-match-exact?" "regexp-match-peek" "regexp-match-peek-immediate" "regexp-match-peek-positions" "regexp-match-peek-positions*" "regexp-match-peek-positions-immediate" "regexp-match-peek-positions-immediate/end" "regexp-match-peek-positions/end" "regexp-match-positions" "regexp-match-positions*" "regexp-match-positions/end" "regexp-match/end" "regexp-match?" "regexp-max-lookbehind" "regexp-quote" "regexp-replace" "regexp-replace*" "regexp-replace-quote" "regexp-replaces" "regexp-split" "regexp-try-match" "regexp?" "relative-path?" "relocate-input-port" "relocate-output-port" "remainder" "remf" "remf*" "remove" "remove*" "remove-duplicates" "remq" "remq*" "remv" "remv*" "rename-contract" "rename-file-or-directory" "rename-transformer-target" "rename-transformer?" "replace-evt" "reroot-path" "resolve-path" "resolved-module-path-name" "resolved-module-path?" "rest" "reverse" "round" "second" "seconds->date" "security-guard?" "semaphore-peek-evt" "semaphore-peek-evt?" "semaphore-post" "semaphore-try-wait?" "semaphore-wait" "semaphore-wait/enable-break" "semaphore?" "sequence->list" "sequence->stream" "sequence-add-between" "sequence-andmap" "sequence-append" "sequence-count" "sequence-filter" "sequence-fold" "sequence-for-each" "sequence-generate" "sequence-generate*" "sequence-length" "sequence-map" "sequence-ormap" "sequence-ref" "sequence-tail" "sequence/c" "sequence?" "set" "set!-transformer-procedure" "set!-transformer?" "set->list" "set->stream" "set-add" "set-add!" "set-box!" "set-box*!" "set-clear" "set-clear!" "set-copy" "set-copy-clear" "set-count" "set-empty?" "set-eq?" "set-equal?" "set-eqv?" "set-first" "set-for-each" "set-implements/c" "set-implements?" "set-intersect" "set-intersect!" "set-map" "set-mcar!" "set-mcdr!" "set-member?" "set-mutable?" "set-phantom-bytes!" "set-port-next-location!" "set-remove" "set-remove!" "set-rest" "set-subtract" "set-subtract!" "set-symmetric-difference" "set-symmetric-difference!" "set-union" "set-union!" "set-weak?" "set/c" "set=?" "set?" "seteq" "seteqv" "seventh" "sgn" "sha1-bytes" "sha224-bytes" "sha256-bytes" "shared-bytes" "shell-execute" "shrink-path-wrt" "shuffle" "simple-form-path" "simplify-path" "sin" "single-flonum-available?" "single-flonum?" "sinh" "sixth" "skip-projection-wrapper?" "sleep" "some-system-path->string" "sort" "special-comment-value" "special-comment?" "special-filter-input-port" "split-at" "split-at-right" "split-common-prefix" "split-path" "splitf-at" "splitf-at-right" "sqr" "sqrt" "srcloc" "srcloc->string" "srcloc-column" "srcloc-line" "srcloc-position" "srcloc-source" "srcloc-span" "srcloc?" "stop-after" "stop-before" "stream->list" "stream-add-between" "stream-andmap" "stream-append" "stream-count" "stream-empty?" "stream-filter" "stream-first" "stream-fold" "stream-for-each" "stream-force" "stream-length" "stream-map" "stream-ormap" "stream-ref" "stream-rest" "stream-tail" "stream-take" "stream/c" "stream?" "string" "string->bytes/latin-1" "string->bytes/locale" "string->bytes/utf-8" "string->immutable-string" "string->keyword" "string->list" "string->number" "string->path" "string->path-element" "string->some-system-path" "string->symbol" "string->uninterned-symbol" "string->unreadable-symbol" "string-append" "string-append*" "string-append-immutable" "string-ci<=?" "string-ci<?" "string-ci=?" "string-ci>=?" "string-ci>?" "string-contains?" "string-copy" "string-copy!" "string-downcase" "string-environment-variable-name?" "string-fill!" "string-foldcase" "string-join" "string-len/c" "string-length" "string-locale-ci<?" "string-locale-ci=?" "string-locale-ci>?" "string-locale-downcase" "string-locale-upcase" "string-locale<?" "string-locale=?" "string-locale>?" "string-no-nuls?" "string-normalize-nfc" "string-normalize-nfd" "string-normalize-nfkc" "string-normalize-nfkd" "string-normalize-spaces" "string-port?" "string-prefix?" "string-ref" "string-replace" "string-set!" "string-split" "string-suffix?" "string-titlecase" "string-trim" "string-upcase" "string-utf-8-length" "string<=?" "string<?" "string=?" "string>=?" "string>?" "string?" "struct->vector" "struct-accessor-procedure?" "struct-constructor-procedure?" "struct-info" "struct-mutator-procedure?" "struct-predicate-procedure?" "struct-type-authentic?" "struct-type-info" "struct-type-make-constructor" "struct-type-make-predicate" "struct-type-property-accessor-procedure?" "struct-type-property-predicate-procedure?" "struct-type-property/c" "struct-type-property?" "struct-type-sealed?" "struct-type?" "struct?" "sub1" "subbytes" "subclass?" "subclass?/c" "subprocess" "subprocess-group-enabled" "subprocess-kill" "subprocess-pid" "subprocess-status" "subprocess-wait" "subprocess?" "subset?" "substring" "suggest/c" "symbol->string" "symbol-interned?" "symbol-unreadable?" "symbol<?" "symbol=?" "symbol?" "symbols" "sync" "sync/enable-break" "sync/timeout" "sync/timeout/enable-break" "syntax->datum" "syntax->list" "syntax-arm" "syntax-binding-set" "syntax-binding-set->syntax" "syntax-binding-set-extend" "syntax-binding-set?" "syntax-column" "syntax-debug-info" "syntax-deserialize" "syntax-disarm" "syntax-e" "syntax-line" "syntax-local-apply-transformer" "syntax-local-bind-syntaxes" "syntax-local-certifier" "syntax-local-context" "syntax-local-expand-expression" "syntax-local-get-shadower" "syntax-local-identifier-as-binding" "syntax-local-introduce" "syntax-local-lift-context" "syntax-local-lift-expression" "syntax-local-lift-module" "syntax-local-lift-module-end-declaration" "syntax-local-lift-provide" "syntax-local-lift-require" "syntax-local-lift-values-expression" "syntax-local-make-definition-context" "syntax-local-make-delta-introducer" "syntax-local-module-defined-identifiers" "syntax-local-module-exports" "syntax-local-module-interned-scope-symbols" "syntax-local-module-required-identifiers" "syntax-local-name" "syntax-local-phase-level" "syntax-local-submodules" "syntax-local-transforming-module-provides?" "syntax-local-value" "syntax-local-value/immediate" "syntax-original?" "syntax-position" "syntax-property" "syntax-property-preserved?" "syntax-property-remove" "syntax-property-symbol-keys" "syntax-protect" "syntax-rearm" "syntax-recertify" "syntax-serialize" "syntax-shift-phase-level" "syntax-source" "syntax-source-module" "syntax-span" "syntax-taint" "syntax-tainted?" "syntax-track-origin" "syntax-transforming-module-expression?" "syntax-transforming-with-lifts?" "syntax-transforming?" "syntax/c" "syntax?" "system" "system*" "system*/exit-code" "system-big-endian?" "system-idle-evt" "system-language+country" "system-library-subpath" "system-path-convention-type" "system-type" "system/exit-code" "tail-marks-match?" "take" "take-common-prefix" "take-right" "takef" "takef-right" "tan" "tanh" "tcp-abandon-port" "tcp-accept" "tcp-accept-evt" "tcp-accept-ready?" "tcp-accept/enable-break" "tcp-addresses" "tcp-close" "tcp-connect" "tcp-connect/enable-break" "tcp-listen" "tcp-listener?" "tcp-port?" "tentative-pretty-print-port-cancel" "tentative-pretty-print-port-transfer" "tenth" "terminal-port?" "third" "thread" "thread-cell-ref" "thread-cell-set!" "thread-cell-values?" "thread-cell?" "thread-dead-evt" "thread-dead?" "thread-group?" "thread-receive" "thread-receive-evt" "thread-resume" "thread-resume-evt" "thread-rewind-receive" "thread-running?" "thread-send" "thread-suspend" "thread-suspend-evt" "thread-try-receive" "thread-wait" "thread/suspend-to-kill" "thread?" "time-apply" "touch" "transplant-input-port" "transplant-output-port" "truncate" "udp-addresses" "udp-bind!" "udp-bound?" "udp-close" "udp-connect!" "udp-connected?" "udp-multicast-interface" "udp-multicast-join-group!" "udp-multicast-leave-group!" "udp-multicast-loopback?" "udp-multicast-set-interface!" "udp-multicast-set-loopback!" "udp-multicast-set-ttl!" "udp-multicast-ttl" "udp-open-socket" "udp-receive!" "udp-receive!*" "udp-receive!-evt" "udp-receive!/enable-break" "udp-receive-ready-evt" "udp-send" "udp-send*" "udp-send-evt" "udp-send-ready-evt" "udp-send-to" "udp-send-to*" "udp-send-to-evt" "udp-send-to/enable-break" "udp-send/enable-break" "udp-set-receive-buffer-size!" "udp-set-ttl!" "udp-ttl" "udp?" "unbox" "unbox*" "uncaught-exception-handler" "unit?" "unquoted-printing-string" "unquoted-printing-string-value" "unquoted-printing-string?" "unsupplied-arg?" "use-collection-link-paths" "use-compiled-file-check" "use-compiled-file-paths" "use-user-specific-search-paths" "value-blame" "value-contract" "values" "variable-reference->empty-namespace" "variable-reference->module-base-phase" "variable-reference->module-declaration-inspector" "variable-reference->module-path-index" "variable-reference->module-source" "variable-reference->namespace" "variable-reference->phase" "variable-reference->resolved-module-path" "variable-reference-constant?" "variable-reference-from-unsafe?" "variable-reference?" "vector" "vector*-length" "vector*-ref" "vector*-set!" "vector->immutable-vector" "vector->list" "vector->pseudo-random-generator" "vector->pseudo-random-generator!" "vector->values" "vector-append" "vector-argmax" "vector-argmin" "vector-cas!" "vector-copy" "vector-copy!" "vector-count" "vector-drop" "vector-drop-right" "vector-empty?" "vector-fill!" "vector-filter" "vector-filter-not" "vector-immutable" "vector-immutable/c" "vector-immutableof" "vector-length" "vector-map" "vector-map!" "vector-member" "vector-memq" "vector-memv" "vector-ref" "vector-set!" "vector-set*!" "vector-set-performance-stats!" "vector-sort" "vector-sort!" "vector-split-at" "vector-split-at-right" "vector-take" "vector-take-right" "vector/c" "vector?" "vectorof" "version" "void" "void?" "weak-box-value" "weak-box?" "weak-set" "weak-seteq" "weak-seteqv" "will-execute" "will-executor?" "will-register" "will-try-execute" "with-input-from-bytes" "with-input-from-file" "with-input-from-string" "with-output-to-bytes" "with-output-to-file" "with-output-to-string" "would-be-future" "wrap-evt" "write" "write-byte" "write-bytes" "write-bytes-avail" "write-bytes-avail*" "write-bytes-avail-evt" "write-bytes-avail/enable-break" "write-char" "write-special" "write-special-avail*" "write-special-evt" "write-string" "write-to-file" "writeln" "xor" "zero?" "~.a" "~.s" "~.v" "~a" "~e" "~r" "~s" "~v")) +; operators ;; ((symbol) @operator - (#any-of? @operator - "+" "-" "*" "/" "=" "<=" ">=" "<" ">")) - -;; builtin variables ;; + (#any-of? @operator "+" "-" "*" "/" "=" "<=" ">=" "<" ">")) +; builtin variables ;; ((symbol) @variable.builtin - (#any-of? @variable.builtin - "always-evt" "block-device-type-bits" "character-device-type-bits" "check-tail-contract" "contract-continuation-mark-key" "contract-random-generate-fail" "directory-type-bits" "empty" "empty-sequence" "empty-stream" "eof" "equal<%>" "error-message-adjuster-key" "externalizable<%>" "failure-result/c" "false" "false/c" "fifo-type-bits" "file-type-bits" "for-clause-syntax-protect" "group-execute-bit" "group-permission-bits" "group-read-bit" "group-write-bit" "impersonator-prop:application-mark" "impersonator-prop:blame" "impersonator-prop:contracted" "legacy-match-expander?" "match-...-nesting" "match-expander?" "mixin-contract" "never-evt" "null" "object%" "other-execute-bit" "other-permission-bits" "other-read-bit" "other-write-bit" "pi" "pi.f" "predicate/c" "printable<%>" "prop:arity-string" "prop:arrow-contract" "prop:authentic" "prop:blame" "prop:chaperone-contract" "prop:checked-procedure" "prop:contract" "prop:contracted" "prop:custom-print-quotable" "prop:custom-write" "prop:dict" "prop:equal+hash" "prop:evt" "prop:exn:missing-module" "prop:exn:srclocs" "prop:expansion-contexts" "prop:flat-contract" "prop:impersonator-of" "prop:input-port" "prop:legacy-match-expander" "prop:liberal-define-context" "prop:match-expander" "prop:object-name" "prop:orc-contract" "prop:output-port" "prop:place-location" "prop:procedure" "prop:recursive-contract" "prop:rename-transformer" "prop:sealed" "prop:sequence" "prop:set!-transformer" "prop:stream" "regular-file-type-bits" "set-group-id-bit" "set-user-id-bit" "socket-type-bits" "sticky-bit" "struct:arity-at-least" "struct:arrow-contract-info" "struct:date" "struct:date*" "struct:exn" "struct:exn:break" "struct:exn:break:hang-up" "struct:exn:break:terminate" "struct:exn:fail" "struct:exn:fail:contract" "struct:exn:fail:contract:arity" "struct:exn:fail:contract:blame" "struct:exn:fail:contract:continuation" "struct:exn:fail:contract:divide-by-zero" "struct:exn:fail:contract:non-fixnum-result" "struct:exn:fail:contract:variable" "struct:exn:fail:filesystem" "struct:exn:fail:filesystem:errno" "struct:exn:fail:filesystem:exists" "struct:exn:fail:filesystem:missing-module" "struct:exn:fail:filesystem:version" "struct:exn:fail:network" "struct:exn:fail:network:errno" "struct:exn:fail:object" "struct:exn:fail:out-of-memory" "struct:exn:fail:read" "struct:exn:fail:read:eof" "struct:exn:fail:read:non-char" "struct:exn:fail:syntax" "struct:exn:fail:syntax:missing-module" "struct:exn:fail:syntax:unbound" "struct:exn:fail:unsupported" "struct:exn:fail:user" "struct:srcloc" "symbolic-link-type-bits" "syntax-local-match-introduce" "syntax-pattern-variable?" "the-unsupplied-arg" "true" "unspecified-dom" "user-execute-bit" "user-permission-bits" "user-read-bit" "user-write-bit" "writable<%>" - )) + (#any-of? @variable.builtin "always-evt" "block-device-type-bits" "character-device-type-bits" "check-tail-contract" "contract-continuation-mark-key" "contract-random-generate-fail" "directory-type-bits" "empty" "empty-sequence" "empty-stream" "eof" "equal<%>" "error-message-adjuster-key" "externalizable<%>" "failure-result/c" "false" "false/c" "fifo-type-bits" "file-type-bits" "for-clause-syntax-protect" "group-execute-bit" "group-permission-bits" "group-read-bit" "group-write-bit" "impersonator-prop:application-mark" "impersonator-prop:blame" "impersonator-prop:contracted" "legacy-match-expander?" "match-...-nesting" "match-expander?" "mixin-contract" "never-evt" "null" "object%" "other-execute-bit" "other-permission-bits" "other-read-bit" "other-write-bit" "pi" "pi.f" "predicate/c" "printable<%>" "prop:arity-string" "prop:arrow-contract" "prop:authentic" "prop:blame" "prop:chaperone-contract" "prop:checked-procedure" "prop:contract" "prop:contracted" "prop:custom-print-quotable" "prop:custom-write" "prop:dict" "prop:equal+hash" "prop:evt" "prop:exn:missing-module" "prop:exn:srclocs" "prop:expansion-contexts" "prop:flat-contract" "prop:impersonator-of" "prop:input-port" "prop:legacy-match-expander" "prop:liberal-define-context" "prop:match-expander" "prop:object-name" "prop:orc-contract" "prop:output-port" "prop:place-location" "prop:procedure" "prop:recursive-contract" "prop:rename-transformer" "prop:sealed" "prop:sequence" "prop:set!-transformer" "prop:stream" "regular-file-type-bits" "set-group-id-bit" "set-user-id-bit" "socket-type-bits" "sticky-bit" "struct:arity-at-least" "struct:arrow-contract-info" "struct:date" "struct:date*" "struct:exn" "struct:exn:break" "struct:exn:break:hang-up" "struct:exn:break:terminate" "struct:exn:fail" "struct:exn:fail:contract" "struct:exn:fail:contract:arity" "struct:exn:fail:contract:blame" "struct:exn:fail:contract:continuation" "struct:exn:fail:contract:divide-by-zero" "struct:exn:fail:contract:non-fixnum-result" "struct:exn:fail:contract:variable" "struct:exn:fail:filesystem" "struct:exn:fail:filesystem:errno" "struct:exn:fail:filesystem:exists" "struct:exn:fail:filesystem:missing-module" "struct:exn:fail:filesystem:version" "struct:exn:fail:network" "struct:exn:fail:network:errno" "struct:exn:fail:object" "struct:exn:fail:out-of-memory" "struct:exn:fail:read" "struct:exn:fail:read:eof" "struct:exn:fail:read:non-char" "struct:exn:fail:syntax" "struct:exn:fail:syntax:missing-module" "struct:exn:fail:syntax:unbound" "struct:exn:fail:unsupported" "struct:exn:fail:user" "struct:srcloc" "symbolic-link-type-bits" "syntax-local-match-introduce" "syntax-pattern-variable?" "the-unsupplied-arg" "true" "unspecified-dom" "user-execute-bit" "user-permission-bits" "user-read-bit" "user-write-bit" "writable<%>")) (dot) @variable.builtin -;;------------------------------------------------------------------;; -;; Special cases ;; -;;------------------------------------------------------------------;; - +;------------------------------------------------------------------;; +; Special cases ;; +;------------------------------------------------------------------;; (list - "[" - (symbol) @variable - "]") + "[" + (symbol) @variable + "]") (list - . - (symbol) @_p - . - (list - (symbol) @variable) - (#any-of? @_p - "lambda" "λ" "define-values" "define-syntaxes" "define-values-for-export" - "define-values-for-syntax" - )) - -;;------------------------------------------------------------------;; -;; Solve conflicts ;; -;;------------------------------------------------------------------;; - -;; See `:h treesitter`, and search `priority` + . + (symbol) @_p + . + (list + (symbol) @variable) + (#any-of? @_p "lambda" "λ" "define-values" "define-syntaxes" "define-values-for-export" "define-values-for-syntax")) +;------------------------------------------------------------------;; +; Solve conflicts ;; +;------------------------------------------------------------------;; +; See `:h treesitter`, and search `priority` (list - . - (symbol) @keyword.import - (#eq? @keyword.import "require") - (#set! "priority" 101)) + . + (symbol) @keyword.import + (#eq? @keyword.import "require") + (#set! "priority" 101)) (quote . @@ -135,5 +122,4 @@ (#set! "priority" 105)) @string.special.symbol ((sexp_comment) @comment - (#set! "priority" 110)) - + (#set! "priority" 110)) diff --git a/queries/racket/injections.scm b/queries/racket/injections.scm index b90c418a4..dc8982053 100644 --- a/queries/racket/injections.scm +++ b/queries/racket/injections.scm @@ -1,5 +1,5 @@ ([ (comment) (block_comment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) diff --git a/queries/rasi/folds.scm b/queries/rasi/folds.scm index 1557b831e..2fd6c9fa7 100644 --- a/queries/rasi/folds.scm +++ b/queries/rasi/folds.scm @@ -2,4 +2,4 @@ (rule_set) (list_value) (distance_calc) - ] @fold +] @fold diff --git a/queries/rasi/highlights.scm b/queries/rasi/highlights.scm index 7385e3245..cec2e5a03 100644 --- a/queries/rasi/highlights.scm +++ b/queries/rasi/highlights.scm @@ -1,15 +1,19 @@ (comment) @comment @spell "@media" @keyword + "@import" @keyword.import + "@theme" @keyword.import (string_value) @string + [ (integer_value) (float_value) "0" - ] @number +] @number + (boolean_value) @boolean [ @@ -22,59 +26,114 @@ (orientation_value) (cursor_value) "inherit" - ] @keyword +] @keyword + +(url_image + "url" @function.builtin) +(gradient_image + "linear-gradient" @function.builtin) -(url_image "url" @function.builtin) -(gradient_image "linear-gradient" @function.builtin) -(distance_calc "calc" @function.builtin) -(rgb_color ["rgb" "rgba"] @function.builtin) -(hsl_color ["hsl" "hsla"] @function.builtin) -(hwb_color ["hwb" "hwba"] @function.builtin) -(cmyk_color "cmyk" @function.builtin) +(distance_calc + "calc" @function.builtin) + +(rgb_color + [ + "rgb" + "rgba" + ] @function.builtin) + +(hsl_color + [ + "hsl" + "hsla" + ] @function.builtin) + +(hwb_color + [ + "hwb" + "hwba" + ] @function.builtin) + +(cmyk_color + "cmyk" @function.builtin) [ - "(" - ")" - "{" - "}" - "[" - "]" - ] @punctuation.bracket + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket (distance_op) @operator [ - ";" - "," - ":" - "." - ] @punctuation.delimiter + ";" + "," + ":" + "." +] @punctuation.delimiter [ - (angle_unit) - (integer_distance_unit) - (float_distance_unit) - ] @type + (angle_unit) + (integer_distance_unit) + (float_distance_unit) +] @type + (percentage) @number -(percentage "%" @type) + +(percentage + "%" @type) [ (global_selector) (id_selector) - ] @module +] @module + +(id_selector_view + [ + "normal" + "selected" + "alternate" + ] @attribute) -(id_selector_view [ "normal" "selected" "alternate" ] @attribute) -(id_selector_state [ "normal" "urgent" "active" ] @type.qualifier) +(id_selector_state + [ + "normal" + "urgent" + "active" + ] @type.qualifier) (hex_color) @number -(hex_color "#" @punctuation.special) -(named_color (identifier) @string.special) -(named_color "/" @operator) -(reference_value "@" @punctuation.special (identifier) @variable) -(reference_value "var" @function.builtin (identifier) @variable) -(list_value (identifier) @variable) -(environ_value "$" @punctuation.special (identifier) @variable) -(environ_value "env" @function.builtin (identifier) @variable) + +(hex_color + "#" @punctuation.special) + +(named_color + (identifier) @string.special) + +(named_color + "/" @operator) + +(reference_value + "@" @punctuation.special + (identifier) @variable) + +(reference_value + "var" @function.builtin + (identifier) @variable) + +(list_value + (identifier) @variable) + +(environ_value + "$" @punctuation.special + (identifier) @variable) + +(environ_value + "env" @function.builtin + (identifier) @variable) (property_name) @variable diff --git a/queries/rasi/indents.scm b/queries/rasi/indents.scm index 398cf8b8f..849d8aeac 100644 --- a/queries/rasi/indents.scm +++ b/queries/rasi/indents.scm @@ -1,5 +1,6 @@ (rule_set) @indent.begin -(block "}" @indent.branch) +(block + "}" @indent.branch) (comment) @indent.ignore diff --git a/queries/rasi/locals.scm b/queries/rasi/locals.scm index b8e221252..9210de6ea 100644 --- a/queries/rasi/locals.scm +++ b/queries/rasi/locals.scm @@ -1,5 +1,10 @@ -(rule_set (selectors (id_selector))) @local.scope +(rule_set + (selectors + (id_selector))) @local.scope -(block (declaration (property_name) @local.definition.var)) +(block + (declaration + (property_name) @local.definition.var)) -(reference_value name:(identifier) @local.reference) +(reference_value + name: (identifier) @local.reference) diff --git a/queries/rbs/highlights.scm b/queries/rbs/highlights.scm index 4e46680a3..a627c256b 100644 --- a/queries/rbs/highlights.scm +++ b/queries/rbs/highlights.scm @@ -1,5 +1,4 @@ ; Use directive - (use_clause [ (type_name) @@ -7,7 +6,6 @@ ] @type) ; Buitin constants and Keywords - [ "true" "false" @@ -33,11 +31,10 @@ "def" @keyword.function ; Members of declaration - [ - "include" - "extend" - "prepend" + "include" + "extend" + "prepend" ] @function.method (visibility) @type.qualifier @@ -47,30 +44,47 @@ (method_member (method_name [ - (identifier) - (constant) - (operator) - (setter) + (identifier) + (constant) + (operator) + (setter) ] @function.method)) -[(ivar_name) (cvar_name)] @property +[ + (ivar_name) + (cvar_name) +] @property + +(alias_member + (method_name) @function) + +(class_name + (constant) @type) + +(module_name + (constant) @type) -(alias_member (method_name) @function) +(interface_name + (interface) @type) + +(alias_name + (identifier) @type) -(class_name (constant) @type) -(module_name (constant) @type) -(interface_name (interface) @type) -(alias_name (identifier) @type) (type_variable) @constant -(namespace (constant) @module) + +(namespace + (constant) @module) (builtin_type) @type.builtin -(const_name (constant) @constant) +(const_name + (constant) @constant) + (global_name) @property ; Standard Arguments -(parameter (var_name) @variable.parameter) +(parameter + (var_name) @variable.parameter) ; Keyword Arguments (keyword) @variable.parameter @@ -79,39 +93,42 @@ (self) @variable.builtin ; Literal -(type (symbol_literal) @string.special.symbol) +(type + (symbol_literal) @string.special.symbol) -(type (string_literal (escape_sequence) @string.escape)) -(type (string_literal) @string) +(type + (string_literal + (escape_sequence) @string.escape)) -(type (integer_literal) @number) +(type + (string_literal) @string) -; Operators +(type + (integer_literal) @number) +; Operators [ - "=" - "->" - "<" - "**" - "*" - "&" - "|" - "^" - ] @operator + "=" + "->" + "<" + "**" + "*" + "&" + "|" + "^" +] @operator ; Punctuation - [ - "(" - ")" - "[" - "]" - "{" - "}" - ] @punctuation.bracket - + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket [ - "," - "." - ] @punctuation.delimiter + "," + "." +] @punctuation.delimiter diff --git a/queries/rbs/injections.scm b/queries/rbs/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/rbs/injections.scm +++ b/queries/rbs/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/re2c/highlights.scm b/queries/re2c/highlights.scm index 7e679fbcc..4a51043bf 100644 --- a/queries/re2c/highlights.scm +++ b/queries/re2c/highlights.scm @@ -1,5 +1,4 @@ ; Namespaces - [ "re2c" "re2c" @@ -8,14 +7,12 @@ ] @module ; Includes - [ "!use" "!include" ] @keyword.import ; Keywords - [ "flags" "define" @@ -52,7 +49,6 @@ ] @keyword.repeat ; Constants - [ "ignore" "substitute" @@ -71,7 +67,6 @@ (linedir) @constant.macro ; Operators - [ "=" "=>" @@ -95,9 +90,7 @@ (condition (any) @constant.macro) - ; Names - (name) @type (block_name) @constant @@ -107,7 +100,7 @@ (option_name) @constant.builtin ((option_name) @constant.macro - (#match? @constant.macro "^YY")) + (#match? @constant.macro "^YY")) (field_expression argument: (identifier) @variable) @@ -115,7 +108,6 @@ (field_identifier) @property ; Literals - (regex) @string.regexp [ @@ -142,7 +134,6 @@ ] @property ; Configurations - (define option: (option_name) @_yy value: (dstring) @type @@ -155,7 +146,6 @@ (host_lang) @none ; Punctuation - [ ":" ";" @@ -164,15 +154,22 @@ ] @punctuation.delimiter [ - "{" "}" - "[" "]" - "(" ")" - "<" ">" + "{" + "}" + "[" + "]" + "(" + ")" + "<" + ">" ] @punctuation.bracket (repetition (limits - ["{" "}"] @punctuation.bracket)) + [ + "{" + "}" + ] @punctuation.bracket)) [ "!" @@ -181,7 +178,6 @@ ] @punctuation.special ; Comments and error - [ (comment) (ignore_block) diff --git a/queries/re2c/indents.scm b/queries/re2c/indents.scm index 72539143a..31ccf2a0f 100644 --- a/queries/re2c/indents.scm +++ b/queries/re2c/indents.scm @@ -1,11 +1,11 @@ [ - (re2c) - (action) + (re2c) + (action) ] @indent.begin "}" @indent.branch @indent.end [ - (comment) - (linedir) + (comment) + (linedir) ] @indent.ignore diff --git a/queries/re2c/injections.scm b/queries/re2c/injections.scm index e5e40a09d..4f92ea051 100644 --- a/queries/re2c/injections.scm +++ b/queries/re2c/injections.scm @@ -2,8 +2,8 @@ (#set! injection.parent)) ((define - option: (option_name) @_yy - value: (dstring) @injection.content) + option: (option_name) @_yy + value: (dstring) @injection.content) (#any-of? @_yy "YYPEEK" "YYSKIP" "YYBACKUP" "YYBACKUPCTX" "YYRESTORE" "YYRESTORECTX" "YYFILL" "YYSHIFT") (#offset! @injection.content 0 1 0 -1) (#set! injection.parent)) diff --git a/queries/regex/highlights.scm b/queries/regex/highlights.scm index ddcf1d92a..977bfd3be 100644 --- a/queries/regex/highlights.scm +++ b/queries/regex/highlights.scm @@ -1,39 +1,47 @@ -;; Forked from tree-sitter-regex -;; The MIT License (MIT) Copyright (c) 2014 Max Brunsfeld +; Forked from tree-sitter-regex +; The MIT License (MIT) Copyright (c) 2014 Max Brunsfeld [ - "(" - ")" - "(?" - "(?:" - "(?<" - ">" - "[" - "]" - "{" - "}" + "(" + ")" + "(?" + "(?:" + "(?<" + ">" + "[" + "]" + "{" + "}" ] @punctuation.bracket (group_name) @property -;; These are escaped special characters that lost their special meaning -;; -> no special highlighting +; These are escaped special characters that lost their special meaning +; -> no special highlighting (identity_escape) @string.regexp (class_character) @constant [ - (control_letter_escape) - (character_class_escape) - (control_escape) - (boundary_assertion) - (non_boundary_assertion) + (control_letter_escape) + (character_class_escape) + (control_escape) + (boundary_assertion) + (non_boundary_assertion) ] @string.escape -[ "*" "+" "?" "|" "=" "!" "-"] @operator +[ + "*" + "+" + "?" + "|" + "=" + "!" + "-" +] @operator [ - (start_assertion) - (end_assertion) + (start_assertion) + (end_assertion) ] @punctuation.delimiter (any_character) @variable.builtin diff --git a/queries/rego/highlights.scm b/queries/rego/highlights.scm index 5abaf0fd5..b738eb9db 100644 --- a/queries/rego/highlights.scm +++ b/queries/rego/highlights.scm @@ -1,6 +1,6 @@ ; highlights.scm [ - (import) + (import) (package) ] @keyword.import @@ -35,17 +35,26 @@ (raw_string) ] @string -(term (ref (var))) @variable +(term + (ref + (var))) @variable (comment) @comment @spell (number) @number -(expr_call func_name: (fn_name (var) @function .)) +(expr_call + func_name: + (fn_name + (var) @function .)) -(expr_call func_arguments: (fn_args (expr) @variable.parameter)) +(expr_call + func_arguments: + (fn_args + (expr) @variable.parameter)) -(rule_args (term) @variable.parameter) +(rule_args + (term) @variable.parameter) [ (open_paren) @@ -56,9 +65,22 @@ (close_curly) ] @punctuation.bracket -(rule (rule_head (var) @function.method)) +(rule + (rule_head + (var) @function.method)) -(rule - (rule_head (term (ref (var) @module))) - (rule_body (query (literal (expr (expr_infix (expr (term (ref (var)) @_output)))))) (#eq? @_output @module)) -) +(rule + (rule_head + (term + (ref + (var) @module))) + (rule_body + (query + (literal + (expr + (expr_infix + (expr + (term + (ref + (var)) @_output)))))) + (#eq? @_output @module))) diff --git a/queries/rego/injections.scm b/queries/rego/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/rego/injections.scm +++ b/queries/rego/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/requirements/highlights.scm b/queries/requirements/highlights.scm index 921c3204b..a04922a26 100644 --- a/queries/requirements/highlights.scm +++ b/queries/requirements/highlights.scm @@ -1,41 +1,48 @@ -;; packages - +; packages (package) @variable -(extras (package) @variable.parameter) +(extras + (package) @variable.parameter) (path) @string.special.path (url) @string.special.url -;; versions - +; versions (version_cmp) @operator (version) @number -;; markers - +; markers (marker_var) @attribute (marker_op) @keyword.operator -;; options - +; options (option) @function "=" @operator -;; punctuation - -[ "[" "]" "(" ")" ] @punctuation.bracket - -[ "," ";" "@" ] @punctuation.delimiter +; punctuation +[ + "[" + "]" + "(" + ")" +] @punctuation.bracket -[ "${" "}" ] @punctuation.special +[ + "," + ";" + "@" +] @punctuation.delimiter -;; misc +[ + "${" + "}" +] @punctuation.special +; misc (env_var) @constant (quoted_string) @string diff --git a/queries/requirements/injections.scm b/queries/requirements/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/requirements/injections.scm +++ b/queries/requirements/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/rnoweb/folds.scm b/queries/rnoweb/folds.scm index f451a3f3b..893758ccd 100644 --- a/queries/rnoweb/folds.scm +++ b/queries/rnoweb/folds.scm @@ -1,3 +1 @@ -[ - (rchunk) -] @fold +(rchunk) @fold diff --git a/queries/rnoweb/highlights.scm b/queries/rnoweb/highlights.scm index ab365f266..81afaf101 100644 --- a/queries/rnoweb/highlights.scm +++ b/queries/rnoweb/highlights.scm @@ -1 +1 @@ -;; This file is a placeholder to enable the highlighting of injected languages. +; This file is a placeholder to enable the highlighting of injected languages. diff --git a/queries/rnoweb/injections.scm b/queries/rnoweb/injections.scm index 6b07ccdc4..123cfb8a3 100644 --- a/queries/rnoweb/injections.scm +++ b/queries/rnoweb/injections.scm @@ -1,6 +1,6 @@ ((latex) @injection.content - (#set! injection.language "latex") - (#set! injection.combined)) + (#set! injection.language "latex") + (#set! injection.combined)) (rchunk (renv_content) @injection.content diff --git a/queries/robot/highlights.scm b/queries/robot/highlights.scm index b5f7bd105..b9db02468 100644 --- a/queries/robot/highlights.scm +++ b/queries/robot/highlights.scm @@ -10,15 +10,24 @@ (test_case_setting) ] @keyword -(variable_definition (variable_name) @variable) -(keyword_definition (name) @function) -(test_case_definition (name) @function) +(variable_definition + (variable_name) @variable) + +(keyword_definition + (name) @function) + +(test_case_definition + (name) @function) + +(keyword_invocation + (keyword) @function.call) -(keyword_invocation (keyword) @function.call) (ellipses) @punctuation.delimiter (text_chunk) @string + (inline_python_expression) @string.special + [ (scalar_variable) (list_variable) @@ -26,7 +35,6 @@ ] @variable ; Control structures - [ "FOR" "IN" @@ -36,22 +44,36 @@ (break_statement) (continue_statement) ] @keyword.repeat -(for_statement "END" @keyword.repeat) + +(for_statement + "END" @keyword.repeat) "WHILE" @keyword.repeat -(while_statement "END" @keyword.repeat) + +(while_statement + "END" @keyword.repeat) [ "IF" "ELSE IF" ] @keyword.conditional -(if_statement "END" @keyword.conditional) -(if_statement (else_statement "ELSE" @keyword.conditional)) + +(if_statement + "END" @keyword.conditional) + +(if_statement + (else_statement + "ELSE" @keyword.conditional)) [ "TRY" "EXCEPT" "FINALLY" ] @keyword.exception -(try_statement "END" @keyword.exception) -(try_statement (else_statement "ELSE" @keyword.exception)) + +(try_statement + "END" @keyword.exception) + +(try_statement + (else_statement + "ELSE" @keyword.exception)) diff --git a/queries/robot/indents.scm b/queries/robot/indents.scm index ae34b83a2..a4d81c852 100644 --- a/queries/robot/indents.scm +++ b/queries/robot/indents.scm @@ -1,21 +1,45 @@ (keyword_definition) @indent.begin + (test_case_definition) @indent.begin (for_statement) @indent.begin -(for_statement "END" @indent.branch) + +(for_statement + "END" @indent.branch) + (for_statement - right: (_ (arguments (continuation (ellipses) @indent.branch)))) + right: + (_ + (arguments + (continuation + (ellipses) @indent.branch)))) (while_statement) @indent.begin -(while_statement "END" @indent.branch) + +(while_statement + "END" @indent.branch) (if_statement) @indent.begin -(if_statement (elseif_statement) @indent.branch) -(if_statement (else_statement) @indent.branch) -(if_statement "END" @indent.branch) + +(if_statement + (elseif_statement) @indent.branch) + +(if_statement + (else_statement) @indent.branch) + +(if_statement + "END" @indent.branch) (try_statement) @indent.begin -(try_statement (except_statement) @indent.branch) -(try_statement (finally_statement) @indent.branch) -(try_statement (else_statement) @indent.branch) -(try_statement "END" @indent.branch) + +(try_statement + (except_statement) @indent.branch) + +(try_statement + (finally_statement) @indent.branch) + +(try_statement + (else_statement) @indent.branch) + +(try_statement + "END" @indent.branch) diff --git a/queries/ron/highlights.scm b/queries/ron/highlights.scm index 4b0a87a50..0cdfe4404 100644 --- a/queries/ron/highlights.scm +++ b/queries/ron/highlights.scm @@ -1,52 +1,62 @@ ; Structs ;------------ - (enum_variant) @constant -(struct_entry (identifier) @property) -(struct_entry (enum_variant (identifier) @constant)) -(struct_name (identifier)) @type -(unit_struct) @type.builtin +(struct_entry + (identifier) @property) + +(struct_entry + (enum_variant + (identifier) @constant)) +(struct_name + (identifier)) @type + +(unit_struct) @type.builtin ; Literals ;------------ - (string) @string + (boolean) @boolean + (integer) @number + (float) @number.float -(char) @character +(char) @character ; Comments ;------------ - [ (line_comment) (block_comment) ] @comment @spell - ; Punctuation ;------------ +[ + "{" + "}" +] @punctuation.bracket -["{" "}"] @punctuation.bracket - -["(" ")"] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -["[" "]"] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket [ "," ":" ] @punctuation.delimiter -[ - "-" -] @operator +"-" @operator ; Special ;------------ - (escape_sequence) @string.escape diff --git a/queries/ron/indents.scm b/queries/ron/indents.scm index 7fd9a5ff2..689d01fac 100644 --- a/queries/ron/indents.scm +++ b/queries/ron/indents.scm @@ -5,8 +5,17 @@ (struct) ] @indent.begin -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch diff --git a/queries/ron/injections.scm b/queries/ron/injections.scm index c3522f945..3cd6aac8e 100644 --- a/queries/ron/injections.scm +++ b/queries/ron/injections.scm @@ -2,4 +2,4 @@ (line_comment) (block_comment) ] @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/ron/locals.scm b/queries/ron/locals.scm index 62ccbf09f..81e38d5ed 100644 --- a/queries/ron/locals.scm +++ b/queries/ron/locals.scm @@ -1,12 +1,25 @@ (source_file) @local.scope -(source_file (array) @local.scope) -(source_file (map) @local.scope) -(source_file (struct) @local.scope) -(source_file (tuple) @local.scope) + +(source_file + (array) @local.scope) + +(source_file + (map) @local.scope) + +(source_file + (struct) @local.scope) + +(source_file + (tuple) @local.scope) (identifier) @local.reference -(struct_entry (identifier) @local.definition.field) -(struct_entry (identifier) @local.definition.enum (enum_variant)) +(struct_entry + (identifier) @local.definition.field) + +(struct_entry + (identifier) @local.definition.enum + (enum_variant)) -(struct (struct_name) @local.definition.type) +(struct + (struct_name) @local.definition.type) diff --git a/queries/rst/highlights.scm b/queries/rst/highlights.scm index d83a21427..7d667eeea 100644 --- a/queries/rst/highlights.scm +++ b/queries/rst/highlights.scm @@ -1,5 +1,4 @@ -;; Marks - +; Marks [ ".." "|" @@ -14,24 +13,25 @@ "bullet" "adornment" ] @markup.list -;; Resets for injection +; Resets for injection (doctest_block) @none -;; Directives - +; Directives (directive name: (type) @function) (directive - body: (body (arguments) @variable.parameter)) + body: + (body + (arguments) @variable.parameter)) ((directive name: (type) @keyword.import) - (#eq? @keyword.import "include")) + (#eq? @keyword.import "include")) ((directive - name: (type) @function.builtin) + name: (type) @function.builtin) ; format-ignore (#any-of? @function.builtin ; https://docutils.sourceforge.io/docs/ref/rst/directives.html @@ -45,8 +45,7 @@ "replace" "unicode" "date" "raw" "class" "role" "default-role" "title" "restructuredtext-test-directive")) -;; Blocks - +; Blocks [ (literal_block) (line_block) @@ -68,18 +67,17 @@ name: (name)? @markup.link.label link: (_)? @markup.link) -;; Lists - +; Lists ; Definition lists (list_item (term) @markup.strong (classifier)? @markup.italic) ; Field lists -(field (field_name) @constant) - -;; Inline markup +(field + (field_name) @constant) +; Inline markup (emphasis) @markup.italic (strong) @markup.strong @@ -111,7 +109,7 @@ ":raw:")) [ - "interpreted_text" + "interpreted_text" (literal) ] @markup.raw @@ -119,33 +117,33 @@ ((interpreted_text (role) @_role "interpreted_text" @markup.italic) - (#eq? @_role ":emphasis:")) + (#eq? @_role ":emphasis:")) ((interpreted_text (role) @_role "interpreted_text" @markup.strong) - (#eq? @_role ":strong:")) + (#eq? @_role ":strong:")) ((interpreted_text (role) @_role "interpreted_text" @none) - (#eq? @_role ":math:")) + (#eq? @_role ":math:")) ; Suffix role ((interpreted_text "interpreted_text" @markup.italic (role) @_role) - (#eq? @_role ":emphasis:")) + (#eq? @_role ":emphasis:")) ((interpreted_text "interpreted_text" @markup.strong (role) @_role) - (#eq? @_role ":strong:")) + (#eq? @_role ":strong:")) ((interpreted_text "interpreted_text" @none (role) @_role) - (#eq? @_role ":math:")) + (#eq? @_role ":math:")) [ (inline_target) @@ -155,17 +153,19 @@ (reference) ] @markup.link @nospell -;; Others - +; Others (title) @markup.heading (comment) @comment @spell -(comment "..") @comment + +(comment + "..") @comment (directive - name: (type) @_directive - body: (body - (content) @spell - (#not-any-of? @_directive "code" "code-block" "sourcecode"))) + name: (type) @_directive + body: + (body + (content) @spell + (#not-any-of? @_directive "code" "code-block" "sourcecode"))) (paragraph) @spell diff --git a/queries/rst/injections.scm b/queries/rst/injections.scm index 7155b2a9b..e0bb380d2 100644 --- a/queries/rst/injections.scm +++ b/queries/rst/injections.scm @@ -1,80 +1,78 @@ ((doctest_block) @injection.content - (#set! injection.language "python")) - -;; Directives with nested content without arguments nor options + (#set! injection.language "python")) +; Directives with nested content without arguments nor options ((directive - name: (type) @_type - body: (body) @injection.content) - (#set! injection.language "rst") - (#any-of? - @_type - "attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition" - "line-block" "parsed-literal" "epigraph" "highlights" "pull-quote" "compound" - "header" "footer" - "meta" - "replace")) + name: (type) @_type + body: (body) @injection.content) + (#set! injection.language "rst") + (#any-of? @_type "attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition" "line-block" "parsed-literal" "epigraph" "highlights" "pull-quote" "compound" "header" "footer" "meta" "replace")) -;; Directives with nested content without arguments, but with options +; Directives with nested content without arguments, but with options ((directive - name: (type) @_type - body: (body (options) (content) @injection.content)) - (#set! injection.language "rst") - (#any-of? - @_type - "attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition" - "line-block" "parsed-literal" "compound")) + name: (type) @_type + body: + (body + (options) + (content) @injection.content)) + (#set! injection.language "rst") + (#any-of? @_type "attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition" "line-block" "parsed-literal" "compound")) -;; Directives with nested content with arguments and options +; Directives with nested content with arguments and options ((directive - name: (type) @_type - body: (body (content) @injection.content)) - (#set! injection.language "rst") - (#any-of? - @_type - "figure" - "topic" "sidebar" "container" - "table" "list-table" - "class" "role" "restructuredtext-test-directive")) + name: (type) @_type + body: + (body + (content) @injection.content)) + (#set! injection.language "rst") + (#any-of? @_type "figure" "topic" "sidebar" "container" "table" "list-table" "class" "role" "restructuredtext-test-directive")) -;; Special directives +; Special directives ((directive - name: (type) @_type - body: (body (arguments) @injection.language (content) @injection.content)) - (#any-of? @_type "code" "code-block" "sourcecode")) + name: (type) @_type + body: + (body + (arguments) @injection.language + (content) @injection.content)) + (#any-of? @_type "code" "code-block" "sourcecode")) ((directive - name: (type) @_type - body: (body (arguments) @injection.language (content) @injection.content)) - (#eq? @_type "raw")) + name: (type) @_type + body: + (body + (arguments) @injection.language + (content) @injection.content)) + (#eq? @_type "raw")) ((directive - name: (type) @_type - body: (body (content) @injection.content)) - (#set! injection.language "latex") - (#eq? @_type "math")) + name: (type) @_type + body: + (body + (content) @injection.content)) + (#set! injection.language "latex") + (#eq? @_type "math")) ; TODO: re-add when a parser for csv is added. ((directive - name: (type) @_type - body: (body (content) @injection.content)) - (#set! injection.language "csv") - (#eq? @_type "csv-table")) - -;; Special roles - prefix + name: (type) @_type + body: + (body + (content) @injection.content)) + (#set! injection.language "csv") + (#eq? @_type "csv-table")) +; Special roles - prefix ((interpreted_text (role) @_role "interpreted_text" @injection.content) - (#eq? @_role ":math:") - (#set! injection.language "latex")) - -;; Special roles - suffix + (#eq? @_role ":math:") + (#set! injection.language "latex")) +; Special roles - suffix ((interpreted_text "interpreted_text" @injection.content (role) @_role) - (#eq? @_role ":math:") - (#set! injection.language "latex")) + (#eq? @_role ":math:") + (#set! injection.language "latex")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/rst/locals.scm b/queries/rst/locals.scm index 3091064cb..477c4ef3b 100644 --- a/queries/rst/locals.scm +++ b/queries/rst/locals.scm @@ -1,11 +1,9 @@ -;; Scopes - +; Scopes (document) @local.scope (directive) @local.scope -;; Definitions - +; Definitions (title) @local.definition (substitution_definition @@ -26,15 +24,16 @@ ; The role directive can define a new role ((directive name: (type) @_type - body: (body (arguments) @local.definition)) - (#eq? @_type "role")) - -;; References + body: + (body + (arguments) @local.definition)) + (#eq? @_type "role")) +; References [ - (substitution_reference) - (footnote_reference) - (citation_reference) - (reference) - (role) + (substitution_reference) + (footnote_reference) + (citation_reference) + (reference) + (role) ] @local.reference diff --git a/queries/ruby/highlights.scm b/queries/ruby/highlights.scm index d68c11847..6b8bb591c 100644 --- a/queries/ruby/highlights.scm +++ b/queries/ruby/highlights.scm @@ -1,32 +1,31 @@ ; Variables - (identifier) @variable + (global_variable) @variable.global ; Keywords - [ - "alias" - "begin" - "class" - "do" - "end" - "ensure" - "module" - "rescue" - "then" - ] @keyword + "alias" + "begin" + "class" + "do" + "end" + "ensure" + "module" + "rescue" + "then" +] @keyword [ - "return" - "yield" + "return" + "yield" ] @keyword.return [ - "and" - "or" - "in" - "not" + "and" + "or" + "in" + "not" ] @keyword.operator [ @@ -38,139 +37,170 @@ "end" @keyword.function) [ - "case" - "else" - "elsif" - "if" - "unless" - "when" - "then" - ] @keyword.conditional + "case" + "else" + "elsif" + "if" + "unless" + "when" + "then" +] @keyword.conditional (if "end" @keyword.conditional) [ - "for" - "until" - "while" - "break" - "redo" - "retry" - "next" - ] @keyword.repeat + "for" + "until" + "while" + "break" + "redo" + "retry" + "next" +] @keyword.repeat (constant) @constant ((identifier) @type.qualifier - (#any-of? @type.qualifier "private" "protected" "public")) + (#any-of? @type.qualifier "private" "protected" "public")) [ - "rescue" - "ensure" - ] @keyword.exception + "rescue" + "ensure" +] @keyword.exception ((identifier) @keyword.exception - (#any-of? @keyword.exception "fail" "raise")) + (#any-of? @keyword.exception "fail" "raise")) ; Function calls - "defined?" @function (call - receiver: (constant)? @type - method: [ - (identifier) - (constant) - ] @function.call - ) + receiver: (constant)? @type + method: + [ + (identifier) + (constant) + ] @function.call) (program - (call - (identifier) @keyword.import) - (#any-of? @keyword.import "require" "require_relative" "load")) + (call + (identifier) @keyword.import) + (#any-of? @keyword.import "require" "require_relative" "load")) ; Function definitions +(alias + (identifier) @function) + +(setter + (identifier) @function) + +(method + name: + [ + (identifier) @function + (constant) @type + ]) -(alias (identifier) @function) -(setter (identifier) @function) +(singleton_method + name: + [ + (identifier) @function + (constant) @type + ]) -(method name: [ - (identifier) @function - (constant) @type - ]) +(class + name: (constant) @type) -(singleton_method name: [ - (identifier) @function - (constant) @type - ]) +(module + name: (constant) @type) -(class name: (constant) @type) -(module name: (constant) @type) -(superclass (constant) @type) +(superclass + (constant) @type) ; Identifiers [ - (class_variable) - (instance_variable) - ] @label + (class_variable) + (instance_variable) +] @label ((identifier) @constant.builtin - (#match? @constant.builtin "^__(callee|dir|id|method|send|ENCODING|FILE|LINE)__$")) + (#match? @constant.builtin "^__(callee|dir|id|method|send|ENCODING|FILE|LINE)__$")) ((constant) @type - (#not-lua-match? @type "^[A-Z0-9_]+$")) + (#not-lua-match? @type "^[A-Z0-9_]+$")) [ - (self) - (super) - ] @variable.builtin + (self) + (super) +] @variable.builtin + +(method_parameters + (identifier) @variable.parameter) + +(lambda_parameters + (identifier) @variable.parameter) + +(block_parameters + (identifier) @variable.parameter) -(method_parameters (identifier) @variable.parameter) -(lambda_parameters (identifier) @variable.parameter) -(block_parameters (identifier) @variable.parameter) -(splat_parameter (identifier) @variable.parameter) -(hash_splat_parameter (identifier) @variable.parameter) -(optional_parameter (identifier) @variable.parameter) -(destructured_parameter (identifier) @variable.parameter) -(block_parameter (identifier) @variable.parameter) -(keyword_parameter (identifier) @variable.parameter) +(splat_parameter + (identifier) @variable.parameter) + +(hash_splat_parameter + (identifier) @variable.parameter) + +(optional_parameter + (identifier) @variable.parameter) + +(destructured_parameter + (identifier) @variable.parameter) + +(block_parameter + (identifier) @variable.parameter) + +(keyword_parameter + (identifier) @variable.parameter) ; TODO: Re-enable this once it is supported ; ((identifier) @function ; (#is-not? local)) - ; Literals - [ - (string) - (bare_string) - (subshell) - (heredoc_body) - ] @string + (string) + (bare_string) + (subshell) + (heredoc_body) +] @string [ - (heredoc_beginning) - (heredoc_end) - ] @constant + (heredoc_beginning) + (heredoc_end) +] @constant [ - (bare_symbol) - (simple_symbol) - (delimited_symbol) - (hash_key_symbol) - ] @string.special.symbol + (bare_symbol) + (simple_symbol) + (delimited_symbol) + (hash_key_symbol) +] @string.special.symbol + +(pair + key: (hash_key_symbol) + ":" @constant) -(pair key: (hash_key_symbol) ":" @constant) (regex) @string.regexp + (escape_sequence) @string.escape + (integer) @number + (float) @number.float [ - (true) - (false) - ] @boolean + (true) + (false) +] @boolean (nil) @constant.builtin @@ -182,75 +212,76 @@ (module (comment)+ @comment.documentation - (body_statement (class))) + (body_statement + (class))) (class (comment)+ @comment.documentation - (body_statement (method))) + (body_statement + (method))) (body_statement (comment)+ @comment.documentation (method)) ; Operators - [ - "!" - "=" - "==" - "===" - "<=>" - "=>" - "->" - ">>" - "<<" - ">" - "<" - ">=" - "<=" - "**" - "*" - "/" - "%" - "+" - "-" - "&" - "|" - "^" - "&&" - "||" - "||=" - "&&=" - "!=" - "%=" - "+=" - "-=" - "*=" - "/=" - "=~" - "!~" - "?" - ":" - ".." - "..." - ] @operator + "!" + "=" + "==" + "===" + "<=>" + "=>" + "->" + ">>" + "<<" + ">" + "<" + ">=" + "<=" + "**" + "*" + "/" + "%" + "+" + "-" + "&" + "|" + "^" + "&&" + "||" + "||=" + "&&=" + "!=" + "%=" + "+=" + "-=" + "*=" + "/=" + "=~" + "!~" + "?" + ":" + ".." + "..." +] @operator [ - "," - ";" - "." - ] @punctuation.delimiter + "," + ";" + "." +] @punctuation.delimiter [ - "(" - ")" - "[" - "]" - "{" - "}" - "%w(" - "%i(" - ] @punctuation.bracket + "(" + ")" + "[" + "]" + "{" + "}" + "%w(" + "%i(" +] @punctuation.bracket (interpolation "#{" @punctuation.special diff --git a/queries/ruby/injections.scm b/queries/ruby/injections.scm index 381d96b2f..7d8be5b23 100644 --- a/queries/ruby/injections.scm +++ b/queries/ruby/injections.scm @@ -1,11 +1,11 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) (heredoc_body - (heredoc_content) @injection.content - (heredoc_end) @injection.language - (#downcase! @injection.language)) + (heredoc_content) @injection.content + (heredoc_end) @injection.language + (#downcase! @injection.language)) -(regex - (string_content) @injection.content +(regex + (string_content) @injection.content (#set! injection.language "regex")) diff --git a/queries/ruby/locals.scm b/queries/ruby/locals.scm index f08dcd49f..2a27c93a2 100644 --- a/queries/ruby/locals.scm +++ b/queries/ruby/locals.scm @@ -19,37 +19,77 @@ ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ; SOFTWARE. - -;;; DECLARATIONS AND SCOPES +; DECLARATIONS AND SCOPES (method) @local.scope + (class) @local.scope [ - (block) - (do_block) - ] @local.scope + (block) + (do_block) +] @local.scope (identifier) @local.reference + (constant) @local.reference + (instance_variable) @local.reference -(module name: (constant) @local.definition.namespace) -(class name: (constant) @local.definition.type) -(method name: [(identifier) (constant)] @local.definition.function) -(singleton_method name: [(identifier) (constant)] @local.definition.function) +(module + name: (constant) @local.definition.namespace) + +(class + name: (constant) @local.definition.type) + +(method + name: + [ + (identifier) + (constant) + ] @local.definition.function) + +(singleton_method + name: + [ + (identifier) + (constant) + ] @local.definition.function) + +(method_parameters + (identifier) @local.definition.var) + +(lambda_parameters + (identifier) @local.definition.var) + +(block_parameters + (identifier) @local.definition.var) + +(splat_parameter + (identifier) @local.definition.var) + +(hash_splat_parameter + (identifier) @local.definition.var) + +(optional_parameter + name: (identifier) @local.definition.var) + +(destructured_parameter + (identifier) @local.definition.var) + +(block_parameter + name: (identifier) @local.definition.var) + +(keyword_parameter + name: (identifier) @local.definition.var) + +(assignment + left: (_) @local.definition.var) -(method_parameters (identifier) @local.definition.var) -(lambda_parameters (identifier) @local.definition.var) -(block_parameters (identifier) @local.definition.var) -(splat_parameter (identifier) @local.definition.var) -(hash_splat_parameter (identifier) @local.definition.var) -(optional_parameter name: (identifier) @local.definition.var) -(destructured_parameter (identifier) @local.definition.var) -(block_parameter name: (identifier) @local.definition.var) -(keyword_parameter name: (identifier) @local.definition.var) +(left_assignment_list + (identifier) @local.definition.var) -(assignment left: (_) @local.definition.var) +(rest_assignment + (identifier) @local.definition.var) -(left_assignment_list (identifier) @local.definition.var) -(rest_assignment (identifier) @local.definition.var) -(destructured_left_assignment (identifier) @local.definition.var) +(destructured_left_assignment + (identifier) @local.definition.var) diff --git a/queries/rust/folds.scm b/queries/rust/folds.scm index 6372e6dfb..8d0b014fb 100644 --- a/queries/rust/folds.scm +++ b/queries/rust/folds.scm @@ -8,10 +8,8 @@ (impl_item) (type_item) (union_item) - (use_declaration) (let_declaration) - (loop_expression) (for_expression) (while_expression) @@ -19,9 +17,7 @@ (match_expression) (call_expression) (array_expression) - (macro_definition) (macro_invocation) - (attribute_item) ] @fold diff --git a/queries/rust/highlights.scm b/queries/rust/highlights.scm index a262b6f08..2928271a3 100644 --- a/queries/rust/highlights.scm +++ b/queries/rust/highlights.scm @@ -1,9 +1,7 @@ ; Forked from https://github.com/tree-sitter/tree-sitter-rust ; Copyright (c) 2017 Maxim Sokolov ; Licensed under the MIT license. - ; Identifier conventions - (identifier) @variable ((identifier) @type @@ -13,77 +11,84 @@ name: (identifier) @constant) ; Assume all-caps names are constants - ((identifier) @constant (#lua-match? @constant "^[A-Z][A-Z%d_]*$")) ; Other identifiers - (type_identifier) @type (primitive_type) @type.builtin (field_identifier) @variable.member -(shorthand_field_initializer (identifier) @variable.member) +(shorthand_field_initializer + (identifier) @variable.member) (mod_item name: (identifier) @module) (self) @variable.builtin -(label ["'" (identifier)] @label) +(label + [ + "'" + (identifier) + ] @label) ; Function definitions +(function_item + (identifier) @function) -(function_item (identifier) @function) +(function_signature_item + (identifier) @function) -(function_signature_item (identifier) @function) +(parameter + (identifier) @variable.parameter) -(parameter (identifier) @variable.parameter) - -(closure_parameters (_) @variable.parameter) +(closure_parameters + (_) @variable.parameter) ; Function calls - (call_expression function: (identifier) @function.call) (call_expression - function: (scoped_identifier - (identifier) @function.call .)) + function: + (scoped_identifier + (identifier) @function.call .)) (call_expression - function: (field_expression - field: (field_identifier) @function.call)) + function: + (field_expression + field: (field_identifier) @function.call)) (generic_function function: (identifier) @function.call) (generic_function - function: (scoped_identifier - name: (identifier) @function.call)) + function: + (scoped_identifier + name: (identifier) @function.call)) (generic_function - function: (field_expression - field: (field_identifier) @function.call)) + function: + (field_expression + field: (field_identifier) @function.call)) ; Assume other uppercase names are enum constructors - ((field_identifier) @constant - (#lua-match? @constant "^[A-Z]")) + (#lua-match? @constant "^[A-Z]")) (enum_variant name: (identifier) @constant) ; Assume that uppercase names in paths are types - (scoped_identifier path: (identifier) @module) (scoped_identifier - (scoped_identifier - name: (identifier) @module)) + (scoped_identifier + name: (identifier) @module)) (scoped_type_identifier path: (identifier) @module) @@ -93,20 +98,20 @@ (#lua-match? @type "^[A-Z]")) (scoped_type_identifier - (scoped_identifier - name: (identifier) @module)) + (scoped_identifier + name: (identifier) @module)) ((scoped_identifier path: (identifier) @type) - (#lua-match? @type "^[A-Z]")) + (#lua-match? @type "^[A-Z]")) ((scoped_identifier - name: (identifier) @type) - (#lua-match? @type "^[A-Z]")) + name: (identifier) @type) + (#lua-match? @type "^[A-Z]")) ((scoped_identifier - name: (identifier) @constant) - (#lua-match? @constant "^[A-Z][A-Z%d_]*$")) + name: (identifier) @constant) + (#lua-match? @constant "^[A-Z][A-Z%d_]*$")) ((scoped_identifier path: (identifier) @type @@ -129,69 +134,85 @@ path: (identifier) @module) (scoped_use_list - path: (scoped_identifier - (identifier) @module)) + path: + (scoped_identifier + (identifier) @module)) -(use_list (scoped_identifier (identifier) @module . (_))) +(use_list + (scoped_identifier + (identifier) @module + . + (_))) -(use_list (identifier) @type (#lua-match? @type "^[A-Z]")) +(use_list + (identifier) @type + (#lua-match? @type "^[A-Z]")) -(use_as_clause alias: (identifier) @type (#lua-match? @type "^[A-Z]")) +(use_as_clause + alias: (identifier) @type + (#lua-match? @type "^[A-Z]")) ; Correct enum constructors - (call_expression - function: (scoped_identifier - "::" - name: (identifier) @constant) + function: + (scoped_identifier + "::" + name: (identifier) @constant) (#lua-match? @constant "^[A-Z]")) ; Assume uppercase names in a match arm are constants. - ((match_arm - pattern: (match_pattern (identifier) @constant)) - (#lua-match? @constant "^[A-Z]")) + pattern: + (match_pattern + (identifier) @constant)) + (#lua-match? @constant "^[A-Z]")) ((match_arm - pattern: (match_pattern - (scoped_identifier - name: (identifier) @constant))) - (#lua-match? @constant "^[A-Z]")) + pattern: + (match_pattern + (scoped_identifier + name: (identifier) @constant))) + (#lua-match? @constant "^[A-Z]")) ((identifier) @constant.builtin - (#any-of? @constant.builtin "Some" "None" "Ok" "Err")) + (#any-of? @constant.builtin "Some" "None" "Ok" "Err")) ; Macro definitions - "$" @function.macro (metavariable) @function.macro -(macro_definition "macro_rules!" @function.macro) +(macro_definition + "macro_rules!" @function.macro) ; Attribute macros +(attribute_item + (attribute + (identifier) @function.macro)) -(attribute_item (attribute (identifier) @function.macro)) -(inner_attribute_item (attribute (identifier) @function.macro)) +(inner_attribute_item + (attribute + (identifier) @function.macro)) -(attribute (scoped_identifier (identifier) @function.macro .)) +(attribute + (scoped_identifier + (identifier) @function.macro .)) ; Derive macros (assume all arguments are types) ; (attribute ; (identifier) @_name ; arguments: (attribute (attribute (identifier) @type)) ; (#eq? @_name "derive")) - ; Function-like macros (macro_invocation macro: (identifier) @function.macro) (macro_invocation - macro: (scoped_identifier - (identifier) @function.macro .)) + macro: + (scoped_identifier + (identifier) @function.macro .)) ; Literals - [ (line_comment) (block_comment) @@ -228,13 +249,13 @@ (char_literal) @character ; Keywords - [ "use" "mod" ] @keyword.import -(use_as_clause "as" @keyword.import) +(use_as_clause + "as" @keyword.import) [ "default" @@ -258,7 +279,7 @@ [ "ref" - (mutable_specifier) + (mutable_specifier) ] @type.qualifier [ @@ -268,7 +289,11 @@ "extern" ] @keyword.storage -(lifetime ["'" (identifier)] @keyword.storage.lifetime) +(lifetime + [ + "'" + (identifier) + ] @keyword.storage.lifetime) "fn" @keyword.function @@ -277,17 +302,31 @@ "yield" ] @keyword.return -(type_cast_expression "as" @keyword.operator) +(type_cast_expression + "as" @keyword.operator) -(qualified_type "as" @keyword.operator) +(qualified_type + "as" @keyword.operator) -(use_list (self) @module) +(use_list + (self) @module) -(scoped_use_list (self) @module) +(scoped_use_list + (self) @module) -(scoped_identifier [(crate) (super) (self)] @module) +(scoped_identifier + [ + (crate) + (super) + (self) + ] @module) -(visibility_modifier [(crate) (super) (self)] @module) +(visibility_modifier + [ + (crate) + (super) + (self) + ] @module) [ "if" @@ -304,10 +343,11 @@ ] @keyword.repeat "for" @keyword -(for_expression "for" @keyword.repeat) -; Operators +(for_expression + "for" @keyword.repeat) +; Operators [ "!" "!=" @@ -346,28 +386,66 @@ ] @operator ; Punctuation +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket -["(" ")" "[" "]" "{" "}"] @punctuation.bracket - -(closure_parameters "|" @punctuation.bracket) +(closure_parameters + "|" @punctuation.bracket) -(type_arguments ["<" ">"] @punctuation.bracket) +(type_arguments + [ + "<" + ">" + ] @punctuation.bracket) -(type_parameters ["<" ">"] @punctuation.bracket) +(type_parameters + [ + "<" + ">" + ] @punctuation.bracket) -(bracketed_type ["<" ">"] @punctuation.bracket) +(bracketed_type + [ + "<" + ">" + ] @punctuation.bracket) -(for_lifetimes ["<" ">"] @punctuation.bracket) +(for_lifetimes + [ + "<" + ">" + ] @punctuation.bracket) -["," "." ":" "::" ";" "->" "=>"] @punctuation.delimiter +[ + "," + "." + ":" + "::" + ";" + "->" + "=>" +] @punctuation.delimiter -(attribute_item "#" @punctuation.special) +(attribute_item + "#" @punctuation.special) -(inner_attribute_item ["!" "#"] @punctuation.special) +(inner_attribute_item + [ + "!" + "#" + ] @punctuation.special) -(macro_invocation "!" @function.macro) +(macro_invocation + "!" @function.macro) -(empty_type "!" @type.builtin) +(empty_type + "!" @type.builtin) (macro_invocation macro: (identifier) @keyword.exception diff --git a/queries/rust/indents.scm b/queries/rust/indents.scm index 0546efd25..6b9166518 100644 --- a/queries/rust/indents.scm +++ b/queries/rust/indents.scm @@ -23,24 +23,48 @@ (token_tree) (macro_definition) ] @indent.begin -(trait_item body: (_) @indent.begin) -(string_literal (escape_sequence)) @indent.begin -(block "}" @indent.end) +(trait_item + body: (_) @indent.begin) + +(string_literal + (escape_sequence)) @indent.begin + +(block + "}" @indent.end) + (enum_item - body: (enum_variant_list "}" @indent.end)) + body: + (enum_variant_list + "}" @indent.end)) + (impl_item - body: (declaration_list "}" @indent.end)) + body: + (declaration_list + "}" @indent.end)) + (match_expression - body: (match_block "}" @indent.end)) + body: + (match_block + "}" @indent.end)) + (mod_item - body: (declaration_list "}" @indent.end)) + body: + (declaration_list + "}" @indent.end)) + (struct_item - body: (field_declaration_list "}" @indent.end)) + body: + (field_declaration_list + "}" @indent.end)) + (trait_item - body: (declaration_list "}" @indent.end)) + body: + (declaration_list + "}" @indent.end)) -(impl_item (where_clause) @indent.dedent) +(impl_item + (where_clause) @indent.dedent) [ "where" @@ -48,13 +72,13 @@ "]" "}" ] @indent.branch -(impl_item (declaration_list) @indent.branch) + +(impl_item + (declaration_list) @indent.branch) [ (line_comment) (string_literal) ] @indent.ignore - (raw_string_literal) @indent.auto - diff --git a/queries/rust/injections.scm b/queries/rust/injections.scm index d3abc13a6..b245e3b64 100644 --- a/queries/rust/injections.scm +++ b/queries/rust/injections.scm @@ -1,9 +1,10 @@ (macro_invocation - (token_tree) @injection.content (#set! injection.language "rust")) + (token_tree) @injection.content + (#set! injection.language "rust")) (macro_definition (macro_rule - left: (token_tree_pattern) @injection.content + left: (token_tree_pattern) @injection.content (#set! injection.language "rust"))) (macro_definition @@ -15,28 +16,39 @@ (line_comment) (block_comment) ] @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((macro_invocation - macro: ((identifier) @injection.language) - (token_tree) @injection.content) - (#eq? @injection.language "html")) + macro: + ((identifier) @injection.language) + (token_tree) @injection.content) + (#eq? @injection.language "html")) (call_expression - function: (scoped_identifier - path: (identifier) @_regex (#eq? @_regex "Regex") - name: (identifier) @_new (#eq? @_new "new")) - arguments: (arguments - (raw_string_literal) @injection.content) - (#set! injection.language "regex")) + function: + (scoped_identifier + path: (identifier) @_regex + (#eq? @_regex "Regex") + name: (identifier) @_new + (#eq? @_new "new")) + arguments: + (arguments + (raw_string_literal) @injection.content) + (#set! injection.language "regex")) (call_expression - function: (scoped_identifier - path: (scoped_identifier (identifier) @_regex (#eq? @_regex "Regex").) - name: (identifier) @_new (#eq? @_new "new")) - arguments: (arguments - (raw_string_literal) @injection.content) - (#set! injection.language "regex")) + function: + (scoped_identifier + path: + (scoped_identifier + (identifier) @_regex + (#eq? @_regex "Regex") .) + name: (identifier) @_new + (#eq? @_new "new")) + arguments: + (arguments + (raw_string_literal) @injection.content) + (#set! injection.language "regex")) ((block_comment) @injection.content (#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c") diff --git a/queries/rust/locals.scm b/queries/rust/locals.scm index 24e2ffb0a..bba614536 100644 --- a/queries/rust/locals.scm +++ b/queries/rust/locals.scm @@ -1,42 +1,45 @@ ; Imports (extern_crate_declaration - name: (identifier) @local.definition.import) + name: (identifier) @local.definition.import) -(use_declaration - argument: (scoped_identifier - name: (identifier) @local.definition.import)) +(use_declaration + argument: + (scoped_identifier + name: (identifier) @local.definition.import)) -(use_as_clause +(use_as_clause alias: (identifier) @local.definition.import) (use_list - (identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio}; + (identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio}; ; Functions -(function_item - name: (identifier) @local.definition.function) +(function_item + name: (identifier) @local.definition.function) -(function_item +(function_item name: (identifier) @local.definition.method - parameters: (parameters - (self_parameter))) + parameters: + (parameters + (self_parameter))) ; Variables -(parameter - pattern: (identifier) @local.definition.var) +(parameter + pattern: (identifier) @local.definition.var) -(let_declaration +(let_declaration pattern: (identifier) @local.definition.var) -(const_item +(const_item name: (identifier) @local.definition.var) (tuple_pattern - (identifier) @local.definition.var) + (identifier) @local.definition.var) (let_condition - pattern: (_ - (identifier) @local.definition.var)) + pattern: + (_ + (identifier) @local.definition.var)) (tuple_struct_pattern (identifier) @local.definition.var) @@ -47,57 +50,55 @@ (self_parameter (self) @local.definition.var) -(for_expression +(for_expression pattern: (identifier) @local.definition.var) ; Types (struct_item name: (type_identifier) @local.definition.type) -(constrained_type_parameter +(constrained_type_parameter left: (type_identifier) @local.definition.type) ; the P in remove_file<P: AsRef<Path>>(path: P) (enum_item name: (type_identifier) @local.definition.type) - ; Fields (field_declaration name: (field_identifier) @local.definition.field) (enum_variant - name: (identifier) @local.definition.field) + name: (identifier) @local.definition.field) ; References (identifier) @local.reference + ((type_identifier) @local.reference - (#set! reference.kind "type")) -((field_identifier) @local.reference - (#set! reference.kind "field")) + (#set! reference.kind "type")) +((field_identifier) @local.reference + (#set! reference.kind "field")) ; Macros (macro_definition name: (identifier) @local.definition.macro) ; Module -(mod_item +(mod_item name: (identifier) @local.definition.namespace) ; Scopes [ - (block) - (function_item) - (closure_expression) - (while_expression) - (for_expression) - (loop_expression) - (if_expression) - (match_expression) - (match_arm) - - (struct_item) - (enum_item) - (impl_item) + (block) + (function_item) + (closure_expression) + (while_expression) + (for_expression) + (loop_expression) + (if_expression) + (match_expression) + (match_arm) + (struct_item) + (enum_item) + (impl_item) ] @local.scope - diff --git a/queries/scala/folds.scm b/queries/scala/folds.scm index e748e86df..b0f08188e 100644 --- a/queries/scala/folds.scm +++ b/queries/scala/folds.scm @@ -1,15 +1,16 @@ -(call_expression (block) @fold) +(call_expression + (block) @fold) -[(class_definition) - (trait_definition) - (object_definition) - (function_definition) - (val_definition) - (import_declaration) - - (while_expression) - (do_while_expression) - (for_expression) - (try_expression) - (match_expression) +[ + (class_definition) + (trait_definition) + (object_definition) + (function_definition) + (val_definition) + (import_declaration) + (while_expression) + (do_while_expression) + (for_expression) + (try_expression) + (match_expression) ] @fold diff --git a/queries/scala/highlights.scm b/queries/scala/highlights.scm index 2c483c46b..e4d219f40 100644 --- a/queries/scala/highlights.scm +++ b/queries/scala/highlights.scm @@ -1,5 +1,4 @@ ; CREDITS @stumash (stuart.mashaal@gmail.com) - (class_definition name: (identifier) @type) @@ -18,25 +17,26 @@ (simple_enum_case name: (identifier) @type) -;; variables - -(class_parameter +; variables +(class_parameter name: (identifier) @variable.parameter) -(self_type (identifier) @variable.parameter) +(self_type + (identifier) @variable.parameter) -(interpolation (identifier) @none) -(interpolation (block) @none) +(interpolation + (identifier) @none) -;; types +(interpolation + (block) @none) +; types (type_definition name: (type_identifier) @type.definition) (type_identifier) @type -;; val/var definitions/declarations - +; val/var definitions/declarations (val_definition pattern: (identifier) @variable) @@ -50,35 +50,46 @@ name: (identifier) @variable) ; method definition - (function_declaration - name: (identifier) @function.method) + name: (identifier) @function.method) (function_definition - name: (identifier) @function.method) + name: (identifier) @function.method) ; imports/exports - (import_declaration path: (identifier) @module) -((stable_identifier (identifier) @module)) + +((stable_identifier + (identifier) @module)) ((import_declaration - path: (identifier) @type) (#lua-match? @type "^[A-Z]")) -((stable_identifier (identifier) @type) (#lua-match? @type "^[A-Z]")) + path: (identifier) @type) + (#lua-match? @type "^[A-Z]")) + +((stable_identifier + (identifier) @type) + (#lua-match? @type "^[A-Z]")) (export_declaration path: (identifier) @module) -((stable_identifier (identifier) @module)) + +((stable_identifier + (identifier) @module)) ((export_declaration - path: (identifier) @type) (#lua-match? @type "^[A-Z]")) -((stable_identifier (identifier) @type) (#lua-match? @type "^[A-Z]")) + path: (identifier) @type) + (#lua-match? @type "^[A-Z]")) -((namespace_selectors (identifier) @type) (#lua-match? @type "^[A-Z]")) +((stable_identifier + (identifier) @type) + (#lua-match? @type "^[A-Z]")) -; method invocation +((namespace_selectors + (identifier) @type) + (#lua-match? @type "^[A-Z]")) +; method invocation (call_expression function: (identifier) @function.call) @@ -86,12 +97,13 @@ function: (operator_identifier) @function.call) (call_expression - function: (field_expression - field: (identifier) @function.method.call)) + function: + (field_expression + field: (identifier) @function.method.call)) ((call_expression - function: (identifier) @constructor) - (#lua-match? @constructor "^[A-Z]")) + function: (identifier) @constructor) + (#lua-match? @constructor "^[A-Z]")) (generic_function function: (identifier) @function.call) @@ -100,7 +112,6 @@ interpolator: (identifier) @function.call) ; function definitions - (function_definition name: (identifier) @function) @@ -111,20 +122,30 @@ name: (identifier) @variable.parameter) ; expressions +(field_expression + field: (identifier) @property) -(field_expression field: (identifier) @property) -(field_expression value: (identifier) @type - (#lua-match? @type "^[A-Z]")) +(field_expression + value: (identifier) @type + (#lua-match? @type "^[A-Z]")) -(infix_expression operator: (identifier) @operator) -(infix_expression operator: (operator_identifier) @operator) -(infix_type operator: (operator_identifier) @operator) -(infix_type operator: (operator_identifier) @operator) +(infix_expression + operator: (identifier) @operator) -; literals +(infix_expression + operator: (operator_identifier) @operator) + +(infix_type + operator: (operator_identifier) @operator) +(infix_type + operator: (operator_identifier) @operator) + +; literals (boolean_literal) @boolean + (integer_literal) @number + (floating_point_literal) @number.float [ @@ -135,13 +156,16 @@ (symbol_literal) @string.special.symbol -(interpolation "$" @punctuation.special) - -;; keywords +(interpolation + "$" @punctuation.special) +; keywords (opaque_modifier) @type.qualifier + (infix_modifier) @keyword + (transparent_modifier) @type.qualifier + (open_modifier) @type.qualifier [ @@ -151,8 +175,8 @@ "extends" "derives" "finally" -;; `forSome` existential types not implemented yet -;; `macro` not implemented yet + ; `forSome` existential types not implemented yet + ; `macro` not implemented yet "object" "override" "package" @@ -186,8 +210,7 @@ (annotation) @attribute -;; special keywords - +; special keywords "new" @keyword.operator [ @@ -198,17 +221,17 @@ ] @keyword.conditional [ - "(" - ")" - "[" - "]" - "{" - "}" -] @punctuation.bracket + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket [ - "." - "," + "." + "," ] @punctuation.delimiter [ @@ -221,12 +244,15 @@ "def" @keyword.function [ - "=>" - "<-" - "@" + "=>" + "<-" + "@" ] @operator -["import" "export"] @keyword.import +[ + "import" + "export" +] @keyword.import [ "try" @@ -244,22 +270,23 @@ ((block_comment) @comment.documentation (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$")) -;; `case` is a conditional keyword in case_block - +; `case` is a conditional keyword in case_block (case_block - (case_clause ("case") @keyword.conditional)) + (case_clause + ("case") @keyword.conditional)) (operator_identifier) @operator -((identifier) @type (#lua-match? @type "^[A-Z]")) +((identifier) @type + (#lua-match? @type "^[A-Z]")) + ((identifier) @variable.builtin - (#lua-match? @variable.builtin "^this$")) + (#lua-match? @variable.builtin "^this$")) -( - (identifier) @function.builtin - (#lua-match? @function.builtin "^super$") -) +((identifier) @function.builtin + (#lua-match? @function.builtin "^super$")) -;; Scala CLI using directives +; Scala CLI using directives (using_directive_key) @variable.parameter + (using_directive_value) @string diff --git a/queries/scala/injections.scm b/queries/scala/injections.scm index aebb54d93..1c2fe3cc9 100644 --- a/queries/scala/injections.scm +++ b/queries/scala/injections.scm @@ -1,5 +1,5 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((block_comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/scala/locals.scm b/queries/scala/locals.scm index 689b140b3..ec205c4e1 100644 --- a/queries/scala/locals.scm +++ b/queries/scala/locals.scm @@ -1,5 +1,4 @@ ; Scopes - [ (template_body) (lambda_expression) @@ -9,16 +8,15 @@ ] @local.scope ; References - (identifier) @local.reference ; Definitions - (function_declaration name: (identifier) @local.definition.function) (function_definition - name: ((identifier) @local.definition.function) + name: + ((identifier) @local.definition.function) (#set! definition.var.scope parent)) (parameter @@ -46,7 +44,8 @@ name: (identifier) @local.definition.var) (for_expression - enumerators: (enumerators - (enumerator - (tuple_pattern - (identifier) @local.definition.var)))) + enumerators: + (enumerators + (enumerator + (tuple_pattern + (identifier) @local.definition.var)))) diff --git a/queries/scfg/highlights.scm b/queries/scfg/highlights.scm index 0fcfa7c9b..058f3e3d4 100644 --- a/queries/scfg/highlights.scm +++ b/queries/scfg/highlights.scm @@ -1,8 +1,10 @@ [ - "{" - "}" + "{" + "}" ] @punctuation.bracket (comment) @comment @spell + (directive_name) @type + (directive_params) @variable.parameter diff --git a/queries/scfg/injections.scm b/queries/scfg/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/scfg/injections.scm +++ b/queries/scfg/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/scheme/folds.scm b/queries/scheme/folds.scm index 64a9a08e6..115809a77 100644 --- a/queries/scheme/folds.scm +++ b/queries/scheme/folds.scm @@ -1 +1,2 @@ -(program (list) @fold) +(program + (list) @fold) diff --git a/queries/scheme/highlights.scm b/queries/scheme/highlights.scm index fdd494d8b..202a6ab16 100644 --- a/queries/scheme/highlights.scm +++ b/queries/scheme/highlights.scm @@ -1,108 +1,103 @@ -;; A highlight query can override the highlights queries before it. -;; So the order is important. -;; We should highlight general rules, then highlight special forms. - +; A highlight query can override the highlights queries before it. +; So the order is important. +; We should highlight general rules, then highlight special forms. (number) @number + (character) @character + (boolean) @boolean + (string) @string -[(comment) - (block_comment)] @comment @spell -;; highlight for datum comment -;; copied from ../clojure/highlights.scm -([(comment) (directive)] @comment - (#set! "priority" 105)) +[ + (comment) + (block_comment) +] @comment @spell -(escape_sequence) @string.escape +; highlight for datum comment +; copied from ../clojure/highlights.scm +([ + (comment) + (directive) +] @comment + (#set! "priority" 105)) -["(" ")" "[" "]" "{" "}"] @punctuation.bracket +(escape_sequence) @string.escape -;; variables +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket +; variables (symbol) @variable -((symbol) @variable.builtin - (#any-of? @variable.builtin "..." ".")) -;; procedure +((symbol) @variable.builtin + (#any-of? @variable.builtin "..." ".")) +; procedure (list - . - (symbol) @function) - -;; special forms + . + (symbol) @function) +; special forms (list - "[" - (symbol)+ @variable - "]") + "[" + (symbol)+ @variable + "]") (list - . - (symbol) @_f - . - (list - (symbol) @variable) - (#any-of? @_f "lambda" "λ")) + . + (symbol) @_f + . + (list + (symbol) @variable) + (#any-of? @_f "lambda" "λ")) (list - . - (symbol) @_f - . - (list - (list - (symbol) @variable)) - (#any-of? @_f - "let" "let*" "let-syntax" "let-values" "let*-values" "letrec" "letrec*" "letrec-syntax")) - -;; operators + . + (symbol) @_f + . + (list + (list + (symbol) @variable)) + (#any-of? @_f "let" "let*" "let-syntax" "let-values" "let*-values" "letrec" "letrec*" "letrec-syntax")) +; operators ((symbol) @operator - (#any-of? @operator - "+" "-" "*" "/" "=" "<=" ">=" "<" ">")) - -;; keyword + (#any-of? @operator "+" "-" "*" "/" "=" "<=" ">=" "<" ">")) +; keyword ((symbol) @keyword - (#any-of? @keyword - "define" "lambda" "λ" "begin" "do" "define-syntax" - "and" "or" - "if" "cond" "case" "when" "unless" "else" "=>" - "let" "let*" "let-syntax" "let-values" "let*-values" "letrec" "letrec*" "letrec-syntax" - "set!" - "syntax-rules" "identifier-syntax" - "quote" "unquote" "quote-splicing" "quasiquote" "unquote-splicing" - "delay" - "assert" - "library" "export" "import" "rename" "only" "except" "prefix")) + (#any-of? @keyword "define" "lambda" "λ" "begin" "do" "define-syntax" "and" "or" "if" "cond" "case" "when" "unless" "else" "=>" "let" "let*" "let-syntax" "let-values" "let*-values" "letrec" "letrec*" "letrec-syntax" "set!" "syntax-rules" "identifier-syntax" "quote" "unquote" "quote-splicing" "quasiquote" "unquote-splicing" "delay" "assert" "library" "export" "import" "rename" "only" "except" "prefix")) ((symbol) @keyword.conditional - (#any-of? @keyword.conditional "if" "cond" "case" "when" "unless")) - -;; quote + (#any-of? @keyword.conditional "if" "cond" "case" "when" "unless")) +; quote (quote - "'" - (symbol)) @string.special.symbol + "'" + (symbol)) @string.special.symbol (list - . - (symbol) @_f - (#eq? @_f "quote")) @string.special.symbol - -;; library + . + (symbol) @_f + (#eq? @_f "quote")) @string.special.symbol +; library (list - . - (symbol) @_lib - . - (symbol) @module - - (#eq? @_lib "library")) - -;; builtin procedures -;; procedures in R5RS and R6RS but not in R6RS-lib + . + (symbol) @_lib + . + (symbol) @module + (#eq? @_lib "library")) +; builtin procedures +; procedures in R5RS and R6RS but not in R6RS-lib ((symbol) @function.builtin ; format-ignore (#any-of? @function.builtin @@ -180,4 +175,3 @@ "write" "display" "newline" "write-char" ; system "load" "transcript-on" "transcript-off")) - diff --git a/queries/scheme/injections.scm b/queries/scheme/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/scheme/injections.scm +++ b/queries/scheme/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/scss/highlights.scm b/queries/scss/highlights.scm index b0801bb6f..7ca542c83 100644 --- a/queries/scss/highlights.scm +++ b/queries/scss/highlights.scm @@ -1,5 +1,4 @@ ; inherits: css - [ "@at-root" "@debug" @@ -27,39 +26,61 @@ ] @keyword.repeat (single_line_comment) @comment @spell -(function_name) @function +(function_name) @function [ ">=" "<=" ] @operator +(mixin_statement + (name) @function) -(mixin_statement (name) @function) -(mixin_statement (parameters (parameter) @variable.parameter)) +(mixin_statement + (parameters + (parameter) @variable.parameter)) -(function_statement (name) @function) -(function_statement (parameters (parameter) @variable.parameter)) +(function_statement + (name) @function) + +(function_statement + (parameters + (parameter) @variable.parameter)) (plain_value) @string + (keyword_query) @function + (identifier) @variable + (variable_name) @variable -(each_statement (key) @variable.parameter) -(each_statement (value) @variable.parameter) -(each_statement (variable_value) @variable.parameter) +(each_statement + (key) @variable.parameter) + +(each_statement + (value) @variable.parameter) + +(each_statement + (variable_value) @variable.parameter) -(for_statement (variable) @variable.parameter) -(for_statement (_ (variable_value) @variable.parameter)) +(for_statement + (variable) @variable.parameter) + +(for_statement + (_ + (variable_value) @variable.parameter)) (argument) @variable.parameter -(arguments (variable_value) @variable.parameter) + +(arguments + (variable_value) @variable.parameter) [ "[" "]" ] @punctuation.bracket -(include_statement (identifier) @function) +(include_statement + (identifier) @function) diff --git a/queries/scss/indents.scm b/queries/scss/indents.scm index 902eee7bb..94490879d 100644 --- a/queries/scss/indents.scm +++ b/queries/scss/indents.scm @@ -1,7 +1,6 @@ ; inherits: css - [ - (mixin_statement) - (while_statement) - (each_statement) + (mixin_statement) + (while_statement) + (each_statement) ] @indent.begin diff --git a/queries/slang/folds.scm b/queries/slang/folds.scm index c8cc87643..9f2b933d1 100644 --- a/queries/slang/folds.scm +++ b/queries/slang/folds.scm @@ -1,9 +1,8 @@ ; inherits: hlsl - [ - (interface_specifier) - (extension_specifier) - (property_declaration) - (subscript_declaration) - (init_declaration) + (interface_specifier) + (extension_specifier) + (property_declaration) + (subscript_declaration) + (init_declaration) ] @fold diff --git a/queries/slang/highlights.scm b/queries/slang/highlights.scm index e93682eee..2e01fcb98 100644 --- a/queries/slang/highlights.scm +++ b/queries/slang/highlights.scm @@ -1,41 +1,42 @@ ; inherits: hlsl - [ - "var" - "let" - "This" + "var" + "let" + "This" ] @type.builtin [ - "interface" - "extension" - "property" -] @keyword + "interface" + "extension" + "property" +] @keyword -[ - "__init" -] @constructor +"__init" @constructor [ - "__subscript" - "get" - "set" + "__subscript" + "get" + "set" ] @function.builtin -(interface_requirements (identifier) @type) +(interface_requirements + (identifier) @type) (binary_expression - ["is" "as"] + [ + "is" + "as" + ] right: (identifier) @type) [ - "as" - "is" + "as" + "is" ] @keyword.operator [ - "__exported" - "import" + "__exported" + "import" ] @keyword.import (property_declaration diff --git a/queries/slang/indents.scm b/queries/slang/indents.scm index 6175ac5bc..f07cb0562 100644 --- a/queries/slang/indents.scm +++ b/queries/slang/indents.scm @@ -1,5 +1,4 @@ ; inherits: hlsl - [ (interface_specifier) (extension_specifier) diff --git a/queries/slang/injections.scm b/queries/slang/injections.scm index bf83e478a..2fd39cba0 100644 --- a/queries/slang/injections.scm +++ b/queries/slang/injections.scm @@ -1,5 +1,5 @@ ((preproc_arg) @injection.content - (#set! injection.language "slang")) + (#set! injection.language "slang")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/slint/highlights.scm b/queries/slint/highlights.scm index a4fc7f4f3..673fc643d 100644 --- a/queries/slint/highlights.scm +++ b/queries/slint/highlights.scm @@ -1,154 +1,177 @@ (identifier) @variable + (type_identifier) @type + (comment) @comment @spell + (int_literal) @number + (float_literal) @number.float + (string_literal) @string + (function_identifier) @function + [ -(image_macro) -(children_macro) -(radial_grad_macro) -(linear_grad_macro) + (image_macro) + (children_macro) + (radial_grad_macro) + (linear_grad_macro) ] @function.macro + (call_expression function: (identifier) @function.call) + (call_expression - function: (field_expression - field: (identifier) @function.call)) + function: + (field_expression + field: (identifier) @function.call)) + (vis) @keyword.import + (units) @type + (array_literal (identifier) @type) -(transition_statement state: (identifier) @variable.member) -(state_expression state: (identifier) @variable.member) + +(transition_statement + state: (identifier) @variable.member) + +(state_expression + state: (identifier) @variable.member) + (struct_block_definition (identifier) @variable.member) ; (state_identifier) @variable.member - [ -"in" -"for" + "in" + "for" ] @keyword.repeat "@" @keyword [ -"import" -"from" + "import" + "from" ] @keyword.import [ -"if" -"else" + "if" + "else" ] @keyword.conditional [ -"root" -"parent" -"duration" -"easing" + "root" + "parent" + "duration" + "easing" ] @variable.builtin [ -"true" -"false" + "true" + "false" ] @boolean - [ -"struct" -"property" -"callback" -"in" -"animate" -"states" -"when" -"out" -"transitions" -"global" + "struct" + "property" + "callback" + "in" + "animate" + "states" + "when" + "out" + "transitions" + "global" ] @keyword [ -"black" -"transparent" -"blue" -"ease" -"ease_in" -"ease-in" -"ease_in_out" -"ease-in-out" -"ease_out" -"ease-out" -"end" -"green" -"red" -"red" -"start" -"yellow" -"white" -"gray" + "black" + "transparent" + "blue" + "ease" + "ease_in" + "ease-in" + "ease_in_out" + "ease-in-out" + "ease_out" + "ease-out" + "end" + "green" + "red" + "red" + "start" + "yellow" + "white" + "gray" ] @constant.builtin - ; Punctuation [ -"," -"." -";" -":" + "," + "." + ";" + ":" ] @punctuation.delimiter ; Brackets [ -"(" -")" -"[" -"]" -"{" -"}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket -(define_property ["<" ">"] @punctuation.bracket) +(define_property + [ + "<" + ">" + ] @punctuation.bracket) [ -"angle" -"bool" -"brush" -"color" -"float" -"image" -"int" -"length" -"percent" -"physical-length" -"physical_length" -"string" + "angle" + "bool" + "brush" + "color" + "float" + "image" + "int" + "length" + "percent" + "physical-length" + "physical_length" + "string" ] @type.builtin [ - ":=" - "<=>" - "!" - "-" - "+" - "*" - "/" - "&&" - "||" - ">" - "<" - ">=" - "<=" - "=" - ":" - "+=" - "-=" - "*=" - "/=" - "?" - "=>" - ] @operator + ":=" + "<=>" + "!" + "-" + "+" + "*" + "/" + "&&" + "||" + ">" + "<" + ">=" + "<=" + "=" + ":" + "+=" + "-=" + "*=" + "/=" + "?" + "=>" +] @operator -(ternary_expression [":" "?"] @keyword.conditional.ternary) +(ternary_expression + [ + ":" + "?" + ] @keyword.conditional.ternary) diff --git a/queries/slint/indents.scm b/queries/slint/indents.scm index db79aa0d5..587a8ecf3 100644 --- a/queries/slint/indents.scm +++ b/queries/slint/indents.scm @@ -1,10 +1,10 @@ [ -(comp_body) -(state_statement) -(transition_statement) -(handler_body) -(consequence_body) -(global_single) + (comp_body) + (state_statement) + (transition_statement) + (handler_body) + (consequence_body) + (global_single) ] @indent.begin "}" @indent.end diff --git a/queries/smali/highlights.scm b/queries/smali/highlights.scm index 9668c59ba..f1d56dbca 100644 --- a/queries/smali/highlights.scm +++ b/queries/smali/highlights.scm @@ -1,59 +1,69 @@ ; Types - (class_identifier (identifier) @type) (primitive_type) @type.builtin ((class_identifier - . (identifier) @_first @type.builtin - (identifier) @type.builtin) + . + (identifier) @_first @type.builtin + (identifier) @type.builtin) (#any-of? @_first "android" "dalvik" "java" "kotlinx")) ((class_identifier - . (identifier) @_first @type.builtin - . (identifier) @_second @type.builtin - (identifier) @type.builtin) + . + (identifier) @_first @type.builtin + . + (identifier) @_second @type.builtin + (identifier) @type.builtin) (#eq? @_first "com") (#any-of? @_second "android" "google")) ; Methods - (method_definition - (method_signature (method_identifier) @function.method)) + (method_signature + (method_identifier) @function.method)) (expression (opcode) @_invoke - (body - (full_method_signature - (method_signature (method_identifier) @function.method.call))) + (body + (full_method_signature + (method_signature + (method_identifier) @function.method.call))) (#lua-match? @_invoke "^invoke")) (method_handle (full_method_signature - (method_signature (method_identifier) @function.method.call))) + (method_signature + (method_identifier) @function.method.call))) (custom_invoke - . (identifier) @function.method.call - (method_signature (method_identifier) @function.method.call)) + . + (identifier) @function.method.call + (method_signature + (method_identifier) @function.method.call)) (annotation_value (body - (method_signature (method_identifier) @function.method.call))) + (method_signature + (method_identifier) @function.method.call))) (annotation_value (body (full_method_signature - (method_signature (method_identifier) @function.method.call)))) + (method_signature + (method_identifier) @function.method.call)))) (field_definition - (body - (method_signature (method_identifier) @function.method.call))) + (body + (method_signature + (method_identifier) @function.method.call))) (field_definition - (body - (full_method_signature - (method_signature (method_identifier) @function.method.call)))) + (body + (full_method_signature + (method_signature + (method_identifier) @function.method.call)))) ((method_identifier) @constructor (#any-of? @constructor "<init>" "<clinit>")) @@ -61,7 +71,6 @@ "constructor" @constructor ; Fields - [ (field_identifier) (annotation_key) @@ -71,26 +80,23 @@ (#lua-match? @constant "^[%u_]*$")) ; Variables - (variable) @variable.builtin (local_directive (identifier) @variable) ; Parameters - (parameter) @variable.parameter.builtin + (param_identifier) @variable.parameter ; Labels - [ (label) (jmp_label) ] @label ; Operators - (opcode) @keyword.operator ((opcode) @keyword.return @@ -114,7 +120,6 @@ ] @operator ; Keywords - [ ".class" ".super" @@ -146,9 +151,7 @@ (epilogue_directive) ] @keyword -[ - ".source" -] @keyword.import +".source" @keyword.import [ ".method" @@ -161,9 +164,14 @@ ] @keyword.exception ; Literals - (string) @string -(source_directive (string "\"" _ @string.special.url "\"")) + +(source_directive + (string + "\"" + _ @string.special.url + "\"")) + (escape_sequence) @string.escape (character) @character @@ -173,9 +181,9 @@ (number) @number [ - (float) - (NaN) - (Infinity) + (float) + (NaN) + (Infinity) ] @number.float (boolean) @boolean @@ -183,7 +191,6 @@ (null) @constant.builtin ; Misc - (annotation_visibility) @keyword.storage (access_modifier) @type.qualifier @@ -191,9 +198,15 @@ (array_type "[" @punctuation.special) -["{" "}"] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -["(" ")"] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket [ "->" @@ -204,10 +217,10 @@ "/" ] @punctuation.delimiter -(line_directive (number) @string.special) +(line_directive + (number) @string.special) ; Comments - (comment) @comment @spell (class_definition diff --git a/queries/smali/indents.scm b/queries/smali/indents.scm index c61d9528a..b4f37ddb4 100644 --- a/queries/smali/indents.scm +++ b/queries/smali/indents.scm @@ -24,7 +24,10 @@ "}" ] @indent.end @indent.branch -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch [ (ERROR) diff --git a/queries/smali/injections.scm b/queries/smali/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/smali/injections.scm +++ b/queries/smali/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/smali/locals.scm b/queries/smali/locals.scm index 77852a21d..a34b799ba 100644 --- a/queries/smali/locals.scm +++ b/queries/smali/locals.scm @@ -31,7 +31,8 @@ (annotation_key) @local.definition.field (method_definition - (method_signature (method_identifier) @local.definition.method)) + (method_signature + (method_identifier) @local.definition.method)) (param_identifier) @local.definition.parameter diff --git a/queries/smithy/highlights.scm b/queries/smithy/highlights.scm index bb54dad73..1d0321864 100644 --- a/queries/smithy/highlights.scm +++ b/queries/smithy/highlights.scm @@ -1,20 +1,15 @@ ; Preproc - (control_key) @keyword.directive ; Namespace - (namespace) @module ; Includes - -[ - "use" -] @keyword.import +"use" @keyword.import ; Builtins - (primitive) @type.builtin + [ "enum" "intEnum" @@ -24,35 +19,35 @@ ] @type.builtin ; Fields (Members) - ; (field) @variable.member - (key_identifier) @variable.member + (shape_member (field) @variable.member) + (operation_field) @variable.member + (operation_error_field) @variable.member ; Constants - (enum_member (enum_field) @constant) ; Types - (identifier) @type + (structure_resource (shape_id) @type) ; Attributes - (mixins (shape_id) @attribute) + (trait_statement - (shape_id (#set! "priority" 105)) @attribute) + (shape_id + (#set! "priority" 105)) @attribute) ; Operators - [ "@" "-" @@ -61,7 +56,6 @@ ] @operator ; Keywords - [ "namespace" "service" @@ -76,8 +70,8 @@ ] @keyword ; Literals - (string) @string + (escape_sequence) @string.escape (number) @number @@ -89,17 +83,25 @@ (null) @constant.builtin ; Misc - [ "$" "#" ] @punctuation.special -["{" "}"] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -["(" ")"] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -["[" "]"] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket [ ":" @@ -107,7 +109,6 @@ ] @punctuation.delimiter ; Comments - (comment) @comment @spell (documentation_comment) @comment.documentation @spell diff --git a/queries/snakemake/highlights.scm b/queries/snakemake/highlights.scm index 07f86e40d..65789ea96 100644 --- a/queries/snakemake/highlights.scm +++ b/queries/snakemake/highlights.scm @@ -1,63 +1,76 @@ ; inherits: python +; Compound directives +[ + "rule" + "checkpoint" + "module" +] @keyword -;; Compound directives -["rule" "checkpoint" "module"] @keyword +; Top level directives (eg. configfile, include) +(module + (directive + name: _ @keyword)) -;; Top level directives (eg. configfile, include) -(module (directive name: _ @keyword)) +; Subordinate directives (eg. input, output) +(_ + body: + (_ + (directive + name: _ @label))) -;; Subordinate directives (eg. input, output) -(_ body: (_ (directive name: _ @label))) +; rule/module/checkpoint names +(rule_definition + name: (identifier) @type) -;; rule/module/checkpoint names -(rule_definition name: (identifier) @type) -(module_definition name: (identifier) @type) -(checkpoint_definition name: (identifier) @type) +(module_definition + name: (identifier) @type) +(checkpoint_definition + name: (identifier) @type) -;; Rule imports +; Rule imports (rule_import "use" @keyword.import "rule" @keyword.import "from" @keyword.import "as"? @keyword.import - "with"? @keyword.import -) + "with"? @keyword.import) - -;; Rule inheritance +; Rule inheritance (rule_inheritance "use" @keyword "rule" @keyword - "with" @keyword -) - + "with" @keyword) -;; Wildcard names -(wildcard (identifier) @variable) +; Wildcard names +(wildcard + (identifier) @variable) - -;; builtin variables +; builtin variables ((identifier) @variable.builtin (#any-of? @variable.builtin "checkpoints" "config" "gather" "rules" "scatter" "workflow")) - -;; References to directive labels in wildcard interpolations - -;; the #any-of? queries are moved above the #has-ancestor? queries to -;; short-circuit the potentially expensive tree traversal, if possible -;; see: -;; https://github.com/nvim-treesitter/nvim-treesitter/pull/4302#issuecomment-1685789790 - -;; directive labels in wildcard context -((wildcard (identifier) @label) +; References to directive labels in wildcard interpolations +; the #any-of? queries are moved above the #has-ancestor? queries to +; short-circuit the potentially expensive tree traversal, if possible +; see: +; https://github.com/nvim-treesitter/nvim-treesitter/pull/4302#issuecomment-1685789790 +; directive labels in wildcard context +((wildcard + (identifier) @label) (#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards")) -((wildcard (attribute object: (identifier) @label)) + +((wildcard + (attribute + object: (identifier) @label)) (#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards")) -((wildcard (subscript value: (identifier) @label)) + +((wildcard + (subscript + value: (identifier) @label)) (#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards")) -;; directive labels in block context (eg. within 'run:') +; directive labels in block context (eg. within 'run:') ((identifier) @label (#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards") (#has-ancestor? @label "directive") diff --git a/queries/snakemake/injections.scm b/queries/snakemake/injections.scm index dd41cbadb..82072f2ad 100644 --- a/queries/snakemake/injections.scm +++ b/queries/snakemake/injections.scm @@ -1,4 +1,4 @@ ; inherits: python - -(wildcard (constraint) @injection.content +(wildcard + (constraint) @injection.content (#set! injection.language "regex")) diff --git a/queries/solidity/highlights.scm b/queries/solidity/highlights.scm index 70ad31a1b..81c68f9d3 100644 --- a/queries/solidity/highlights.scm +++ b/queries/solidity/highlights.scm @@ -1,12 +1,12 @@ ; Pragma - [ - "pragma" + "pragma" "solidity" ] @keyword.directive (solidity_pragma_token "||" @string.special.symbol) + (solidity_pragma_token "-" @string.special.symbol) @@ -15,10 +15,9 @@ (solidity_version) @string.special ; Literals - [ - (string) - (yul_string_literal) + (string) + (yul_string_literal) ] @string (hex_string_literal @@ -30,77 +29,114 @@ (_) @string) [ - (number_literal) - (yul_decimal_number) - (yul_hex_number) + (number_literal) + (yul_decimal_number) + (yul_hex_number) ] @number (yul_boolean) @boolean ; Variables - [ (identifier) (yul_identifier) ] @variable ; Types +(type_name + (identifier) @type) -(type_name (identifier) @type) -(type_name (user_defined_type (identifier) @type)) -(type_name "mapping" @function.builtin) +(type_name + (user_defined_type + (identifier) @type)) + +(type_name + "mapping" @function.builtin) [ (primitive_type) (number_unit) ] @type.builtin -(contract_declaration name: (identifier) @type) -(struct_declaration name: (identifier) @type) -(struct_member name: (identifier) @variable.member) -(enum_declaration name: (identifier) @type) -(emit_statement . (identifier) @type) +(contract_declaration + name: (identifier) @type) + +(struct_declaration + name: (identifier) @type) + +(struct_member + name: (identifier) @variable.member) + +(enum_declaration + name: (identifier) @type) + +(emit_statement + . + (identifier) @type) + ; Handles ContractA, ContractB in function foo() override(ContractA, contractB) {} -(override_specifier (user_defined_type) @type) +(override_specifier + (user_defined_type) @type) ; Functions and parameters - (function_definition name: (identifier) @function) + (modifier_definition name: (identifier) @function) + (yul_evm_builtin) @function.builtin ; Use constructor coloring for special functions -(constructor_definition "constructor" @constructor) +(constructor_definition + "constructor" @constructor) -(modifier_invocation (identifier) @function) +(modifier_invocation + (identifier) @function) ; Handles expressions like structVariable.g(); -(call_expression . (member_expression (identifier) @function.method.call)) +(call_expression + . + (member_expression + (identifier) @function.method.call)) ; Handles expressions like g(); -(call_expression . (identifier) @function.call) +(call_expression + . + (identifier) @function.call) ; Function parameters -(event_paramater name: (identifier) @variable.parameter) -(parameter name: (identifier) @variable.parameter) +(event_paramater + name: (identifier) @variable.parameter) + +(parameter + name: (identifier) @variable.parameter) ; Yul functions -(yul_function_call function: (yul_identifier) @function.call) +(yul_function_call + function: (yul_identifier) @function.call) ; Yul function parameters -(yul_function_definition . (yul_identifier) @function (yul_identifier) @variable.parameter) +(yul_function_definition + . + (yul_identifier) @function + (yul_identifier) @variable.parameter) + +(meta_type_expression + "type" @keyword) -(meta_type_expression "type" @keyword) +(member_expression + property: (identifier) @variable.member) + +(call_struct_argument + name: (identifier) @variable.member) + +(struct_field_assignment + name: (identifier) @variable.member) -(member_expression property: (identifier) @variable.member) -(call_struct_argument name: (identifier) @variable.member) -(struct_field_assignment name: (identifier) @variable.member) (enum_value) @constant ; Keywords - [ "contract" "interface" @@ -124,8 +160,8 @@ ; FIXME: update grammar ; (block_statement "unchecked" @keyword) - -(event_paramater "indexed" @keyword) +(event_paramater + "indexed" @keyword) [ "public" @@ -180,21 +216,35 @@ "function" @keyword.function [ - "import" + "import" "using" ] @keyword.import -(import_directive "as" @keyword.import) -(import_directive "from" @keyword.import) -((import_directive source: (string) @string.special.path) + +(import_directive + "as" @keyword.import) + +(import_directive + "from" @keyword.import) + +((import_directive + source: (string) @string.special.path) (#offset! @string.special.path 0 1 0 -1)) ; Punctuation +[ + "{" + "}" +] @punctuation.bracket -[ "{" "}" ] @punctuation.bracket - -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket [ "." @@ -207,7 +257,6 @@ ] @punctuation.delimiter ; Operators - [ "&&" "||" @@ -245,14 +294,15 @@ "new" ] @keyword.operator -(import_directive "*" @character.special) +(import_directive + "*" @character.special) ; Comments - (comment) @comment @spell ((comment) @comment.documentation (#lua-match? @comment.documentation "^///[^/]")) + ((comment) @comment.documentation (#lua-match? @comment.documentation "^///$")) diff --git a/queries/soql/highlights.scm b/queries/soql/highlights.scm index def688ab2..f54a2f960 100644 --- a/queries/soql/highlights.scm +++ b/queries/soql/highlights.scm @@ -18,22 +18,25 @@ (when_expression (field_list (dotted_identifier - (identifier) @property ))) + (identifier) @property))) (else_expression (field_list - (identifier) @property )) + (identifier) @property)) (else_expression (field_list (dotted_identifier - (identifier) @property ))) + (identifier) @property))) (alias_expression (identifier) @label) (storage_identifier) @keyword.storage -(_ function_name: (identifier) @function) + +(_ + function_name: (identifier) @function) + (date_literal) @string.special [ @@ -62,17 +65,25 @@ ">=" ] @operator -(value_comparison_operator [ "<" ">" ] @operator) +(value_comparison_operator + [ + "<" + ">" + ] @operator) -(set_comparison_operator "IN" @keyword.operator) +(set_comparison_operator + "IN" @keyword.operator) [ (int) (decimal) (currency_literal) ] @number + (string_literal) @string + (date) @variable.readonly + (date_time) @variable.readonly [ @@ -146,5 +157,3 @@ "User_Mode" "UserId" ] @keyword - - diff --git a/queries/sosl/highlights.scm b/queries/sosl/highlights.scm index 085247b2c..f3b77be3b 100644 --- a/queries/sosl/highlights.scm +++ b/queries/sosl/highlights.scm @@ -1,10 +1,12 @@ (find_clause - (term) @string ) + (term) @string) (sobject_return - (identifier) @type ) + (identifier) @type) -(with_type (_ "=" @operator)) +(with_type + (_ + "=" @operator)) [ "ALL" diff --git a/queries/sparql/highlights.scm b/queries/sparql/highlights.scm index 0a4b6a84c..db4e5a4d0 100644 --- a/queries/sparql/highlights.scm +++ b/queries/sparql/highlights.scm @@ -26,7 +26,6 @@ "a" ] @variable.builtin - [ "ADD" "ALL" @@ -78,13 +77,16 @@ ] @keyword (string) @string + (echar) @string.escape (integer) @number + [ (decimal) (double) ] @number.float + (boolean_literal) @boolean [ @@ -172,36 +174,75 @@ [ "IN" - ("NOT" "IN") + ("NOT" + "IN") ] @keyword.operator - (comment) @comment @spell - ; Could this be summarized? -(select_clause +(select_clause [ bound_variable: (var) "*" ] @variable.parameter) -(bind bound_variable: (var) @variable.parameter) -(data_block bound_variable: (var) @variable.parameter) -(group_condition bound_variable: (var) @variable.parameter) -(iri_reference ["<" ">"] @module) +(bind + bound_variable: (var) @variable.parameter) + +(data_block + bound_variable: (var) @variable.parameter) + +(group_condition + bound_variable: (var) @variable.parameter) + +(iri_reference + [ + "<" + ">" + ] @module) (lang_tag) @type -(rdf_literal + +(rdf_literal "^^" @type - datatype: (_ ["<" ">" (namespace)] @type) @type) + datatype: + (_ + [ + "<" + ">" + (namespace) + ] @type) @type) + +(function_call + identifier: (_) @function) + +(function_call + identifier: + (iri_reference + [ + "<" + ">" + ] @function)) + +(function_call + identifier: + (prefixed_name + (namespace) @function)) -(function_call identifier: (_) @function) +(base_declaration + (iri_reference + [ + "<" + ">" + ] @variable)) -(function_call identifier: (iri_reference ["<" ">"] @function)) -(function_call identifier: (prefixed_name (namespace) @function)) -(base_declaration (iri_reference ["<" ">"] @variable)) -(prefix_declaration (iri_reference ["<" ">"] @variable)) +(prefix_declaration + (iri_reference + [ + "<" + ">" + ] @variable)) [ (var) diff --git a/queries/sparql/indents.scm b/queries/sparql/indents.scm index a0cee376c..e070546df 100644 --- a/queries/sparql/indents.scm +++ b/queries/sparql/indents.scm @@ -9,6 +9,7 @@ (blank_node_property_list) (collection) ] @indent.begin + [ "}" "]" diff --git a/queries/sparql/injections.scm b/queries/sparql/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/sparql/injections.scm +++ b/queries/sparql/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/sparql/locals.scm b/queries/sparql/locals.scm index ba157a4d5..accf0d1d6 100644 --- a/queries/sparql/locals.scm +++ b/queries/sparql/locals.scm @@ -1,8 +1,14 @@ -(group_graph_pattern (triples_block) @local.scope) +(group_graph_pattern + (triples_block) @local.scope) -((sub_select (select_clause (var) @local.definition.var)) - (#set! "definition.var.scope" "parent")) -((select_query (select_clause (var) @local.definition.var)) - (#set! "definition.var.scope" "parent")) +((sub_select + (select_clause + (var) @local.definition.var)) + (#set! "definition.var.scope" "parent")) + +((select_query + (select_clause + (var) @local.definition.var)) + (#set! "definition.var.scope" "parent")) (var) @local.reference diff --git a/queries/sql/highlights.scm b/queries/sql/highlights.scm index aaadd0e2c..6c3530ae0 100644 --- a/queries/sql/highlights.scm +++ b/queries/sql/highlights.scm @@ -25,80 +25,83 @@ alias: (identifier) @variable) ((term - value: (cast - name: (keyword_cast) @function.call - parameter: [(literal)]?))) + value: + (cast + name: (keyword_cast) @function.call + parameter: (literal)?))) (literal) @string + (comment) @comment @spell + (marginalia) @comment ((literal) @number - (#lua-match? @number "^%d+$")) + (#lua-match? @number "^%d+$")) ((literal) @number.float -(#lua-match? @number.float "^[-]?%d*\.%d*$")) + (#lua-match? @number.float "^[-]?%d*\.%d*$")) (parameter) @variable.parameter [ - (keyword_true) - (keyword_false) + (keyword_true) + (keyword_false) ] @boolean [ - (keyword_asc) - (keyword_desc) - (keyword_terminated) - (keyword_escaped) - (keyword_unsigned) - (keyword_nulls) - (keyword_last) - (keyword_delimited) - (keyword_replication) - (keyword_auto_increment) - (keyword_default) - (keyword_collate) - (keyword_concurrently) - (keyword_engine) - (keyword_always) - (keyword_generated) - (keyword_preceding) - (keyword_following) - (keyword_first) - (keyword_current_timestamp) - (keyword_immutable) - (keyword_atomic) - (keyword_parallel) - (keyword_leakproof) - (keyword_safe) - (keyword_cost) - (keyword_strict) + (keyword_asc) + (keyword_desc) + (keyword_terminated) + (keyword_escaped) + (keyword_unsigned) + (keyword_nulls) + (keyword_last) + (keyword_delimited) + (keyword_replication) + (keyword_auto_increment) + (keyword_default) + (keyword_collate) + (keyword_concurrently) + (keyword_engine) + (keyword_always) + (keyword_generated) + (keyword_preceding) + (keyword_following) + (keyword_first) + (keyword_current_timestamp) + (keyword_immutable) + (keyword_atomic) + (keyword_parallel) + (keyword_leakproof) + (keyword_safe) + (keyword_cost) + (keyword_strict) ] @attribute [ - (keyword_materialized) - (keyword_recursive) - (keyword_temp) - (keyword_temporary) - (keyword_unlogged) - (keyword_external) - (keyword_parquet) - (keyword_csv) - (keyword_rcfile) - (keyword_textfile) - (keyword_orc) - (keyword_avro) - (keyword_jsonfile) - (keyword_sequencefile) - (keyword_volatile) + (keyword_materialized) + (keyword_recursive) + (keyword_temp) + (keyword_temporary) + (keyword_unlogged) + (keyword_external) + (keyword_parquet) + (keyword_csv) + (keyword_rcfile) + (keyword_textfile) + (keyword_orc) + (keyword_avro) + (keyword_jsonfile) + (keyword_sequencefile) + (keyword_volatile) ] @keyword.storage [ - (keyword_case) - (keyword_when) - (keyword_then) - (keyword_else) + (keyword_case) + (keyword_when) + (keyword_then) + (keyword_else) ] @keyword.conditional [ @@ -307,29 +310,29 @@ ] @keyword [ - (keyword_restrict) - (keyword_unbounded) - (keyword_unique) - (keyword_cascade) - (keyword_delayed) - (keyword_high_priority) - (keyword_low_priority) - (keyword_ignore) - (keyword_nothing) - (keyword_check) - (keyword_option) - (keyword_local) - (keyword_cascaded) - (keyword_wait) - (keyword_nowait) - (keyword_metadata) - (keyword_incremental) - (keyword_bin_pack) - (keyword_noscan) - (keyword_stats) - (keyword_statistics) - (keyword_maxvalue) - (keyword_minvalue) + (keyword_restrict) + (keyword_unbounded) + (keyword_unique) + (keyword_cascade) + (keyword_delayed) + (keyword_high_priority) + (keyword_low_priority) + (keyword_ignore) + (keyword_nothing) + (keyword_check) + (keyword_option) + (keyword_local) + (keyword_cascaded) + (keyword_wait) + (keyword_nowait) + (keyword_metadata) + (keyword_incremental) + (keyword_bin_pack) + (keyword_noscan) + (keyword_stats) + (keyword_statistics) + (keyword_maxvalue) + (keyword_minvalue) ] @type.qualifier [ diff --git a/queries/sql/indents.scm b/queries/sql/indents.scm index b09f9b5bd..34ae079dd 100644 --- a/queries/sql/indents.scm +++ b/queries/sql/indents.scm @@ -1,27 +1,29 @@ [ - (select) - (cte) - (column_definitions) - (case) - (subquery) - (insert) - (when_clause) + (select) + (cte) + (column_definitions) + (case) + (subquery) + (insert) + (when_clause) ] @indent.begin (block - (keyword_begin) -) @indent.begin + (keyword_begin)) @indent.begin -(column_definitions ")" @indent.branch) +(column_definitions + ")" @indent.branch) -(subquery ")" @indent.branch) +(subquery + ")" @indent.branch) -(cte ")" @indent.branch) +(cte + ")" @indent.branch) [ - (keyword_end) - (keyword_values) - (keyword_into) + (keyword_end) + (keyword_values) + (keyword_into) ] @indent.branch (keyword_end) @indent.end diff --git a/queries/sql/injections.scm b/queries/sql/injections.scm index b298ff22f..602997440 100644 --- a/queries/sql/injections.scm +++ b/queries/sql/injections.scm @@ -1,6 +1,5 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((marginalia) @injection.content - (#set! injection.language "comment")) - + (#set! injection.language "comment")) diff --git a/queries/squirrel/folds.scm b/queries/squirrel/folds.scm index db0b9c581..c2903cc66 100644 --- a/queries/squirrel/folds.scm +++ b/queries/squirrel/folds.scm @@ -3,18 +3,14 @@ (function_declaration) (member_declaration) (enum_declaration) - (array) (block) (table) (anonymous_function) (parenthesized_expression) - (string) (verbatim_string) - (comment) - (if_statement) (else_statement) (while_statement) diff --git a/queries/squirrel/highlights.scm b/queries/squirrel/highlights.scm index e7ac9150e..66bc2247c 100644 --- a/queries/squirrel/highlights.scm +++ b/queries/squirrel/highlights.scm @@ -1,5 +1,4 @@ ; Keywords - [ "class" "clone" @@ -11,9 +10,7 @@ "var" ] @keyword -[ - "function" -] @keyword.function +"function" @keyword.function [ "in" @@ -27,12 +24,11 @@ ] @keyword.return ((global_variable - "::" - (_) @keyword.coroutine) + "::" + (_) @keyword.coroutine) (#any-of? @keyword.coroutine "suspend" "newthread")) ; Conditionals - [ "if" "else" @@ -43,7 +39,6 @@ ] @keyword.conditional ; Repeats - [ "for" "foreach" @@ -53,7 +48,6 @@ ] @keyword.repeat ; Exceptions - [ "try" "catch" @@ -61,26 +55,21 @@ ] @keyword.exception ; Storageclasses - -[ - "local" -] @keyword.storage +"local" @keyword.storage ; Qualifiers - [ "static" "const" ] @type.qualifier ; Variables - -(identifier) @variable +(identifier) @variable (local_declaration (identifier) @variable.local - . "=") - + . + "=") (global_variable) @variable.global @@ -88,58 +77,76 @@ (#any-of? @variable.builtin "base" "this" "vargv")) ; Parameters - (parameter - . (identifier) @variable.parameter) + . + (identifier) @variable.parameter) ; Properties (Slots) - (deref_expression "." - . (identifier) @property) + . + (identifier) @property) (member_declaration (identifier) @property - . "=") + . + "=") ((table_slot - . (identifier) @property - . ["=" ":"]) + . + (identifier) @property + . + [ + "=" + ":" + ]) (#set! "priority" 105)) ; Types - ((identifier) @type - (#lua-match? @type "^[A-Z]")) + (#lua-match? @type "^[A-Z]")) (class_declaration (identifier) @type - "extends"? . (identifier)? @type) + "extends"? + . + (identifier)? @type) (enum_declaration (identifier) @type) ; Attributes - (attribute_declaration left: (identifier) @attribute) ; Functions & Methods - (member_declaration (function_declaration - "::"? (_) @function.method . "(" (_)? ")")) + "::"? + (_) @function.method + . + "(" + (_)? + ")")) ((function_declaration - "::"? (_) @function . "(" (_)? ")") + "::"? + (_) @function + . + "(" + (_)? + ")") (#not-has-ancestor? @function member_declaration)) (call_expression function: (identifier) @function.call) (call_expression - function: (deref_expression - "." . (identifier) @function.call)) + function: + (deref_expression + "." + . + (identifier) @function.call)) (call_expression (global_variable @@ -152,11 +159,17 @@ (lambda_expression "@" @string.special.symbol)) -(call_expression +(call_expression [ - function: (identifier) @function.builtin - function: (global_variable "::" (_) @function.builtin) - function: (deref_expression "." (_) @function.builtin) + function: (identifier) @function.builtin + function: + (global_variable + "::" + (_) @function.builtin) + function: + (deref_expression + "." + (_) @function.builtin) ] ; format-ignore (#any-of? @function.builtin @@ -206,20 +219,20 @@ "constructor" @constructor) ; Constants - (const_declaration "const" - . (identifier) @constant) + . + (identifier) @constant) (enum_declaration "{" - . (identifier) @constant) + . + (identifier) @constant) ((identifier) @constant - (#lua-match? @constant "^_*[A-Z][A-Z%d_]*$")) + (#lua-match? @constant "^_*[A-Z][A-Z%d_]*$")) ; Operators - [ "+" "-" @@ -255,14 +268,25 @@ ] @operator ; Punctuation +[ + "{" + "}" +] @punctuation.bracket -[ "{" "}" ] @punctuation.bracket - -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -[ "</" "/>" ] @punctuation.bracket +[ + "</" + "/>" +] @punctuation.bracket [ "." @@ -277,13 +301,11 @@ ] @punctuation.special ; Ternaries - (ternary_expression "?" @keyword.conditional.ternary ":" @keyword.conditional.ternary) ; Literals - (string) @string (verbatim_string) @string.special @@ -301,7 +323,6 @@ (null) @constant.builtin ; Comments - (comment) @comment @spell ((comment) @comment.documentation diff --git a/queries/squirrel/indents.scm b/queries/squirrel/indents.scm index 0dbbab416..00245d6ae 100644 --- a/queries/squirrel/indents.scm +++ b/queries/squirrel/indents.scm @@ -2,13 +2,11 @@ (class_declaration) (function_declaration) (enum_declaration) - (array) (block) (table) (anonymous_function) (parenthesized_expression) - (while_statement) (switch_statement) (for_statement) @@ -17,10 +15,9 @@ (catch_statement) ] @indent.begin -( - (if_statement) - (ERROR "else") @indent.begin -) +((if_statement) + (ERROR + "else") @indent.begin) (if_statement condition: (_) @indent.begin) @@ -37,11 +34,20 @@ (_) @indent.begin (catch_statement) @indent.begin) -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch [ "}" @@ -52,7 +58,6 @@ [ (ERROR) (comment) - (string) (verbatim_string) ] @indent.auto diff --git a/queries/squirrel/injections.scm b/queries/squirrel/injections.scm index 34a0fce8b..ee864ca6f 100644 --- a/queries/squirrel/injections.scm +++ b/queries/squirrel/injections.scm @@ -1,5 +1,5 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((verbatim_string) @injection.content (#lua-match? @injection.content "^@\"<html") diff --git a/queries/squirrel/locals.scm b/queries/squirrel/locals.scm index 3e3b9da3e..3858eb6b0 100644 --- a/queries/squirrel/locals.scm +++ b/queries/squirrel/locals.scm @@ -1,18 +1,15 @@ ; Scopes - [ (script) (class_declaration) (enum_declaration) (function_declaration) (attribute_declaration) - (array) (block) (table) (anonymous_function) (parenthesized_expression) - (if_statement) (else_statement) (while_statement) @@ -24,44 +21,55 @@ (catch_statement) ] @local.scope - ; References - [ (identifier) (global_variable) ] @local.reference ; Definitions - (const_declaration - . (identifier) @local.definition.constant) + . + (identifier) @local.definition.constant) (enum_declaration - . (identifier) @local.definition.enum) + . + (identifier) @local.definition.enum) (member_declaration - (identifier) @local.definition.field - . "=") + (identifier) @local.definition.field + . + "=") (table_slot - . (identifier) @local.definition.field - . ["=" ":"]) + . + (identifier) @local.definition.field + . + [ + "=" + ":" + ]) ((function_declaration - . (identifier) @local.definition.function) + . + (identifier) @local.definition.function) (#not-has-ancestor? @local.definition.function member_declaration)) (member_declaration (function_declaration - . (identifier) @local.definition.method)) + . + (identifier) @local.definition.method)) (class_declaration - . (identifier) @local.definition.type) + . + (identifier) @local.definition.type) (var_statement - "var" . (identifier) @local.definition.variable) + "var" + . + (identifier) @local.definition.variable) (local_declaration - (identifier) @local.definition.variable - . "=") + (identifier) @local.definition.variable + . + "=") diff --git a/queries/ssh_config/highlights.scm b/queries/ssh_config/highlights.scm index c0a0ae3e2..9338eeedc 100644 --- a/queries/ssh_config/highlights.scm +++ b/queries/ssh_config/highlights.scm @@ -1,5 +1,4 @@ ; Literals - (string) @string (pattern) @string.regexp @@ -21,23 +20,31 @@ [ ; generic - "yes" "no" - "ask" "auto" - "none" "any" + "yes" + "no" + "ask" + "auto" + "none" + "any" ; ControlMaster "autoask" ; FingerprintHash - "md5" "sha256" + "md5" + "sha256" ; PubkeyAuthentication - "unbound" "host-bound" + "unbound" + "host-bound" ; RequestTTY "force" ; SessionType - "subsystem" "default" + "subsystem" + "default" ; StrictHostKeyChecking - "accept-new" "off" + "accept-new" + "off" ; Tunnel - "point-to-point" "ethernet" + "point-to-point" + "ethernet" (ipqos) (verbosity) (facility) @@ -47,20 +54,24 @@ (uri) @string.special.url ; Keywords +[ + "Host" + "Match" +] @keyword -[ "Host" "Match" ] @keyword - -(parameter keyword: _ @keyword) +(parameter + keyword: _ @keyword) -(host_declaration argument: _ @module) +(host_declaration + argument: _ @module) (match_declaration - (condition criteria: _ @attribute)) + (condition + criteria: _ @attribute)) "all" @attribute ; Misc - [ "SSH_AUTH_SOCK" (variable) @@ -69,11 +80,27 @@ (comment) @comment @spell ; Punctuation +[ + "${" + "}" +] @punctuation.special -[ "${" "}" ] @punctuation.special - -[ "\"" "," ":" "@" ] @punctuation.delimiter +[ + "\"" + "," + ":" + "@" +] @punctuation.delimiter -[ "=" "!" "+" "-" "^" ] @operator +[ + "=" + "!" + "+" + "-" + "^" +] @operator -[ "*" "?" ] @character.special +[ + "*" + "?" +] @character.special diff --git a/queries/ssh_config/indents.scm b/queries/ssh_config/indents.scm index 0dd1eb6ca..df92f873a 100644 --- a/queries/ssh_config/indents.scm +++ b/queries/ssh_config/indents.scm @@ -2,6 +2,10 @@ (host_declaration) (match_declaration) ] @indent.begin - ; incomplete declarations -(ERROR . [ "Host" "Match" ]) @indent.begin +(ERROR + . + [ + "Host" + "Match" + ]) @indent.begin diff --git a/queries/ssh_config/injections.scm b/queries/ssh_config/injections.scm index b71988471..6c7861e35 100644 --- a/queries/ssh_config/injections.scm +++ b/queries/ssh_config/injections.scm @@ -1,17 +1,18 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((condition - criteria: "exec" - argument: (string) @injection.content) - (#set! injection.language "bash")) + criteria: "exec" + argument: (string) @injection.content) + (#set! injection.language "bash")) ((parameter - keyword: [ - "KnownHostsCommand" - "LocalCommand" - "RemoteCommand" - "ProxyCommand" - ] - argument: (string) @injection.content) - (#set! injection.language "bash")) + keyword: + [ + "KnownHostsCommand" + "LocalCommand" + "RemoteCommand" + "ProxyCommand" + ] + argument: (string) @injection.content) + (#set! injection.language "bash")) diff --git a/queries/starlark/folds.scm b/queries/starlark/folds.scm index b4756a908..0c9d2a260 100644 --- a/queries/starlark/folds.scm +++ b/queries/starlark/folds.scm @@ -1,22 +1,17 @@ [ (function_definition) - (for_statement) (if_statement) (while_statement) (with_statement) (match_statement) - (parameters) (argument_list) - (parenthesized_expression) (list_comprehension) (dictionary_comprehension) - (tuple) (list) (dictionary) - (string) ] @fold diff --git a/queries/starlark/highlights.scm b/queries/starlark/highlights.scm index 9707632a5..5dd45f4dd 100644 --- a/queries/starlark/highlights.scm +++ b/queries/starlark/highlights.scm @@ -1,20 +1,20 @@ -;; From tree-sitter-python licensed under MIT License +; From tree-sitter-python licensed under MIT License ; Copyright (c) 2016 Max Brunsfeld - ; Variables (identifier) @variable ; Reset highlighting in f-string interpolations (interpolation) @none -;; Identifier naming conventions +; Identifier naming conventions ((identifier) @type - (#lua-match? @type "^[A-Z].*[a-z]")) + (#lua-match? @type "^[A-Z].*[a-z]")) + ((identifier) @constant - (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) + (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) ((identifier) @constant.builtin - (#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$")) + (#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$")) ((identifier) @constant.builtin ; format-ignore @@ -24,40 +24,48 @@ "quit" "exit" "copyright" "credits" "license")) ((attribute - attribute: (identifier) @variable.member) - (#lua-match? @variable.member "^[%l_].*$")) + attribute: (identifier) @variable.member) + (#lua-match? @variable.member "^[%l_].*$")) ((assignment left: (identifier) @type.definition - (type (identifier) @_annotation)) - (#eq? @_annotation "TypeAlias")) + (type + (identifier) @_annotation)) + (#eq? @_annotation "TypeAlias")) ((assignment left: (identifier) @type.definition - right: (call - function: (identifier) @_func)) - (#any-of? @_func "TypeVar" "NewType")) + right: + (call + function: (identifier) @_func)) + (#any-of? @_func "TypeVar" "NewType")) -;; Decorators -((decorator "@" @attribute) - (#set! "priority" 101)) +; Decorators +((decorator + "@" @attribute) + (#set! "priority" 101)) (decorator (identifier) @attribute) + (decorator (attribute attribute: (identifier) @attribute)) + (decorator - (call (identifier) @attribute)) + (call + (identifier) @attribute)) + (decorator - (call (attribute - attribute: (identifier) @attribute))) + (call + (attribute + attribute: (identifier) @attribute))) ((decorator (identifier) @attribute.builtin) - (#any-of? @attribute.builtin "classmethod" "property")) + (#any-of? @attribute.builtin "classmethod" "property")) -;; Builtin functions +; Builtin functions ((call function: (identifier) @function.builtin) ; format-ignore @@ -69,21 +77,24 @@ "print" "property" "range" "repr" "reversed" "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "struct" "sum" "super" "tuple" "type" "vars" "zip" "__import__")) -;; Function definitions +; Function definitions (function_definition name: (identifier) @function) -(type (identifier) @type) +(type + (identifier) @type) + (type (subscript (identifier) @type)) ; type subscript: Tuple[int] ((call function: (identifier) @_isinstance - arguments: (argument_list - (_) - (identifier) @type)) - (#eq? @_isinstance "isinstance")) + arguments: + (argument_list + (_) + (identifier) @type)) + (#eq? @_isinstance "isinstance")) ((identifier) @type.builtin ; format-ignore @@ -104,67 +115,89 @@ "bool" "int" "float" "complex" "list" "tuple" "range" "str" "bytes" "bytearray" "memoryview" "set" "frozenset" "dict" "type")) -;; Normal parameters +; Normal parameters (parameters (identifier) @variable.parameter) -;; Lambda parameters + +; Lambda parameters (lambda_parameters (identifier) @variable.parameter) + (lambda_parameters (tuple_pattern (identifier) @variable.parameter)) + ; Default parameters (keyword_argument name: (identifier) @variable.parameter) + ; Naming parameters on call-site (default_parameter name: (identifier) @variable.parameter) + (typed_parameter (identifier) @variable.parameter) + (typed_default_parameter (identifier) @variable.parameter) + ; Variadic parameters *args, **kwargs (parameters - (list_splat_pattern ; *args + (list_splat_pattern + ; *args (identifier) @variable.parameter)) + (parameters - (dictionary_splat_pattern ; **kwargs + (dictionary_splat_pattern + ; **kwargs (identifier) @variable.parameter)) - -;; Literals +; Literals (none) @constant.builtin -[(true) (false)] @boolean + +[ + (true) + (false) +] @boolean + ((identifier) @variable.builtin - (#eq? @variable.builtin "self")) + (#eq? @variable.builtin "self")) + ((identifier) @variable.builtin - (#eq? @variable.builtin "cls")) + (#eq? @variable.builtin "cls")) (integer) @number + (float) @number.float (comment) @comment @spell -((module . (comment) @keyword.directive) +((module + . + (comment) @keyword.directive) (#lua-match? @keyword.directive "^#!/")) (string) @string + [ (escape_sequence) (escape_interpolation) ] @string.escape ; doc-strings - -(module . (expression_statement (string) @string.documentation @spell)) +(module + . + (expression_statement + (string) @string.documentation @spell)) (function_definition body: (block - . (expression_statement (string) @string.documentation @spell))) + . + (expression_statement + (string) @string.documentation @spell))) ; Tokens - [ "-" "-=" @@ -211,7 +244,6 @@ "in" "not" "or" - "del" ] @keyword.operator @@ -236,21 +268,38 @@ "await" ] @keyword.coroutine -[ - "return" -] @keyword.return +"return" @keyword.return ((call function: (identifier) @keyword.import - arguments: (argument_list - (string) @string)) + arguments: + (argument_list + (string) @string)) (#eq? @keyword.import "load")) -["if" "elif" "else" "match" "case"] @keyword.conditional +[ + "if" + "elif" + "else" + "match" + "case" +] @keyword.conditional -["for" "while" "break" "continue"] @keyword.repeat +[ + "for" + "while" + "break" + "continue" +] @keyword.repeat -["(" ")" "[" "]" "{" "}"] @punctuation.bracket +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket (interpolation "{" @punctuation.special @@ -258,39 +307,44 @@ (type_conversion) @function.macro -["," "." ":" ";" (ellipsis)] @punctuation.delimiter - -;; Starlark-specific +[ + "," + "." + ":" + ";" + (ellipsis) +] @punctuation.delimiter -;; Assertion calls +; Starlark-specific +; Assertion calls (assert_keyword) @keyword (assert_builtin) @function.builtin -;; Struct definitions +; Struct definitions ((call function: (identifier) @_func - arguments: (argument_list - (keyword_argument - name: (identifier) @variable.member))) + arguments: + (argument_list + (keyword_argument + name: (identifier) @variable.member))) (#eq? @_func "struct")) -;; Function calls - +; Function calls (call function: (identifier) @function.call) (call - function: (attribute - attribute: (identifier) @function.method.call)) + function: + (attribute + attribute: (identifier) @function.method.call)) ((call - function: (identifier) @constructor) - (#lua-match? @constructor "^[A-Z]")) + function: (identifier) @constructor) + (#lua-match? @constructor "^[A-Z]")) ((call - function: (attribute - attribute: (identifier) @constructor)) - (#lua-match? @constructor "^[A-Z]")) - - + function: + (attribute + attribute: (identifier) @constructor)) + (#lua-match? @constructor "^[A-Z]")) diff --git a/queries/starlark/indents.scm b/queries/starlark/indents.scm index d87a8bc7f..1aeb9f60e 100644 --- a/queries/starlark/indents.scm +++ b/queries/starlark/indents.scm @@ -2,21 +2,17 @@ (list) (dictionary) (set) - (for_statement) (if_statement) (while_statement) (with_statement) - (parenthesized_expression) (dictionary_comprehension) (list_comprehension) (set_comprehension) - (tuple_pattern) (list_pattern) (binary_operator) - (lambda) (function_definition) ] @indent.begin @@ -24,23 +20,30 @@ (if_statement condition: (parenthesized_expression) @indent.align (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")") -) -((ERROR "(" . (_)) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) + (#set! indent.close_delimiter ")")) + +((ERROR + "(" + . + (_)) @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) + ((argument_list) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) + ((argument_list) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) + ((parameters) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) + ((tuple) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) [ ")" diff --git a/queries/starlark/locals.scm b/queries/starlark/locals.scm index ff9af3803..5da211f65 100644 --- a/queries/starlark/locals.scm +++ b/queries/starlark/locals.scm @@ -1,4 +1,4 @@ -;;; Program structure +; Program structure (module) @local.scope ; Function with parameters, defines parameters @@ -27,65 +27,78 @@ ; Function defines function and scope ((function_definition name: (identifier) @local.definition.function) @local.scope - (#set! definition.function.scope "parent")) + (#set! definition.function.scope "parent")) -;;; Loops +; Loops ; not a scope! (for_statement - left: (pattern_list - (identifier) @local.definition.var)) + left: + (pattern_list + (identifier) @local.definition.var)) + (for_statement - left: (tuple_pattern - (identifier) @local.definition.var)) + left: + (tuple_pattern + (identifier) @local.definition.var)) + (for_statement left: (identifier) @local.definition.var) ; for in list comprehension (for_in_clause left: (identifier) @local.definition.var) + (for_in_clause - left: (tuple_pattern - (identifier) @local.definition.var)) + left: + (tuple_pattern + (identifier) @local.definition.var)) + (for_in_clause - left: (pattern_list - (identifier) @local.definition.var)) + left: + (pattern_list + (identifier) @local.definition.var)) (dictionary_comprehension) @local.scope + (list_comprehension) @local.scope -(set_comprehension) @local.scope -;;; Assignments +(set_comprehension) @local.scope +; Assignments (assignment - left: (identifier) @local.definition.var) + left: (identifier) @local.definition.var) (assignment - left: (pattern_list - (identifier) @local.definition.var)) + left: + (pattern_list + (identifier) @local.definition.var)) + (assignment - left: (tuple_pattern - (identifier) @local.definition.var)) + left: + (tuple_pattern + (identifier) @local.definition.var)) (assignment - left: (attribute - (identifier) - (identifier) @local.definition.field)) + left: + (attribute + (identifier) + (identifier) @local.definition.field)) ; Walrus operator x := 1 (named_expression (identifier) @local.definition.var) -(as_pattern +(as_pattern alias: (as_pattern_target) @local.definition.var) -;;; REFERENCES +; REFERENCES (identifier) @local.reference -;; Starlark-specific - +; Starlark-specific ; Loads ((call function: (identifier) @_fn - arguments: (argument_list - (string) @local.definition.import)) + arguments: + (argument_list + (string) @local.definition.import)) (#eq? @_fn "load")) diff --git a/queries/strace/highlights.scm b/queries/strace/highlights.scm index 2bc45abb7..62fa724bd 100644 --- a/queries/strace/highlights.scm +++ b/queries/strace/highlights.scm @@ -16,7 +16,6 @@ (syscall) @function.builtin ; Literals - (integer) @number (pointer) @number.special @@ -34,7 +33,6 @@ ] @operator ; Punctuation - [ "+++" "---" @@ -42,7 +40,12 @@ "~" ] @punctuation.special -[ "(" ")" "[" "]" ] @punctuation.bracket +[ + "(" + ")" + "[" + "]" +] @punctuation.bracket [ "," diff --git a/queries/supercollider/folds.scm b/queries/supercollider/folds.scm index 214247bc0..2f5f1043a 100644 --- a/queries/supercollider/folds.scm +++ b/queries/supercollider/folds.scm @@ -1,7 +1,6 @@ [ -(function_call) -(code_block) -(function_block) -(control_structure) + (function_call) + (code_block) + (function_block) + (control_structure) ] @fold - diff --git a/queries/supercollider/highlights.scm b/queries/supercollider/highlights.scm index 0d56de614..c8dbd70c7 100644 --- a/queries/supercollider/highlights.scm +++ b/queries/supercollider/highlights.scm @@ -1,20 +1,24 @@ ; highlights.scm ; See this for full list: https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md - ; comments (line_comment) @comment @spell + (block_comment) @comment @spell ; Argument definition -(argument name: (identifier) @variable.parameter) +(argument + name: (identifier) @variable.parameter) ; Variables -(local_var name: (identifier) @variable) -(environment_var name:(identifier) @variable.builtin) +(local_var + name: (identifier) @variable) + +(environment_var + name: (identifier) @variable.builtin) + (builtin_var) @constant.builtin ; (variable) @variable - ; Functions (function_definition name: (variable) @function) @@ -25,49 +29,51 @@ ; Methods (method_call - name: (method_name) @function.method) + name: (method_name) @function.method) ; Classes (class) @type ; Literals (number) @number + (float) @number.float (string) @string + (symbol) @string.special.symbol ; Operators [ -"&&" -"||" -"&" -"|" -"^" -"==" -"!=" -"<" -"<=" -">" -">=" -"<<" -">>" -"+" -"-" -"*" -"/" -"%" -"=" + "&&" + "||" + "&" + "|" + "^" + "==" + "!=" + "<" + "<=" + ">" + ">=" + "<<" + ">>" + "+" + "-" + "*" + "/" + "%" + "=" ] @operator ; Keywords [ -"arg" -"classvar" -"const" -; "super" -; "this" -"var" + "arg" + "classvar" + "const" + ; "super" + ; "this" + "var" ] @keyword ; Brackets diff --git a/queries/supercollider/indents.scm b/queries/supercollider/indents.scm index 41241c6ec..c0cffab3c 100644 --- a/queries/supercollider/indents.scm +++ b/queries/supercollider/indents.scm @@ -10,13 +10,15 @@ (const) (instance_var) (variable_definition) - (variable_definition_sequence (variable_definition)) + (variable_definition_sequence + (variable_definition)) (control_structure) (return_statement) ] @indent.begin [ - (parameter_call_list (argument_calls)) + (parameter_call_list + (argument_calls)) "(" ")" "{" diff --git a/queries/supercollider/injections.scm b/queries/supercollider/injections.scm index 43ae7287b..3cd6aac8e 100644 --- a/queries/supercollider/injections.scm +++ b/queries/supercollider/injections.scm @@ -1,5 +1,5 @@ ([ (line_comment) (block_comment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) diff --git a/queries/supercollider/locals.scm b/queries/supercollider/locals.scm index d04677cae..1707b655a 100644 --- a/queries/supercollider/locals.scm +++ b/queries/supercollider/locals.scm @@ -1,27 +1,31 @@ ; Scopes [ -(function_call) -(code_block) -(function_block) -(control_structure) + (function_call) + (code_block) + (function_block) + (control_structure) ] @local.scope ; Definitions -(argument - name: (identifier) @local.definition.parameter - (#set! "definition.var.scope" "local") -) +(argument + name: (identifier) @local.definition.parameter + (#set! "definition.var.scope" "local")) -(variable_definition - name: (variable (local_var (identifier) @local.definition.var - ))) +(variable_definition + name: + (variable + (local_var + (identifier) @local.definition.var))) -(variable_definition - name: (variable (environment_var (identifier) @local.definition.var)) - (#set! "definition.var.scope" "global")) +(variable_definition + name: + (variable + (environment_var + (identifier) @local.definition.var)) + (#set! "definition.var.scope" "global")) -(function_definition name: (variable) @local.definition.var - (#set! "definition.var.scope" "parent") -) +(function_definition + name: (variable) @local.definition.var + (#set! "definition.var.scope" "parent")) (identifier) @local.reference diff --git a/queries/surface/highlights.scm b/queries/surface/highlights.scm index dc123172d..b874b8c1d 100644 --- a/queries/surface/highlights.scm +++ b/queries/surface/highlights.scm @@ -12,7 +12,7 @@ ; Surface blocks are highlighted as keywords [ - (start_block) + (start_block) (end_block) (subblock) ] @keyword @@ -41,4 +41,4 @@ (directive_name) @keyword ; Surface operators -["="] @operator +"=" @operator diff --git a/queries/surface/indents.scm b/queries/surface/indents.scm index b9321b7ca..1df9fe6fd 100644 --- a/queries/surface/indents.scm +++ b/queries/surface/indents.scm @@ -1,4 +1,4 @@ -; Surface indents like HTML, with the addition of blocks +; Surface indents like HTML, with the addition of blocks [ (component) (tag) diff --git a/queries/surface/injections.scm b/queries/surface/injections.scm index 0ee100999..72cab5e80 100644 --- a/queries/surface/injections.scm +++ b/queries/surface/injections.scm @@ -3,8 +3,8 @@ (expression_value) (component_name) ] @injection.content - (#set! injection.language "elixir")) + (#set! injection.language "elixir")) ; Surface comments are nvim-treesitter comments ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/svelte/folds.scm b/queries/svelte/folds.scm index 795c32fc4..e8635d119 100644 --- a/queries/svelte/folds.scm +++ b/queries/svelte/folds.scm @@ -1,9 +1,9 @@ [ - (style_element) - (script_element) - (element) - (if_statement) - (else_statement) - (each_statement) - (await_statement) + (style_element) + (script_element) + (element) + (if_statement) + (else_statement) + (each_statement) + (await_statement) ] @fold diff --git a/queries/svelte/highlights.scm b/queries/svelte/highlights.scm index 5581c40c1..3e1386d2f 100644 --- a/queries/svelte/highlights.scm +++ b/queries/svelte/highlights.scm @@ -1,5 +1,4 @@ ; inherits: html_tags - (raw_text_expr) @none [ diff --git a/queries/svelte/injections.scm b/queries/svelte/injections.scm index 187b40f4d..912fa3467 100644 --- a/queries/svelte/injections.scm +++ b/queries/svelte/injections.scm @@ -1,11 +1,11 @@ ; inherits: html_tags - ((style_element - (start_tag - (attribute - (attribute_name) @_attr - (quoted_attribute_value (attribute_value) @_lang))) - (raw_text) @injection.content) + (start_tag + (attribute + (attribute_name) @_attr + (quoted_attribute_value + (attribute_value) @_lang))) + (raw_text) @injection.content) (#eq? @_attr "lang") (#any-of? @_lang "scss" "postcss" "less") (#set! injection.language "scss")) @@ -14,24 +14,25 @@ (raw_text_expr) (raw_text_each) ] @injection.content - (#set! injection.language "javascript")) + (#set! injection.language "javascript")) ((script_element - (start_tag - (attribute - (attribute_name) @_attr - (quoted_attribute_value (attribute_value) @_lang))) - (raw_text) @injection.content) - (#eq? @_attr "lang") - (#any-of? @_lang "ts" "typescript") - (#set! injection.language "typescript")) + (start_tag + (attribute + (attribute_name) @_attr + (quoted_attribute_value + (attribute_value) @_lang))) + (raw_text) @injection.content) + (#eq? @_attr "lang") + (#any-of? @_lang "ts" "typescript") + (#set! injection.language "typescript")) ((element - (start_tag - (attribute - (attribute_name) @_attr - (quoted_attribute_value - (attribute_value) @injection.language))) - (text) @injection.content) - (#eq? @_attr "lang") - (#eq? @injection.language "pug")) + (start_tag + (attribute + (attribute_name) @_attr + (quoted_attribute_value + (attribute_value) @injection.language))) + (text) @injection.content) + (#eq? @_attr "lang") + (#eq? @injection.language "pug")) diff --git a/queries/swift/highlights.scm b/queries/swift/highlights.scm index 336497839..f3387dbef 100644 --- a/queries/swift/highlights.scm +++ b/queries/swift/highlights.scm @@ -1,10 +1,25 @@ -[ "." ";" ":" "," ] @punctuation.delimiter +[ + "." + ";" + ":" + "," +] @punctuation.delimiter ; TODO: "\\(" ")" in interpolations should be @punctuation.special -[ "\\(" "(" ")" "[" "]" "{" "}"] @punctuation.bracket +[ + "\\(" + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket ; Identifiers (attribute) @variable + (type_identifier) @type + (self_expression) @variable.builtin ; Declarations @@ -20,16 +35,35 @@ (mutation_modifier) ] @type.qualifier -(function_declaration (simple_identifier) @function.method) -(function_declaration ["init" @constructor]) +(function_declaration + (simple_identifier) @function.method) + +(function_declaration + "init" @constructor) + (throws) @keyword + (where_keyword) @keyword -(parameter external_name: (simple_identifier) @variable.parameter) -(parameter name: (simple_identifier) @variable.parameter) -(type_parameter (type_identifier) @variable.parameter) -(inheritance_constraint (identifier (simple_identifier) @variable.parameter)) -(equality_constraint (identifier (simple_identifier) @variable.parameter)) -(pattern bound_identifier: (simple_identifier)) @variable + +(parameter + external_name: (simple_identifier) @variable.parameter) + +(parameter + name: (simple_identifier) @variable.parameter) + +(type_parameter + (type_identifier) @variable.parameter) + +(inheritance_constraint + (identifier + (simple_identifier) @variable.parameter)) + +(equality_constraint + (identifier + (simple_identifier) @variable.parameter)) + +(pattern + bound_identifier: (simple_identifier)) @variable [ "typealias" @@ -58,60 +92,114 @@ (modify_specifier) ] @keyword -(class_body (property_declaration (pattern (simple_identifier) @property))) -(protocol_property_declaration (pattern (simple_identifier) @property)) +(class_body + (property_declaration + (pattern + (simple_identifier) @property))) + +(protocol_property_declaration + (pattern + (simple_identifier) @property)) + (navigation_expression - (navigation_suffix (simple_identifier) @property)) + (navigation_suffix + (simple_identifier) @property)) + (value_argument name: (value_argument_label) @property) -(import_declaration ["import" @keyword.import]) +(import_declaration + "import" @keyword.import) -(enum_entry ["case" @keyword]) +(enum_entry + "case" @keyword) ; Function calls -(call_expression (simple_identifier) @function.call) ; foo() -(call_expression ; foo.bar.baz(): highlight the baz() +(call_expression + (simple_identifier) @function.call) ; foo() + +(call_expression + ; foo.bar.baz(): highlight the baz() (navigation_expression - (navigation_suffix (simple_identifier) @function.call))) + (navigation_suffix + (simple_identifier) @function.call))) + (call_expression - (prefix_expression (simple_identifier) @function.call)) ; .foo() + (prefix_expression + (simple_identifier) @function.call)) ; .foo() + ((navigation_expression - (simple_identifier) @type) ; SomeType.method(): highlight SomeType as a type - (#lua-match? @type "^[A-Z]")) + (simple_identifier) @type) ; SomeType.method(): highlight SomeType as a type + (#lua-match? @type "^[A-Z]")) (directive) @function.macro + (diagnostic) @function.macro ; Statements -(for_statement ["for" @keyword.repeat]) -(for_statement ["in" @keyword.repeat]) -(for_statement (pattern) @variable) +(for_statement + "for" @keyword.repeat) + +(for_statement + "in" @keyword.repeat) + +(for_statement + (pattern) @variable) + (else) @keyword + (as_operator) @keyword -["while" "repeat" "continue" "break"] @keyword.repeat +[ + "while" + "repeat" + "continue" + "break" +] @keyword.repeat + +[ + "let" + "var" +] @keyword + +(guard_statement + "guard" @keyword.conditional) + +(if_statement + "if" @keyword.conditional) + +(switch_statement + "switch" @keyword.conditional) -["let" "var"] @keyword +(switch_entry + "case" @keyword) + +(switch_entry + "fallthrough" @keyword) + +(switch_entry + (default_keyword) @keyword) -(guard_statement ["guard" @keyword.conditional]) -(if_statement ["if" @keyword.conditional]) -(switch_statement ["switch" @keyword.conditional]) -(switch_entry ["case" @keyword]) -(switch_entry ["fallthrough" @keyword]) -(switch_entry (default_keyword) @keyword) "return" @keyword.return + (ternary_expression - ["?" ":"] @keyword.conditional) + [ + "?" + ":" + ] @keyword.conditional) -["do" (throw_keyword) (catch_keyword)] @keyword +[ + "do" + (throw_keyword) + (catch_keyword) +] @keyword (statement_label) @label ; Comments [ - (comment) - (multiline_comment) + (comment) + (multiline_comment) ] @comment @spell ((comment) @comment.documentation @@ -125,25 +213,38 @@ ; String literals (line_str_text) @string + (str_escaped_char) @string + (multi_line_str_text) @string + (raw_str_part) @string + (raw_str_end_part) @string + (raw_str_interpolation_start) @punctuation.special -["\"" "\"\"\""] @string + +[ + "\"" + "\"\"\"" +] @string ; Lambda literals -(lambda_literal ["in" @keyword.operator]) +(lambda_literal + "in" @keyword.operator) ; Basic literals [ - (integer_literal) - (hex_literal) - (oct_literal) - (bin_literal) + (integer_literal) + (hex_literal) + (oct_literal) + (bin_literal) ] @number + (real_literal) @number.float + (boolean_literal) @boolean + "nil" @constant.builtin ; Regex literals @@ -151,39 +252,37 @@ ; Operators (custom_operator) @operator -[ - "try" - "try?" - "try!" - "+" - "-" - "*" - "/" - "%" - "=" - "+=" - "-=" - "*=" - "/=" - "<" - ">" - "<=" - ">=" - "++" - "--" - "&" - "~" - "%=" - "!=" - "!==" - "==" - "===" - "??" - "->" - - "..<" - "..." +[ + "try" + "try?" + "try!" + "+" + "-" + "*" + "/" + "%" + "=" + "+=" + "-=" + "*=" + "/=" + "<" + ">" + "<=" + ">=" + "++" + "--" + "&" + "~" + "%=" + "!=" + "!==" + "==" + "===" + "??" + "->" + "..<" + "..." (bang) ] @operator - diff --git a/queries/swift/indents.scm b/queries/swift/indents.scm index 63d1c9011..3204af3f3 100644 --- a/queries/swift/indents.scm +++ b/queries/swift/indents.scm @@ -47,16 +47,13 @@ _ @indent.branch (#not-has-type? @indent.branch type_parameters parameter)) - (ERROR [ - "<" - "{" - "(" + "<" + "{" + "(" "[" - ] -) @indent.begin - + ]) @indent.begin ; if-elseif (if_statement @@ -65,23 +62,34 @@ ; case Foo: ; default Foo: ; @attribute default Foo: -(switch_entry . _ @indent.branch) +(switch_entry + . + _ @indent.branch) + +(function_declaration + ")" @indent.branch) -(function_declaration ")" @indent.branch) +(type_parameters + ">" @indent.branch @indent.end .) + +(tuple_expression + ")" @indent.branch @indent.end) + +(value_arguments + ")" @indent.branch @indent.end) + +(tuple_type + ")" @indent.branch @indent.end) -(type_parameters ">" @indent.branch @indent.end .) -(tuple_expression ")" @indent.branch @indent.end) -(value_arguments ")" @indent.branch @indent.end) -(tuple_type ")" @indent.branch @indent.end) (modifiers - (attribute ")" @indent.branch @indent.end)) + (attribute + ")" @indent.branch @indent.end)) [ "}" "]" ] @indent.branch @indent.end - [ ; (ERROR) (comment) diff --git a/queries/swift/locals.scm b/queries/swift/locals.scm index 45d4f2f0a..dc8a62e9e 100644 --- a/queries/swift/locals.scm +++ b/queries/swift/locals.scm @@ -1,18 +1,21 @@ -(import_declaration (identifier) @local.definition.import) -(function_declaration name: (simple_identifier) @local.definition.function) +(import_declaration + (identifier) @local.definition.import) + +(function_declaration + name: (simple_identifier) @local.definition.function) ; Scopes [ - (statements) - (for_statement) - (while_statement) - (repeat_while_statement) - (do_statement) - (if_statement) - (guard_statement) - (switch_statement) - (property_declaration) - (function_declaration) - (class_declaration) - (protocol_declaration) + (statements) + (for_statement) + (while_statement) + (repeat_while_statement) + (do_statement) + (if_statement) + (guard_statement) + (switch_statement) + (property_declaration) + (function_declaration) + (class_declaration) + (protocol_declaration) ] @local.scope diff --git a/queries/sxhkdrc/folds.scm b/queries/sxhkdrc/folds.scm index 178258dc6..c6634aaef 100644 --- a/queries/sxhkdrc/folds.scm +++ b/queries/sxhkdrc/folds.scm @@ -1,3 +1 @@ -[ - (binding) -] @fold +(binding) @fold diff --git a/queries/sxhkdrc/highlights.scm b/queries/sxhkdrc/highlights.scm index b4a58eb9a..3f633a73d 100644 --- a/queries/sxhkdrc/highlights.scm +++ b/queries/sxhkdrc/highlights.scm @@ -1,10 +1,19 @@ (modifier) @keyword + (operator) @operator + (attribute) @attribute + (command_sync_prefix) @type + (punctuation) @punctuation.bracket + (delimiter) @punctuation.delimiter + (keysym) @variable + (comment) @comment @spell + (range) @number + "\\\n" @punctuation.special diff --git a/queries/sxhkdrc/injections.scm b/queries/sxhkdrc/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/sxhkdrc/injections.scm +++ b/queries/sxhkdrc/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/systemtap/highlights.scm b/queries/systemtap/highlights.scm index 55571a1d8..d686d2a0c 100644 --- a/queries/systemtap/highlights.scm +++ b/queries/systemtap/highlights.scm @@ -8,7 +8,9 @@ (preprocessor_constant) @constant.macro (number) @number + (string) @string + (escape_sequence) @string.escape [ @@ -35,10 +37,8 @@ function: (identifier) @function.call) ((call_expression - function: (identifier) @function.builtin) - (#any-of? @function.builtin - "print" "printd" "printdln" "printf" "println" - "sprint" "sprintd" "sprintdln" "sprintf" "sprintln")) + function: (identifier) @function.builtin) + (#any-of? @function.builtin "print" "printd" "printdln" "printf" "println" "sprint" "sprintd" "sprintdln" "sprintf" "sprintln")) ((identifier) @variable.builtin (#lua-match? @variable.builtin "^\$+[0-9A-Z_a-z]+\$*$")) @@ -117,7 +117,9 @@ ] @keyword "function" @keyword.function + "in" @keyword.operator + "return" @keyword.return [ @@ -150,4 +152,5 @@ "@define" @keyword.directive.define "private" @type.qualifier + "global" @keyword.storage diff --git a/queries/systemtap/injections.scm b/queries/systemtap/injections.scm index 9a1099d6d..591df6012 100644 --- a/queries/systemtap/injections.scm +++ b/queries/systemtap/injections.scm @@ -1,5 +1,5 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((embedded_code) @injection.content - (#set! injection.language "c")) + (#set! injection.language "c")) diff --git a/queries/t32/highlights.scm b/queries/t32/highlights.scm index a0e1e3c2d..e2b6c44c8 100644 --- a/queries/t32/highlights.scm +++ b/queries/t32/highlights.scm @@ -70,17 +70,15 @@ "volatile" ] @type.qualifier - ; Operators in comma and conditional HLL expressions (hll_comma_expression "," @operator) (hll_conditional_expression [ - "?" - ":" -] @keyword.conditional.ternary) - + "?" + ":" + ] @keyword.conditional.ternary) ; Strings and others literal types (access_class) @constant.builtin @@ -108,6 +106,7 @@ (hll_escape_sequence) @string.escape (path) @string.special.path + (symbol) @string.special.symbol [ @@ -115,31 +114,29 @@ (hll_char_literal) ] @character - ; Types in HLL expressions [ - (hll_type_identifier) - (hll_type_descriptor) + (hll_type_identifier) + (hll_type_descriptor) ] @type (hll_type_qualifier) @type.qualifier (hll_primitive_type) @type.builtin - ; HLL expressions (hll_call_expression function: (identifier) @function.call) (hll_call_expression - function: (hll_field_expression - field: (hll_field_identifier) @function.call)) - + function: + (hll_field_expression + field: (hll_field_identifier) @function.call)) ; HLL variables (identifier) @variable -(hll_field_identifier) @variable.member +(hll_field_identifier) @variable.member ; Commands (command_expression @@ -151,44 +148,39 @@ (call_expression function: (identifier) @function.builtin) - ; Returns -( - (command_expression - command: (identifier) @keyword.return) - (#match? @keyword.return "^[eE][nN][dD]([dD][oO])?$") -) -( - (command_expression - command: (identifier) @keyword.return) - (#lua-match? @keyword.return "^[rR][eE][tT][uU][rR][nN]$") -) +((command_expression + command: (identifier) @keyword.return) + (#match? @keyword.return "^[eE][nN][dD]([dD][oO])?$")) +((command_expression + command: (identifier) @keyword.return) + (#lua-match? @keyword.return "^[rR][eE][tT][uU][rR][nN]$")) ; Subroutine calls (subroutine_call_expression command: (identifier) @keyword subroutine: (identifier) @function.call) - ; Variables, constants and labels (macro) @variable.builtin + (trace32_hll_variable) @variable.builtin (argument_list (identifier) @constant.builtin) -( - (argument_list (identifier) @constant.builtin) - (#lua-match? @constant.builtin "^[%%/][%l%u][%l%u%d.]*$") -) +((argument_list + (identifier) @constant.builtin) + (#lua-match? @constant.builtin "^[%%/][%l%u][%l%u%d.]*$")) -( - (command_expression - command: (identifier) @keyword - arguments: (argument_list . (identifier) @label)) - (#lua-match? @keyword "^[gG][oO][tT][oO]$") -) +((command_expression + command: (identifier) @keyword + arguments: + (argument_list + . + (identifier) @label)) + (#lua-match? @keyword "^[gG][oO][tT][oO]$")) (labeled_expression label: (identifier) @label) @@ -199,7 +191,6 @@ (format_expression (identifier) @constant.builtin) - ; Subroutine blocks (subroutine_block command: (identifier) @keyword.function @@ -209,24 +200,23 @@ label: (identifier) @function (block)) - ; Parameter declarations (parameter_declaration command: (identifier) @keyword (identifier)? @constant.builtin macro: (macro) @variable.parameter) - ; Control flow (if_block command: (identifier) @keyword.conditional) + (else_block command: (identifier) @keyword.conditional) (while_block command: (identifier) @keyword.repeat) + (repeat_block command: (identifier) @keyword.repeat) - (comment) @comment @spell diff --git a/queries/t32/injections.scm b/queries/t32/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/t32/injections.scm +++ b/queries/t32/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/t32/locals.scm b/queries/t32/locals.scm index bad645fdf..3c10c58ab 100644 --- a/queries/t32/locals.scm +++ b/queries/t32/locals.scm @@ -1,5 +1,4 @@ (block) @local.scope - ; Parameter definitions (parameter_declaration command: (identifier) @@ -12,8 +11,9 @@ (command_expression command: (identifier) - arguments: (argument_list - declarator: (trace32_hll_variable) @local.definition.var)) + arguments: + (argument_list + declarator: (trace32_hll_variable) @local.definition.var)) ; Function definitions (subroutine_block @@ -25,12 +25,10 @@ (block)) ; References -( - (subroutine_call_expression - command: (identifier) - subroutine: (identifier) @local.reference) - (#set! reference.kind "function") -) +((subroutine_call_expression + command: (identifier) + subroutine: (identifier) @local.reference) + (#set! reference.kind "function")) [ (macro) diff --git a/queries/tablegen/folds.scm b/queries/tablegen/folds.scm index a1727b151..0e95ca527 100644 --- a/queries/tablegen/folds.scm +++ b/queries/tablegen/folds.scm @@ -8,6 +8,6 @@ (defvar) (foreach) (if) - (let) + (let) (value_suffix) ] @fold diff --git a/queries/tablegen/highlights.scm b/queries/tablegen/highlights.scm index aea94b4eb..7c6d71753 100644 --- a/queries/tablegen/highlights.scm +++ b/queries/tablegen/highlights.scm @@ -1,13 +1,10 @@ ; Preprocs - (preprocessor_directive) @keyword.directive ; Includes - "include" @keyword.import ; Keywords - [ "assert" "class" @@ -20,12 +17,9 @@ "defvar" ] @keyword -[ - "in" -] @keyword.operator +"in" @keyword.operator ; Conditionals - [ "if" "else" @@ -33,24 +27,18 @@ ] @keyword.conditional ; Repeats - -[ - "foreach" -] @keyword.repeat +"foreach" @keyword.repeat ; Variables - (identifier) @variable -(var) @variable.builtin +(var) @variable.builtin ; Parameters - -(template_arg (identifier) @variable.parameter) - +(template_arg + (identifier) @variable.parameter) ; Types - (type) @type [ @@ -63,27 +51,41 @@ "code" ] @type.builtin -(class name: (identifier) @type) +(class + name: (identifier) @type) -(multiclass name: (identifier) @type) +(multiclass + name: (identifier) @type) -(def name: (value (_) @type)) +(def + name: + (value + (_) @type)) -(defm name: (value (_) @type)) +(defm + name: + (value + (_) @type)) -(defset name: (identifier) @type) +(defset + name: (identifier) @type) -(parent_class_list (identifier) @type (value (_) @type)?) +(parent_class_list + (identifier) @type + (value + (_) @type)?) -(anonymous_record (identifier) @type) +(anonymous_record + (identifier) @type) -(anonymous_record (value (_) @type)) +(anonymous_record + (value + (_) @type)) ((identifier) @type (#lua-match? @type "^_*[A-Z][A-Z0-9_]+$")) ; Fields - (instruction (identifier) @variable.member) @@ -91,7 +93,6 @@ (identifier) @variable.member) ; Functions - ([ (bang_operator) (cond_operator) @@ -99,7 +100,6 @@ (#set! "priority" 105)) ; Operators - [ "=" "#" @@ -109,7 +109,6 @@ ] @operator ; Literals - (string) @string (code) @string.special @@ -121,14 +120,25 @@ (uninitialized_value) @constant.builtin ; Punctuation +[ + "{" + "}" +] @punctuation.bracket -[ "{" "}" ] @punctuation.bracket - -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -[ "<" ">" ] @punctuation.bracket +[ + "<" + ">" +] @punctuation.bracket [ "." @@ -136,17 +146,13 @@ ";" ] @punctuation.delimiter -[ - "!" -] @punctuation.special +"!" @punctuation.special ; Comments - [ (comment) (multiline_comment) ] @comment @spell - ((comment) @keyword.directive (#lua-match? @keyword.directive "^.*RUN")) diff --git a/queries/tablegen/indents.scm b/queries/tablegen/indents.scm index 5d73f8848..16748edf1 100644 --- a/queries/tablegen/indents.scm +++ b/queries/tablegen/indents.scm @@ -7,7 +7,7 @@ (defvar) (foreach) (if) - (let) + (let) (value_suffix) ] @indent.begin @@ -18,10 +18,22 @@ ">" ] @indent.end -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch -[ "<" ">" ] @indent.branch +[ + "<" + ">" +] @indent.branch diff --git a/queries/tablegen/locals.scm b/queries/tablegen/locals.scm index f1404adb6..98c52ceac 100644 --- a/queries/tablegen/locals.scm +++ b/queries/tablegen/locals.scm @@ -1,5 +1,4 @@ ; Scopes - [ (class) (multiclass) @@ -13,14 +12,12 @@ ] @local.scope ; References - [ (var) (identifier) ] @local.reference ; Definitions - (instruction (identifier) @local.definition.field) @@ -30,7 +27,8 @@ (include_directive (string) @local.definition.import) -(template_arg (identifier) @local.definition.parameter) +(template_arg + (identifier) @local.definition.parameter) (class name: (identifier) @local.definition.type) @@ -39,10 +37,14 @@ name: (identifier) @local.definition.type) (def - name: (value (_) @local.definition.type)) + name: + (value + (_) @local.definition.type)) (defm - name: (value (_) @local.definition.type)) + name: + (value + (_) @local.definition.type)) (defset name: (identifier) @local.definition.type) diff --git a/queries/teal/folds.scm b/queries/teal/folds.scm index 4583057cf..27755de20 100644 --- a/queries/teal/folds.scm +++ b/queries/teal/folds.scm @@ -1,13 +1,13 @@ [ -(do_statement) -(numeric_for_statement) -(generic_for_statement) -(while_statement) -(repeat_statement) -(if_statement) -(function_statement) -(record_declaration) -(enum_declaration) -(anon_function) -(table_constructor) + (do_statement) + (numeric_for_statement) + (generic_for_statement) + (while_statement) + (repeat_statement) + (if_statement) + (function_statement) + (record_declaration) + (enum_declaration) + (anon_function) + (table_constructor) ] @fold diff --git a/queries/teal/highlights.scm b/queries/teal/highlights.scm index aa71fc5b5..f74714290 100644 --- a/queries/teal/highlights.scm +++ b/queries/teal/highlights.scm @@ -1,91 +1,192 @@ - -;; Primitives +; Primitives (boolean) @boolean + (comment) @comment @spell + ((comment) @comment.documentation (#lua-match? @comment.documentation "^[-][-][-]")) + ((comment) @comment.documentation (#lua-match? @comment.documentation "^[-][-](%s?)@")) + (shebang_comment) @keyword.directive + (identifier) @variable + ((identifier) @variable.builtin (#eq? @variable.builtin "self")) + (nil) @constant.builtin + (number) @number + (string) @string -(table_constructor ["{" "}"] @constructor) -(varargs "..." @constant.builtin) -[ "," "." ":" ";" ] @punctuation.delimiter + +(table_constructor + [ + "{" + "}" + ] @constructor) + +(varargs + "..." @constant.builtin) + +[ + "," + "." + ":" + ";" +] @punctuation.delimiter (escape_sequence) @string.escape + (format_specifier) @string.escape -;; Basic statements/Keywords -[ "if" "then" "elseif" "else" ] @keyword.conditional -[ "for" "while" "repeat" "until" ] @keyword.repeat +; Basic statements/Keywords +[ + "if" + "then" + "elseif" + "else" +] @keyword.conditional + +[ + "for" + "while" + "repeat" + "until" +] @keyword.repeat + "return" @keyword.return -[ "in" "local" (break) (goto) "do" "end" ] @keyword + +[ + "in" + "local" + (break) + (goto) + "do" + "end" +] @keyword + (label) @label -;; Global isn't a real keyword, but it gets special treatment in these places -(var_declaration "global" @keyword) -(type_declaration "global" @keyword) -(function_statement "global" @keyword) -(record_declaration "global" @keyword) -(enum_declaration "global" @keyword) +; Global isn't a real keyword, but it gets special treatment in these places +(var_declaration + "global" @keyword) -;; Ops -(bin_op (op) @operator) -(unary_op (op) @operator) -[ "=" "as" ] @operator +(type_declaration + "global" @keyword) -;; Functions +(function_statement + "global" @keyword) + +(record_declaration + "global" @keyword) + +(enum_declaration + "global" @keyword) + +; Ops +(bin_op + (op) @operator) + +(unary_op + (op) @operator) + +[ + "=" + "as" +] @operator + +; Functions (function_statement "function" @keyword.function - . name: (_) @function) + . + name: (_) @function) + (anon_function "function" @keyword.function) -(function_body "end" @keyword.function) -(arg name: (identifier) @variable.parameter) +(function_body + "end" @keyword.function) + +(arg + name: (identifier) @variable.parameter) (function_signature (arguments - . (arg name: (identifier) @variable.builtin)) + . + (arg + name: (identifier) @variable.builtin)) (#eq? @variable.builtin "self")) (typeargs "<" @punctuation.bracket - . (_) @variable.parameter - . ("," . (_) @variable.parameter)* - . ">" @punctuation.bracket) + . + (_) @variable.parameter + . + ("," + . + (_) @variable.parameter)* + . + ">" @punctuation.bracket) (function_call - (identifier) @function . (arguments)) + (identifier) @function + . + (arguments)) + (function_call - (index (_) key: (identifier) @function) . (arguments)) + (index + (_) + key: (identifier) @function) + . + (arguments)) + (function_call - (method_index (_) key: (identifier) @function) . (arguments)) + (method_index + (_) + key: (identifier) @function) + . + (arguments)) -;; Types +; Types (record_declaration - . "record" @keyword + . + "record" @keyword name: (identifier) @type) -(anon_record . "record" @keyword) + +(anon_record + . + "record" @keyword) + (record_body (record_declaration - . [ "record" ] @keyword - . name: (identifier) @type)) + . + "record" @keyword + . + name: (identifier) @type)) + (record_body (enum_declaration - . [ "enum" ] @keyword - . name: (identifier) @type)) + . + "enum" @keyword + . + name: (identifier) @type)) + (record_body (typedef - . "type" @keyword - . name: (identifier) @type . "=")) + . + "type" @keyword + . + name: (identifier) @type + . + "=")) + (record_body - (metamethod "metamethod" @keyword)) + (metamethod + "metamethod" @keyword)) + (record_body (userdata) @keyword) @@ -93,27 +194,52 @@ "enum" @keyword name: (identifier) @type) -(type_declaration "type" @keyword) -(type_declaration (identifier) @type) -(simple_type name: (identifier) @type) -(type_index (identifier) @type) -(type_union "|" @operator) -(function_type "function" @type) +(type_declaration + "type" @keyword) + +(type_declaration + (identifier) @type) + +(simple_type + name: (identifier) @type) + +(type_index + (identifier) @type) -;; The rest of it +(type_union + "|" @operator) + +(function_type + "function" @type) + +; The rest of it (var_declaration - declarators: (var_declarators - (var name: (identifier) @variable))) + declarators: + (var_declarators + (var + name: (identifier) @variable))) + (var_declaration - declarators: (var_declarators - (var - "<" @punctuation.bracket - . attribute: (attribute) @attribute - . ">" @punctuation.bracket))) -[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket + declarators: + (var_declarators + (var + "<" @punctuation.bracket + . + attribute: (attribute) @attribute + . + ">" @punctuation.bracket))) -;; Only highlight format specifiers in calls to string.format -;; string.format('...') +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +; Only highlight format specifiers in calls to string.format +; string.format('...') ;(function_call ; called_object: (index ; (identifier) @base @@ -123,8 +249,7 @@ ; ; (#eq? @base "string") ; (#eq? @entry "format")) - -;; ('...'):format() +; ('...'):format() ;(function_call ; called_object: (method_index ; (string (format_specifier) @string.escape) diff --git a/queries/teal/injections.scm b/queries/teal/injections.scm index 789826452..ac42de4eb 100644 --- a/queries/teal/injections.scm +++ b/queries/teal/injections.scm @@ -1,47 +1,42 @@ -( - (function_call - (index - (identifier) @_cdef_identifier) - (arguments - (string) @injection.content) - ) - +((function_call + (index + (identifier) @_cdef_identifier) + (arguments + (string) @injection.content)) (#eq? @_cdef_identifier "cdef") (#lua-match? @injection.content "^[\"']") (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "c") -) - -( - (function_call - (index - (identifier) @_cdef_identifier) - (arguments - (string) @injection.content) - ) + (#set! injection.language "c")) +((function_call + (index + (identifier) @_cdef_identifier) + (arguments + (string) @injection.content)) (#eq? @_cdef_identifier "cdef") (#lua-match? @injection.content "^%[%[") (#offset! @injection.content 0 2 0 -2) - (#set! injection.language "c") -) + (#set! injection.language "c")) ; string.format('...') ((function_call (index (identifier) @_base key: (identifier) @_entry) - (arguments . (string) @injection.content)) - (#eq? @_base "string") - (#eq? @_entry "format") - (#set! injection.language "printf")) + (arguments + . + (string) @injection.content)) + (#eq? @_base "string") + (#eq? @_entry "format") + (#set! injection.language "printf")) ; ('...'):format() ((function_call - (method_index (string) @printf + (method_index + (string) @printf key: (identifier) @_func)) - (#eq? @_func "format") - (#set! injection.language "printf")) + (#eq? @_func "format") + (#set! injection.language "printf")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/teal/locals.scm b/queries/teal/locals.scm index e26efc43e..25b56418f 100644 --- a/queries/teal/locals.scm +++ b/queries/teal/locals.scm @@ -1,23 +1,38 @@ (var_declaration - declarators: (var_declarators - (var (identifier)) @local.definition.var)) + declarators: + (var_declarators + (var + (identifier)) @local.definition.var)) (var_assignment - variables: (assignment_variables - (var (identifier) @local.definition.var) @local.definition.associated)) + variables: + (assignment_variables + (var + (identifier) @local.definition.var) @local.definition.associated)) -(arg name: (identifier) @local.definition.parameter) +(arg + name: (identifier) @local.definition.parameter) (anon_function) @local.scope + ((function_statement (function_name) @local.definition.function) @local.scope) (program) @local.scope + (if_statement) @local.scope -(generic_for_statement (for_body) @local.scope) -(numeric_for_statement (for_body) @local.scope) + +(generic_for_statement + (for_body) @local.scope) + +(numeric_for_statement + (for_body) @local.scope) + (repeat_statement) @local.scope -(while_statement (while_body) @local.scope) + +(while_statement + (while_body) @local.scope) + (do_statement) @local.scope (identifier) @local.reference diff --git a/queries/templ/highlights.scm b/queries/templ/highlights.scm index 1187344a9..f8e9d2359 100644 --- a/queries/templ/highlights.scm +++ b/queries/templ/highlights.scm @@ -1,5 +1,4 @@ ; inherits: go - (component_declaration name: (component_identifier) @function) @@ -12,6 +11,7 @@ (attribute name: (attribute_name) @tag.attribute) + (attribute value: (quoted_attribute_value) @string) @@ -21,8 +21,10 @@ ] @string.special (css_identifier) @function + (css_property name: (css_property_name) @attribute) + (css_property value: (css_property_value) @attribute) diff --git a/queries/templ/injections.scm b/queries/templ/injections.scm index 54e8d6f68..df87ddc97 100644 --- a/queries/templ/injections.scm +++ b/queries/templ/injections.scm @@ -1,8 +1,12 @@ ; inherits: go +((element_comment) @injection.content + (#set! injection.language "comment")) -((element_comment) @injection.content (#set! injection.language "comment")) +((script_block_text) @injection.content + (#set! injection.language "javascript")) -((script_block_text) @injection.content (#set! injection.language "javascript")) -((script_element_text) @injection.content (#set! injection.language "javascript")) +((script_element_text) @injection.content + (#set! injection.language "javascript")) -((style_element_text) @injection.content (#set! injection.language "css")) +((style_element_text) @injection.content + (#set! injection.language "css")) diff --git a/queries/terraform/highlights.scm b/queries/terraform/highlights.scm index d75b4284f..4050ce77a 100644 --- a/queries/terraform/highlights.scm +++ b/queries/terraform/highlights.scm @@ -1,21 +1,41 @@ ; inherits: hcl - ; Terraform specific references ; ; ; local/module/data/var/output -(expression (variable_expr (identifier) @variable.builtin (#any-of? @variable.builtin "data" "var" "local" "module" "output")) (get_attr (identifier) @variable.member)) +(expression + (variable_expr + (identifier) @variable.builtin + (#any-of? @variable.builtin "data" "var" "local" "module" "output")) + (get_attr + (identifier) @variable.member)) ; path.root/cwd/module -(expression (variable_expr (identifier) @type.builtin (#eq? @type.builtin "path")) (get_attr (identifier) @variable.builtin (#any-of? @variable.builtin "root" "cwd" "module"))) +(expression + (variable_expr + (identifier) @type.builtin + (#eq? @type.builtin "path")) + (get_attr + (identifier) @variable.builtin + (#any-of? @variable.builtin "root" "cwd" "module"))) ; terraform.workspace -(expression (variable_expr (identifier) @type.builtin (#eq? @type.builtin "terraform")) (get_attr (identifier) @variable.builtin (#any-of? @variable.builtin "workspace"))) +(expression + (variable_expr + (identifier) @type.builtin + (#eq? @type.builtin "terraform")) + (get_attr + (identifier) @variable.builtin + (#any-of? @variable.builtin "workspace"))) ; Terraform specific keywords - ; FIXME: ideally only for identifiers under a `variable` block to minimize false positives -((identifier) @type.builtin (#any-of? @type.builtin "bool" "string" "number" "object" "tuple" "list" "map" "set" "any")) -(object_elem val: (expression - (variable_expr - (identifier) @type.builtin (#any-of? @type.builtin "bool" "string" "number" "object" "tuple" "list" "map" "set" "any")))) +((identifier) @type.builtin + (#any-of? @type.builtin "bool" "string" "number" "object" "tuple" "list" "map" "set" "any")) + +(object_elem + val: + (expression + (variable_expr + (identifier) @type.builtin + (#any-of? @type.builtin "bool" "string" "number" "object" "tuple" "list" "map" "set" "any")))) diff --git a/queries/textproto/highlights.scm b/queries/textproto/highlights.scm index 439ca6875..451362216 100644 --- a/queries/textproto/highlights.scm +++ b/queries/textproto/highlights.scm @@ -5,8 +5,13 @@ (comment) @comment (number) @number + ; For stuff like "inf" and "-inf". -(scalar_value [ (identifier) (signed_identifier) ]) @number +(scalar_value + [ + (identifier) + (signed_identifier) + ]) @number [ (open_squiggly) diff --git a/queries/textproto/indents.scm b/queries/textproto/indents.scm index fd6db7ffb..155299e39 100644 --- a/queries/textproto/indents.scm +++ b/queries/textproto/indents.scm @@ -1,7 +1,14 @@ (message_value) @indent.begin -(message_value (close_squiggly) @indent.branch) + +(message_value + (close_squiggly) @indent.branch) (scalar_list) @indent.begin -(scalar_list (close_square) @indent.branch) + +(scalar_list + (close_square) @indent.branch) + (message_list) @indent.begin -(message_list (close_square) @indent.branch) + +(message_list + (close_square) @indent.branch) diff --git a/queries/thrift/folds.scm b/queries/thrift/folds.scm index 1361be1f8..3beec3567 100644 --- a/queries/thrift/folds.scm +++ b/queries/thrift/folds.scm @@ -7,6 +7,5 @@ (service_definition) (struct_definition) (union_definition) - (comment) ] @fold diff --git a/queries/thrift/highlights.scm b/queries/thrift/highlights.scm index a1ccdc9a2..984e702e4 100644 --- a/queries/thrift/highlights.scm +++ b/queries/thrift/highlights.scm @@ -1,51 +1,54 @@ ; Variables - ((identifier) @variable (#set! "priority" 95)) ; Includes - [ "include" "cpp_include" ] @keyword.import ; Function - (function_definition (identifier) @function) ; Fields - -(field (identifier) @variable.member) +(field + (identifier) @variable.member) ; Parameters - (function_definition (parameters - (parameter (identifier) @variable.parameter))) + (parameter + (identifier) @variable.parameter))) (throws (parameters - (parameter (identifier) @variable.parameter))) + (parameter + (identifier) @variable.parameter))) ; Types - (typedef_identifier) @type + (struct_definition - "struct" (identifier) @type) + "struct" + (identifier) @type) (union_definition - "union" (identifier) @type) + "union" + (identifier) @type) (exception_definition - "exception" (identifier) @type) + "exception" + (identifier) @type) (service_definition - "service" (identifier) @type) + "service" + (identifier) @type) (interaction_definition - "interaction" (identifier) @type) + "interaction" + (identifier) @type) (type type: (identifier) @type) @@ -57,16 +60,21 @@ (#lua-match? @type "^[_]*[A-Z]")) ; Constants +(const_definition + (identifier) @constant) -(const_definition (identifier) @constant) ((identifier) @constant (#lua-match? @constant "^[_A-Z][A-Z0-9_]*$")) -(enum_definition "enum" - . (identifier) @type - "{" (identifier) @constant "}") -; Builtin Types +(enum_definition + "enum" + . + (identifier) @type + "{" + (identifier) @constant + "}") +; Builtin Types (primitive) @type.builtin [ @@ -79,35 +87,38 @@ ] @type.builtin ; Namespace - (namespace_declaration (namespace_scope) @tag - [(namespace) @module (_ (identifier) @module)]) + [ + (namespace) @module + (_ + (identifier) @module) + ]) ; Attributes - (annotation_definition - (annotation_identifier (identifier) @attribute)) + (annotation_identifier + (identifier) @attribute)) + (fb_annotation_definition - "@" @attribute (annotation_identifier (identifier) @attribute) + "@" @attribute + (annotation_identifier + (identifier) @attribute) (identifier)? @attribute) -(namespace_uri (string) @attribute) -; Operators +(namespace_uri + (string) @attribute) +; Operators [ "=" "&" ] @operator ; Exceptions - -[ - "throws" -] @keyword.exception +"throws" @keyword.exception ; Keywords - [ "enum" "exception" @@ -123,7 +134,6 @@ ] @keyword ; Deprecated Keywords - [ "cocoa_prefix" "cpp_namespace" @@ -155,7 +165,6 @@ ] @keyword.coroutine ; Qualifiers - [ "client" "const" @@ -171,7 +180,6 @@ ] @type.qualifier ; Literals - (string) @string (escape_sequence) @string.escape @@ -186,22 +194,30 @@ (boolean) @boolean ; Typedefs - (typedef_identifier) @type.definition ; Punctuation +"*" @punctuation.special [ - "*" -] @punctuation.special + "{" + "}" +] @punctuation.bracket -["{" "}"] @punctuation.bracket - -["(" ")"] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -["[" "]"] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -["<" ">"] @punctuation.bracket +[ + "<" + ">" +] @punctuation.bracket [ "." @@ -211,7 +227,6 @@ ] @punctuation.delimiter ; Comments - (comment) @comment @spell ((comment) @comment.documentation @@ -219,6 +234,7 @@ ((comment) @comment.documentation (#lua-match? @comment.documentation "^///[^/]")) + ((comment) @comment.documentation (#lua-match? @comment.documentation "^///$")) diff --git a/queries/thrift/indents.scm b/queries/thrift/indents.scm index 32c6a2e9f..db49c0712 100644 --- a/queries/thrift/indents.scm +++ b/queries/thrift/indents.scm @@ -1,14 +1,21 @@ (definition) @indent.begin -((parameters (parameter)) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) +((parameters + (parameter)) @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) "}" @indent.end -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch [ (ERROR) diff --git a/queries/thrift/injections.scm b/queries/thrift/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/thrift/injections.scm +++ b/queries/thrift/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/thrift/locals.scm b/queries/thrift/locals.scm index d1c4af9a1..49f25bdde 100644 --- a/queries/thrift/locals.scm +++ b/queries/thrift/locals.scm @@ -1,51 +1,70 @@ ; Scopes - [ (document) (definition) ] @local.scope ; References - (identifier) @local.reference ; Definitions - (annotation_identifier) @local.definition -(const_definition (identifier) @local.definition.constant) +(const_definition + (identifier) @local.definition.constant) -(enum_definition "enum" - . (identifier) @local.definition.enum - "{" (identifier) @local.definition.constant "}") +(enum_definition + "enum" + . + (identifier) @local.definition.enum + "{" + (identifier) @local.definition.constant + "}") -(senum_definition "senum" - . (identifier) @local.definition.enum) +(senum_definition + "senum" + . + (identifier) @local.definition.enum) -(field (identifier) @local.definition.field) +(field + (identifier) @local.definition.field) -(function_definition (identifier) @local.definition.function) +(function_definition + (identifier) @local.definition.function) (namespace_declaration - "namespace" (namespace_scope) - . (_) @local.definition.namespace + "namespace" + (namespace_scope) + . + (_) @local.definition.namespace (namespace_uri)?) -(parameter (identifier) @local.definition.parameter) +(parameter + (identifier) @local.definition.parameter) (struct_definition - "struct" . (identifier) @local.definition.type) + "struct" + . + (identifier) @local.definition.type) (union_definition - "union" . (identifier) @local.definition.type) + "union" + . + (identifier) @local.definition.type) (exception_definition - "exception" . (identifier) @local.definition.type) + "exception" + . + (identifier) @local.definition.type) (service_definition - "service" . (identifier) @local.definition.type) + "service" + . + (identifier) @local.definition.type) (interaction_definition - "interaction" . (identifier) @local.definition.type) + "interaction" + . + (identifier) @local.definition.type) (typedef_identifier) @local.definition.type diff --git a/queries/tiger/folds.scm b/queries/tiger/folds.scm index 24332a0f2..c74871bde 100644 --- a/queries/tiger/folds.scm +++ b/queries/tiger/folds.scm @@ -8,12 +8,9 @@ (let_expression) (function_declaration) (primitive_declaration) - (record_type) - (class_declaration) (class_type) (method_declaration) ] @fold - ; vim: sw=2 foldmethod=marker diff --git a/queries/tiger/highlights.scm b/queries/tiger/highlights.scm index 0516341c3..e77d80229 100644 --- a/queries/tiger/highlights.scm +++ b/queries/tiger/highlights.scm @@ -1,29 +1,20 @@ ; Built-ins {{{ ((function_call function: (identifier) @function.builtin) - (#any-of? @function.builtin "chr" "concat" "exit" "flush" "getchar" "not" "ord" "print" "print_err" "print_int" "size" "strcmp" "streq" "substring") - ; FIXME: not supported by neovim - ; (#is-not? local) - ) + (#any-of? @function.builtin "chr" "concat" "exit" "flush" "getchar" "not" "ord" "print" "print_err" "print_int" "size" "strcmp" "streq" "substring")) ((type_identifier) @type.builtin - (#any-of? @type.builtin "int" "string" "Object") - ; FIXME: not supported by neovim - ; (#is-not? local) - ) + (#any-of? @type.builtin "int" "string" "Object")) ((identifier) @variable.builtin - (#eq? @variable.builtin "self") - ; FIXME: not supported by neovim - ; (#is-not? local) - ) -; }}} + (#eq? @variable.builtin "self")) +; }}} ; Keywords {{{ [ - "function" - "primitive" - "method" + "function" + "primitive" + "method" ] @keyword.function [ @@ -49,73 +40,79 @@ "then" "type" "var" - "class" "extends" - "_cast" "_chunks" "_exp" "_lvalue" "_namety" ] @keyword -; }}} +; }}} ; Operators {{{ (operator) @operator [ - "," - ";" - ":" - "." + "," + ";" + ":" + "." ] @punctuation.delimiter [ - "(" - ")" - "[" - "]" - "{" - "}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket -; }}} +; }}} ; Functions and methods {{{ (function_call function: (identifier) @function) + (function_declaration name: (identifier) @function) + (primitive_declaration name: (identifier) @function) (method_call method: (identifier) @function.method) + (method_declaration name: (identifier) @function.method) (parameters name: (identifier) @variable.parameter) -; }}} +; }}} ; Declarations {{{ (import_declaration file: (string_literal) @string.special.path) -; }}} +; }}} ; Literals {{{ (nil_literal) @constant.builtin + (integer_literal) @number + (string_literal) @string + (escape_sequence) @string.escape -; }}} +; }}} ; Misc {{{ (comment) @comment @spell (type_identifier) @type + (field_identifier) @property + (identifier) @variable -; }}} +; }}} ; vim: sw=2 foldmethod=marker diff --git a/queries/tiger/indents.scm b/queries/tiger/indents.scm index 6f6c80bae..686bfde16 100644 --- a/queries/tiger/indents.scm +++ b/queries/tiger/indents.scm @@ -1,70 +1,104 @@ ; Control flow {{{ (if_expression) @indent.begin + "then" @indent.branch + "else" @indent.branch (while_expression) @indent.begin + "do" @indent.branch (for_expression) @indent.begin + "to" @indent.branch -; }}} +; }}} ; Class {{{ (class_declaration) @indent.begin -(class_declaration "}" @indent.end) + +(class_declaration + "}" @indent.end) (class_type) @indent.begin -(class_type "}" @indent.end) -; }}} +(class_type + "}" @indent.end) + +; }}} ; Groups {{{ (let_expression) @indent.begin + "in" @indent.branch + "end" @indent.branch -(let_expression "end" @indent.end) + +(let_expression + "end" @indent.end) (sequence_expression) @indent.begin + ")" @indent.branch -(sequence_expression ")" @indent.end) -; }}} +(sequence_expression + ")" @indent.end) + +; }}} ; Functions and methods {{{ (parameters) @indent.begin -(parameters ")" @indent.end) + +(parameters + ")" @indent.end) (function_call) @indent.begin -(function_call ")" @indent.end) + +(function_call + ")" @indent.end) + (method_call) @indent.begin + ")" @indent.branch (function_declaration) @indent.begin + (primitive_declaration) @indent.begin + (method_declaration) @indent.begin -; }}} +; }}} ; Values and expressions {{{ (array_value) @indent.begin + "]" @indent.branch -(array_value "]" @indent.end) + +(array_value + "]" @indent.end) (array_expression) @indent.begin + "of" @indent.branch (record_expression) @indent.begin + "}" @indent.branch -(record_expression "}" @indent.end) + +(record_expression + "}" @indent.end) (record_type) @indent.begin + "}" @indent.branch -(record_type "}" @indent.end) + +(record_type + "}" @indent.end) (variable_declaration) @indent.begin -; }}} +; }}} ; Misc{{{ (comment) @indent.ignore + (string_literal) @indent.ignore -; }}} +; }}} ; vim: sw=2 foldmethod=marker diff --git a/queries/tiger/injections.scm b/queries/tiger/injections.scm index b0063012c..5dfaa7aeb 100644 --- a/queries/tiger/injections.scm +++ b/queries/tiger/injections.scm @@ -1,4 +1,3 @@ ((comment) @injection.content - (#set! injection.language "comment")) - + (#set! injection.language "comment")) ; vim: sw=2 foldmethod=marker diff --git a/queries/tiger/locals.scm b/queries/tiger/locals.scm index df26bb2a0..f010dd0e8 100644 --- a/queries/tiger/locals.scm +++ b/queries/tiger/locals.scm @@ -3,15 +3,14 @@ ; top-to-bottom). ; ; [1]: https://github.com/tree-sitter/tree-sitter/issues/918 - ; Scopes {{{ [ - (for_expression) - (let_expression) - (function_declaration) + (for_expression) + (let_expression) + (function_declaration) ] @local.scope -; }}} +; }}} ; Definitions {{{ (type_declaration name: (identifier) @local.definition.type @@ -23,6 +22,7 @@ (function_declaration name: (identifier) @local.definition.function (#set! "definition.var.scope" "parent")) + (primitive_declaration name: (identifier) @local.definition.function (#set! "definition.var.scope" "parent")) @@ -30,10 +30,10 @@ (variable_declaration name: (identifier) @local.definition.var (#set! "definition.var.scope" "parent")) -; }}} +; }}} ; References {{{ (identifier) @local.reference -; }}} +; }}} ; vim: sw=2 foldmethod=marker diff --git a/queries/tlaplus/highlights.scm b/queries/tlaplus/highlights.scm index f1ad576cf..be4b24581 100644 --- a/queries/tlaplus/highlights.scm +++ b/queries/tlaplus/highlights.scm @@ -1,8 +1,7 @@ -; ; Intended for consumption by nvim-treesitter +; ; Intended for consumption by nvim-treesitter ; ; Default capture names for nvim-treesitter found here: ; ; https://github.com/nvim-treesitter/nvim-treesitter/blob/e473630fe0872cb0ed97cd7085e724aa58bc1c84/lua/nvim-treesitter/highlight.lua#L14-L104 ; ; In this file, captures defined later take precedence over captures defined earlier - ; Keywords [ "ACTION" @@ -97,96 +96,203 @@ "when" "with" ] @keyword + +"await" @keyword.coroutine + +(pcal_with + ("=") @keyword) + +(pcal_process + ("=") @keyword) + [ - "await" -] @keyword.coroutine -(pcal_with ("=") @keyword) -(pcal_process ("=") @keyword) -[ - "if" - "then" - "else" + "if" + "then" + "else" "elsif" (pcal_end_if) "either" (pcal_end_either) ] @keyword.conditional -[ - "while" - "do" - (pcal_end_while) - "with" + +[ + "while" + "do" + (pcal_end_while) + "with" (pcal_end_with) ] @keyword.repeat + ("return") @keyword.return -("print") @function.macro +("print") @function.macro ; Literals -(binary_number (format) @keyword) -(binary_number (value) @number) +(binary_number + (format) @keyword) + +(binary_number + (value) @number) + (boolean) @boolean + (boolean_set) @type -(hex_number (format) @keyword) -(hex_number (value) @number) + +(hex_number + (format) @keyword) + +(hex_number + (value) @number) + (int_number_set) @type + (nat_number) @number + (nat_number_set) @type -(octal_number (format) @keyword) -(octal_number (value) @number) + +(octal_number + (format) @keyword) + +(octal_number + (value) @number) + (real_number) @number + (real_number_set) @type + (string) @string + (escape_char) @string.escape + (string_set) @type ; Namespaces -(extends (identifier_ref) @module) -(instance (identifier_ref) @module) -(module name: (identifier) @module) -(pcal_algorithm name: (identifier) @module) +(extends + (identifier_ref) @module) + +(instance + (identifier_ref) @module) + +(module + name: (identifier) @module) + +(pcal_algorithm + name: (identifier) @module) ; Operators, functions, and macros -(bound_infix_op symbol: (_) @operator) -(bound_nonfix_op symbol: (_) @operator) -(bound_postfix_op symbol: (_) @operator) -(bound_prefix_op symbol: (_) @operator) +(bound_infix_op + symbol: (_) @operator) + +(bound_nonfix_op + symbol: (_) @operator) + +(bound_postfix_op + symbol: (_) @operator) + +(bound_prefix_op + symbol: (_) @operator) + ((prefix_op_symbol) @operator) + ((infix_op_symbol) @operator) + ((postfix_op_symbol) @operator) -(function_definition name: (identifier) @function) -(module_definition name: (_) @keyword.import) -(operator_definition name: (_) @function.macro) -(pcal_macro_decl name: (identifier) @function.macro) -(pcal_macro_call name: (identifier) @function.macro) -(pcal_proc_decl name: (identifier) @function.macro) -(pcal_process name: (identifier) @function) -(recursive_declaration (identifier) @function.macro) -(recursive_declaration (operator_declaration name: (_) @function.macro)) + +(function_definition + name: (identifier) @function) + +(module_definition + name: (_) @keyword.import) + +(operator_definition + name: (_) @function.macro) + +(pcal_macro_decl + name: (identifier) @function.macro) + +(pcal_macro_call + name: (identifier) @function.macro) + +(pcal_proc_decl + name: (identifier) @function.macro) + +(pcal_process + name: (identifier) @function) + +(recursive_declaration + (identifier) @function.macro) + +(recursive_declaration + (operator_declaration + name: (_) @function.macro)) ; Constants and variables -(constant_declaration (identifier) @constant) -(constant_declaration (operator_declaration name: (_) @constant)) -(pcal_var_decl (identifier) @variable) -(pcal_with (identifier) @variable.parameter) -((".") . (identifier) @attribute) -(record_literal (identifier) @attribute) -(set_of_records (identifier) @attribute) -(variable_declaration (identifier) @variable) +(constant_declaration + (identifier) @constant) + +(constant_declaration + (operator_declaration + name: (_) @constant)) + +(pcal_var_decl + (identifier) @variable) + +(pcal_with + (identifier) @variable.parameter) + +((".") + . + (identifier) @attribute) + +(record_literal + (identifier) @attribute) + +(set_of_records + (identifier) @attribute) + +(variable_declaration + (identifier) @variable) ; Parameters -(choose (identifier) @variable.parameter) -(choose (tuple_of_identifiers (identifier) @variable.parameter)) -(lambda (identifier) @variable.parameter) -(module_definition (operator_declaration name: (_) @variable.parameter)) -(module_definition parameter: (identifier) @variable.parameter) -(operator_definition (operator_declaration name: (_) @variable.parameter)) -(operator_definition parameter: (identifier) @variable.parameter) -(pcal_macro_decl parameter: (identifier) @variable.parameter) -(pcal_proc_var_decl (identifier) @variable.parameter) -(quantifier_bound (identifier) @variable.parameter) -(quantifier_bound (tuple_of_identifiers (identifier) @variable.parameter)) -(unbounded_quantification (identifier) @variable.parameter) +(choose + (identifier) @variable.parameter) + +(choose + (tuple_of_identifiers + (identifier) @variable.parameter)) + +(lambda + (identifier) @variable.parameter) + +(module_definition + (operator_declaration + name: (_) @variable.parameter)) + +(module_definition + parameter: (identifier) @variable.parameter) + +(operator_definition + (operator_declaration + name: (_) @variable.parameter)) + +(operator_definition + parameter: (identifier) @variable.parameter) + +(pcal_macro_decl + parameter: (identifier) @variable.parameter) + +(pcal_proc_var_decl + (identifier) @variable.parameter) + +(quantifier_bound + (identifier) @variable.parameter) + +(quantifier_bound + (tuple_of_identifiers + (identifier) @variable.parameter)) + +(unbounded_quantification + (identifier) @variable.parameter) ; Delimiters [ @@ -201,6 +307,7 @@ "(" ")" ] @punctuation.bracket + [ "," ":" @@ -214,57 +321,69 @@ ] @punctuation.delimiter ; Proofs -(assume_prove (new (identifier) @variable.parameter)) -(assume_prove (new (operator_declaration name: (_) @variable.parameter))) -(assumption name: (identifier) @constant) -(pick_proof_step (identifier) @variable.parameter) -(proof_step_id "<" @punctuation.bracket) -(proof_step_id (level) @label) -(proof_step_id (name) @label) -(proof_step_id ">" @punctuation.bracket) -(proof_step_ref "<" @punctuation.bracket) -(proof_step_ref (level) @label) -(proof_step_ref (name) @label) -(proof_step_ref ">" @punctuation.bracket) -(take_proof_step (identifier) @variable.parameter) -(theorem name: (identifier) @constant) +(assume_prove + (new + (identifier) @variable.parameter)) + +(assume_prove + (new + (operator_declaration + name: (_) @variable.parameter))) + +(assumption + name: (identifier) @constant) + +(pick_proof_step + (identifier) @variable.parameter) + +(proof_step_id + "<" @punctuation.bracket) + +(proof_step_id + (level) @label) + +(proof_step_id + (name) @label) + +(proof_step_id + ">" @punctuation.bracket) + +(proof_step_ref + "<" @punctuation.bracket) + +(proof_step_ref + (level) @label) + +(proof_step_ref + (name) @label) + +(proof_step_ref + ">" @punctuation.bracket) + +(take_proof_step + (identifier) @variable.parameter) + +(theorem + name: (identifier) @constant) ; Comments and tags -(block_comment "(*" @comment) -(block_comment "*)" @comment) +(block_comment + "(*" @comment) + +(block_comment + "*)" @comment) + (block_comment_text) @comment @spell + (comment) @comment @spell + (single_line) @comment -(_ label: (identifier) @label) -(label name: (_) @label) -(pcal_goto statement: (identifier) @label) -; Reference highlighting with the same color as declarations. -; `constant`, `operator`, and others are custom captures defined in locals.scm -((identifier_ref) @constant (#is? @constant constant)) -((identifier_ref) @function (#is? @function function)) -((identifier_ref) @function.macro (#is? @function.macro macro)) -((identifier_ref) @include (#is? @include import)) -((identifier_ref) @parameter (#is? @parameter parameter)) -((identifier_ref) @variable (#is? @variable var)) -((prefix_op_symbol) @constant (#is? @constant constant)) -((prefix_op_symbol) @function.macro (#is? @function.macro macro)) -((prefix_op_symbol) @parameter (#is? @parameter parameter)) -((infix_op_symbol) @constant (#is? @constant constant)) -((infix_op_symbol) @function.macro (#is? @function.macro macro)) -((infix_op_symbol) @parameter (#is? @parameter parameter)) -((postfix_op_symbol) @constant (#is? @constant constant)) -((postfix_op_symbol) @function.macro (#is? @function.macro macro)) -((postfix_op_symbol) @parameter (#is? @parameter parameter)) -(bound_prefix_op symbol: (_) @constant (#is? @constant constant)) -(bound_prefix_op symbol: (_) @function.macro (#is? @function.macro macro)) -(bound_prefix_op symbol: (_) @parameter (#is? @parameter parameter)) -(bound_infix_op symbol: (_) @constant (#is? @constant constant)) -(bound_infix_op symbol: (_) @function.macro (#is? @function.macro macro)) -(bound_infix_op symbol: (_) @parameter (#is? @parameter parameter)) -(bound_postfix_op symbol: (_) @constant (#is? @constant constant)) -(bound_postfix_op symbol: (_) @function.macro (#is? @function.macro macro)) -(bound_postfix_op symbol: (_) @parameter (#is? @parameter parameter)) -(bound_nonfix_op symbol: (_) @constant (#is? @constant constant)) -(bound_nonfix_op symbol: (_) @function.macro (#is? @function.macro macro)) -(bound_nonfix_op symbol: (_) @parameter (#is? @parameter parameter)) +(_ + label: (identifier) @label) + +(label + name: (_) @label) + +(pcal_goto + statement: (identifier) @label) diff --git a/queries/tlaplus/injections.scm b/queries/tlaplus/injections.scm index b88c1facb..fbeff500b 100644 --- a/queries/tlaplus/injections.scm +++ b/queries/tlaplus/injections.scm @@ -1,5 +1,5 @@ ([ (comment) (block_comment_text) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) diff --git a/queries/tlaplus/locals.scm b/queries/tlaplus/locals.scm index fbb4abf97..26d36140e 100644 --- a/queries/tlaplus/locals.scm +++ b/queries/tlaplus/locals.scm @@ -2,11 +2,11 @@ [ (bounded_quantification) (choose) - (function_definition) + (function_definition) (function_literal) - (lambda) + (lambda) (let_in) - (module) + (module) (module_definition) (operator_definition) (set_filter) @@ -14,28 +14,63 @@ (unbounded_quantification) ] @local.scope -(choose (identifier) @local.definition.parameter) -(choose (tuple_of_identifiers (identifier) @local.definition.parameter)) -(constant_declaration (identifier) @local.definition.constant) -(constant_declaration (operator_declaration name: (_) @local.definition.constant)) +(choose + (identifier) @local.definition.parameter) + +(choose + (tuple_of_identifiers + (identifier) @local.definition.parameter)) + +(constant_declaration + (identifier) @local.definition.constant) + +(constant_declaration + (operator_declaration + name: (_) @local.definition.constant)) + (function_definition name: (identifier) @local.definition.function (#set! "definition.function.scope" "parent")) -(lambda (identifier) @local.definition.parameter) + +(lambda + (identifier) @local.definition.parameter) + (module_definition name: (_) @local.definition.import (#set! "definition.import.scope" "parent")) -(module_definition parameter: (identifier) @local.definition.parameter) -(module_definition parameter: (operator_declaration name: (_) @local.definition.parameter)) + +(module_definition + parameter: (identifier) @local.definition.parameter) + +(module_definition + parameter: + (operator_declaration + name: (_) @local.definition.parameter)) + (operator_definition name: (_) @local.definition.macro (#set! "definition.macro.scope" "parent")) -(operator_definition parameter: (identifier) @local.definition.parameter) -(operator_definition parameter: (operator_declaration name: (_) @local.definition.parameter)) -(quantifier_bound (identifier) @local.definition.parameter) -(quantifier_bound (tuple_of_identifiers (identifier) @local.definition.parameter)) -(unbounded_quantification (identifier) @local.definition.parameter) -(variable_declaration (identifier) @local.definition.var) + +(operator_definition + parameter: (identifier) @local.definition.parameter) + +(operator_definition + parameter: + (operator_declaration + name: (_) @local.definition.parameter)) + +(quantifier_bound + (identifier) @local.definition.parameter) + +(quantifier_bound + (tuple_of_identifiers + (identifier) @local.definition.parameter)) + +(unbounded_quantification + (identifier) @local.definition.parameter) + +(variable_declaration + (identifier) @local.definition.var) ; Proof scopes and definitions [ @@ -44,11 +79,24 @@ (theorem) ] @local.scope -(assume_prove (new (identifier) @local.definition.parameter)) -(assume_prove (new (operator_declaration name: (_) @local.definition.parameter))) -(assumption name: (identifier) @local.definition.constant) -(pick_proof_step (identifier) @local.definition.parameter) -(take_proof_step (identifier) @local.definition.parameter) +(assume_prove + (new + (identifier) @local.definition.parameter)) + +(assume_prove + (new + (operator_declaration + name: (_) @local.definition.parameter))) + +(assumption + name: (identifier) @local.definition.constant) + +(pick_proof_step + (identifier) @local.definition.parameter) + +(take_proof_step + (identifier) @local.definition.parameter) + (theorem name: (identifier) @local.definition.constant (#set! "definition.constant.scope" "parent")) @@ -61,28 +109,61 @@ (pcal_with) ] @local.scope -(pcal_macro_decl parameter: (identifier) @local.definition.parameter) -(pcal_proc_var_decl (identifier) @local.definition.parameter) -(pcal_var_decl (identifier) @local.definition.var) -(pcal_with (identifier) @local.definition.parameter) +(pcal_macro_decl + parameter: (identifier) @local.definition.parameter) + +(pcal_proc_var_decl + (identifier) @local.definition.parameter) + +(pcal_var_decl + (identifier) @local.definition.var) + +(pcal_with + (identifier) @local.definition.parameter) ; Built-in PlusCal variables (pcal_algorithm_body [ - (_ (identifier_ref) @local.definition.var) - (_ (_ (identifier_ref) @local.definition.var)) - (_ (_ (_ (identifier_ref) @local.definition.var))) - (_ (_ (_ (_ (identifier_ref) @local.definition.var)))) - (_ (_ (_ (_ (_ (identifier_ref) @local.definition.var))))) + (_ + (identifier_ref) @local.definition.var) + (_ + (_ + (identifier_ref) @local.definition.var)) + (_ + (_ + (_ + (identifier_ref) @local.definition.var))) + (_ + (_ + (_ + (_ + (identifier_ref) @local.definition.var)))) + (_ + (_ + (_ + (_ + (_ + (identifier_ref) @local.definition.var))))) ] (#any-of? @local.definition.var "self" "pc" "stack")) ; References (identifier_ref) @local.reference + ((prefix_op_symbol) @local.reference) -(bound_prefix_op symbol: (_) @local.reference) + +(bound_prefix_op + symbol: (_) @local.reference) + ((infix_op_symbol) @local.reference) -(bound_infix_op symbol: (_) @local.reference) + +(bound_infix_op + symbol: (_) @local.reference) + ((postfix_op_symbol) @local.reference) -(bound_postfix_op symbol: (_) @local.reference) -(bound_nonfix_op symbol: (_) @local.reference) + +(bound_postfix_op + symbol: (_) @local.reference) + +(bound_nonfix_op + symbol: (_) @local.reference) diff --git a/queries/todotxt/highlights.scm b/queries/todotxt/highlights.scm index 37f91b8a7..1da096201 100644 --- a/queries/todotxt/highlights.scm +++ b/queries/todotxt/highlights.scm @@ -1,6 +1,16 @@ (done_task) @comment -(task (priority) @keyword) -(task (date) @comment) -(task (kv) @comment) -(task (project) @string) -(task (context) @type) + +(task + (priority) @keyword) + +(task + (date) @comment) + +(task + (kv) @comment) + +(task + (project) @string) + +(task + (context) @type) diff --git a/queries/toml/highlights.scm b/queries/toml/highlights.scm index a54dc167e..4e3c41f97 100644 --- a/queries/toml/highlights.scm +++ b/queries/toml/highlights.scm @@ -1,34 +1,48 @@ ; Properties ;----------- - (bare_key) @type + (quoted_key) @string -(pair (bare_key)) @property + +(pair + (bare_key)) @property ; Literals ;--------- - (boolean) @boolean + (comment) @comment @spell + (string) @string + (integer) @number + (float) @number.float + (offset_date_time) @string.special + (local_date_time) @string.special + (local_date) @string.special + (local_time) @string.special ; Punctuation ;------------ - "." @punctuation.delimiter + "," @punctuation.delimiter "=" @operator "[" @punctuation.bracket + "]" @punctuation.bracket + "[[" @punctuation.bracket + "]]" @punctuation.bracket + "{" @punctuation.bracket + "}" @punctuation.bracket diff --git a/queries/toml/injections.scm b/queries/toml/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/toml/injections.scm +++ b/queries/toml/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/tsv/highlights.scm b/queries/tsv/highlights.scm index d406bd903..f00f13da3 100644 --- a/queries/tsv/highlights.scm +++ b/queries/tsv/highlights.scm @@ -1,4 +1,7 @@ (text) @string + (number) @number + (float) @number.float + (boolean) @boolean diff --git a/queries/turtle/highlights.scm b/queries/turtle/highlights.scm index 4462d583a..f4db53c36 100644 --- a/queries/turtle/highlights.scm +++ b/queries/turtle/highlights.scm @@ -4,8 +4,8 @@ [ "_:" - "<" - ">" + "<" + ">" (namespace) ] @module @@ -52,7 +52,12 @@ (echar) @string.escape - -(rdf_literal +(rdf_literal "^^" @type - datatype: (_ ["<" ">" (namespace)] @type) @type) + datatype: + (_ + [ + "<" + ">" + (namespace) + ] @type) @type) diff --git a/queries/turtle/indents.scm b/queries/turtle/indents.scm index 4d40b3cbe..add94d18b 100644 --- a/queries/turtle/indents.scm +++ b/queries/turtle/indents.scm @@ -1,10 +1,10 @@ [ - (statement) - (blank_node_property_list) - (collection) + (statement) + (blank_node_property_list) + (collection) ] @indent.begin + [ "]" ")" ] @indent.branch - diff --git a/queries/turtle/injections.scm b/queries/turtle/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/turtle/injections.scm +++ b/queries/turtle/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/twig/highlights.scm b/queries/twig/highlights.scm index a0a19160d..435fdc0f1 100644 --- a/queries/twig/highlights.scm +++ b/queries/twig/highlights.scm @@ -1,55 +1,81 @@ (comment) @comment @spell (filter_identifier) @function.call + (function_identifier) @function.call + (test) @function.builtin + (variable) @variable + (string) @string + (interpolated_string) @string + (operator) @operator + (number) @number + (boolean) @boolean + (null) @constant.builtin + (keyword) @keyword + (attribute) @attribute + (tag) @tag + (conditional) @keyword.conditional + (repeat) @keyword.repeat + (method) @function.method + (parameter) @variable.parameter [ - "{{" - "}}" - "{{-" - "-}}" - "{{~" - "~}}" - "{%" - "%}" - "{%-" - "-%}" - "{%~" - "~%}" + "{{" + "}}" + "{{-" + "-}}" + "{{~" + "~}}" + "{%" + "%}" + "{%-" + "-%}" + "{%~" + "~%}" ] @tag.delimiter [ - "," - "." + "," + "." ] @punctuation.delimiter [ - "?" - ":" - "=" - "|" + "?" + ":" + "=" + "|" ] @operator -(interpolated_string ["#{" "}"] @punctuation.special) +(interpolated_string + [ + "#{" + "}" + ] @punctuation.special) [ - "(" ")" - "[" "]" + "(" + ")" + "[" + "]" ] @punctuation.bracket -(hash ["{" "}"] @punctuation.bracket) +(hash + [ + "{" + "}" + ] @punctuation.bracket) diff --git a/queries/twig/injections.scm b/queries/twig/injections.scm index 29ba009a8..c475757bf 100644 --- a/queries/twig/injections.scm +++ b/queries/twig/injections.scm @@ -1,4 +1,3 @@ ((content) @injection.content - (#set! injection.language "html") - (#set! injection.combined)) - + (#set! injection.language "html") + (#set! injection.combined)) diff --git a/queries/typescript/folds.scm b/queries/typescript/folds.scm index df0b8942a..006ba857a 100644 --- a/queries/typescript/folds.scm +++ b/queries/typescript/folds.scm @@ -1,5 +1,4 @@ ; inherits: ecma - [ (interface_declaration) (internal_module) diff --git a/queries/typescript/highlights.scm b/queries/typescript/highlights.scm index bc6478a45..4cfca6d81 100644 --- a/queries/typescript/highlights.scm +++ b/queries/typescript/highlights.scm @@ -1,8 +1,8 @@ ; inherits: ecma - "require" @keyword.import -(import_require_clause source: (string) @string.special.url) +(import_require_clause + source: (string) @string.special.url) [ "declare" @@ -24,9 +24,14 @@ "satisfies" ] @keyword.operator -(as_expression "as" @keyword.operator) -(export_statement "as" @keyword.operator) -(mapped_type_clause "as" @keyword.operator) +(as_expression + "as" @keyword.operator) + +(export_statement + "as" @keyword.operator) + +(mapped_type_clause + "as" @keyword.operator) [ "abstract" @@ -37,35 +42,45 @@ ] @type.qualifier ; types - (type_identifier) @type + (predefined_type) @type.builtin -(import_statement "type" +(import_statement + "type" (import_clause (named_imports ((import_specifier - name: (identifier) @type))))) + name: (identifier) @type))))) (template_literal_type) @string -(non_null_expression "!" @operator) - -;; punctuation +(non_null_expression + "!" @operator) +; punctuation (type_arguments - ["<" ">"] @punctuation.bracket) + [ + "<" + ">" + ] @punctuation.bracket) (type_parameters - ["<" ">"] @punctuation.bracket) + [ + "<" + ">" + ] @punctuation.bracket) (object_type - ["{|" "|}"] @punctuation.bracket) + [ + "{|" + "|}" + ] @punctuation.bracket) (union_type "|" @punctuation.delimiter) -(intersection_type +(intersection_type "&" @punctuation.delimiter) (type_annotation @@ -85,69 +100,103 @@ "?." @punctuation.delimiter -(abstract_method_signature "?" @punctuation.special) -(method_signature "?" @punctuation.special) -(method_definition "?" @punctuation.special) -(property_signature "?" @punctuation.special) -(optional_parameter "?" @punctuation.special) -(optional_type "?" @punctuation.special) -(public_field_definition [ "?" "!" ] @punctuation.special) -(flow_maybe_type "?" @punctuation.special) +(abstract_method_signature + "?" @punctuation.special) + +(method_signature + "?" @punctuation.special) + +(method_definition + "?" @punctuation.special) -(template_type ["${" "}"] @punctuation.special) +(property_signature + "?" @punctuation.special) + +(optional_parameter + "?" @punctuation.special) + +(optional_type + "?" @punctuation.special) + +(public_field_definition + [ + "?" + "!" + ] @punctuation.special) + +(flow_maybe_type + "?" @punctuation.special) -(conditional_type ["?" ":"] @keyword.conditional.ternary) +(template_type + [ + "${" + "}" + ] @punctuation.special) -;;; Parameters -(required_parameter (identifier) @variable.parameter) -(optional_parameter (identifier) @variable.parameter) +(conditional_type + [ + "?" + ":" + ] @keyword.conditional.ternary) + +; Parameters +(required_parameter + (identifier) @variable.parameter) + +(optional_parameter + (identifier) @variable.parameter) (required_parameter (rest_pattern (identifier) @variable.parameter)) -;; ({ a }) => null +; ({ a }) => null (required_parameter (object_pattern (shorthand_property_identifier_pattern) @variable.parameter)) -;; ({ a = b }) => null +; ({ a = b }) => null (required_parameter (object_pattern (object_assignment_pattern (shorthand_property_identifier_pattern) @variable.parameter))) -;; ({ a: b }) => null +; ({ a: b }) => null (required_parameter (object_pattern (pair_pattern value: (identifier) @variable.parameter))) -;; ([ a ]) => null +; ([ a ]) => null (required_parameter (array_pattern (identifier) @variable.parameter)) -;; a => null +; a => null (arrow_function parameter: (identifier) @variable.parameter) -;; global declaration -(ambient_declaration "global" @module) +; global declaration +(ambient_declaration + "global" @module) -;; function signatures +; function signatures (ambient_declaration (function_signature name: (identifier) @function)) -;; method signatures -(method_signature name: (_) @function.method) +; method signatures +(method_signature + name: (_) @function.method) -;; property signatures +; property signatures (property_signature name: (property_identifier) @function.method - type: (type_annotation - [ - (union_type (parenthesized_type (function_type))) - (function_type) - ])) + type: + (type_annotation + [ + (union_type + (parenthesized_type + (function_type))) + (function_type) + ])) diff --git a/queries/typescript/indents.scm b/queries/typescript/indents.scm index 9a269ba75..23222051c 100644 --- a/queries/typescript/indents.scm +++ b/queries/typescript/indents.scm @@ -1,5 +1,4 @@ ; inherits: ecma - [ (enum_declaration) (interface_declaration) diff --git a/queries/typescript/locals.scm b/queries/typescript/locals.scm index 8addb1b27..f1928484a 100644 --- a/queries/typescript/locals.scm +++ b/queries/typescript/locals.scm @@ -1,23 +1,26 @@ ; inherits: ecma -(required_parameter (identifier) @local.definition) -(optional_parameter (identifier) @local.definition) +(required_parameter + (identifier) @local.definition) + +(optional_parameter + (identifier) @local.definition) ; x => x (arrow_function parameter: (identifier) @local.definition.parameter) -;; ({ a }) => null +; ({ a }) => null (required_parameter (object_pattern (shorthand_property_identifier_pattern) @local.definition.parameter)) -;; ({ a: b }) => null +; ({ a: b }) => null (required_parameter (object_pattern (pair_pattern value: (identifier) @local.definition.parameter))) -;; ([ a ]) => null +; ([ a ]) => null (required_parameter (array_pattern (identifier) @local.definition.parameter)) diff --git a/queries/typoscript/highlights.scm b/queries/typoscript/highlights.scm index c1c483c3a..63327f178 100644 --- a/queries/typoscript/highlights.scm +++ b/queries/typoscript/highlights.scm @@ -3,11 +3,12 @@ (constant) @constant (modifier_function) @function + (modifier_predefined) @function.builtin [ - (condition) - (condition_end) + (condition) + (condition_end) (condition_else) ] @keyword.conditional @@ -40,7 +41,7 @@ "," @punctuation.delimiter [ - "(" - ")" - (block_punctuation) - ] @punctuation.bracket + "(" + ")" + (block_punctuation) +] @punctuation.bracket diff --git a/queries/typoscript/indents.scm b/queries/typoscript/indents.scm index f3d15b720..4f5fb4797 100644 --- a/queries/typoscript/indents.scm +++ b/queries/typoscript/indents.scm @@ -1,5 +1,5 @@ (block) @indent.begin -"}" @indent.branch @indent.end +"}" @indent.branch @indent.end (comment) @indent.ignore diff --git a/queries/typoscript/injections.scm b/queries/typoscript/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/typoscript/injections.scm +++ b/queries/typoscript/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/udev/highlights.scm b/queries/udev/highlights.scm index 1a8514ea8..1b19028ac 100644 --- a/queries/udev/highlights.scm +++ b/queries/udev/highlights.scm @@ -1,16 +1,21 @@ -(match key: _ @keyword) +(match + key: _ @keyword) -(assignment key: _ @property) +(assignment + key: _ @property) (value) @string ; NOTE: higher priorities override bash highlights +((fmt_sub + . + _ @character.special) + (#set! "priority" 101)) -((fmt_sub . _ @character.special) - (#set! "priority" 101)) - -((var_sub . _ @variable.builtin) - (#set! "priority" 101)) +((var_sub + . + _ @variable.builtin) + (#set! "priority" 101)) [ (system_const) @@ -21,21 +26,24 @@ ] @attribute ((attribute) @attribute - (#set! "priority" 101)) + (#set! "priority" 101)) ((env_var) @constant - (#set! "priority" 101)) + (#set! "priority" 101)) ((pattern) @string.special - (#set! "priority" 101)) + (#set! "priority" 101)) -([ "\\\"" (c_escape) ] @string.escape - (#set! "priority" 101)) +([ + "\\\"" + (c_escape) +] @string.escape + (#set! "priority" 101)) (octal) @number ((number) @number - (#set! "priority" 101)) + (#set! "priority" 101)) [ (match_op) @@ -43,11 +51,17 @@ ] @operator ("+" @punctuation.special - (#set! "priority" 101)) + (#set! "priority" 101)) -([ "{" "}" ] @punctuation.bracket - (#set! "priority" 101)) +([ + "{" + "}" +] @punctuation.bracket + (#set! "priority" 101)) -[ "," (linebreak) ] @punctuation.delimiter +[ + "," + (linebreak) +] @punctuation.delimiter (comment) @comment @spell diff --git a/queries/udev/injections.scm b/queries/udev/injections.scm index 5618e65de..1718349c6 100644 --- a/queries/udev/injections.scm +++ b/queries/udev/injections.scm @@ -1,12 +1,14 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((match - key: "PROGRAM" - (value (content) @injection.content)) - (#set! injection.language "bash")) + key: "PROGRAM" + (value + (content) @injection.content)) + (#set! injection.language "bash")) ((assignment - key: "RUN" - (value (content) @injection.content)) - (#set! injection.language "bash")) + key: "RUN" + (value + (content) @injection.content)) + (#set! injection.language "bash")) diff --git a/queries/udev/locals.scm b/queries/udev/locals.scm index f4923467c..e1a2f65d2 100644 --- a/queries/udev/locals.scm +++ b/queries/udev/locals.scm @@ -1,15 +1,15 @@ -;; labels - +; labels (assignment key: "LABEL" - (value (content) @local.definition)) + (value + (content) @local.definition)) (assignment key: "GOTO" - (value (content) @local.reference)) - -;; env vars + (value + (content) @local.reference)) +; env vars (assignment key: "ENV" (env_var) @local.definition.var) @@ -18,10 +18,10 @@ key: "ENV" (env_var) @local.reference) -(var_sub (env_var) @local.reference) - -;; misc +(var_sub + (env_var) @local.reference) +; misc [ (attribute) (kernel_param) diff --git a/queries/ungrammar/highlights.scm b/queries/ungrammar/highlights.scm index 0e4448255..4ed523c9b 100644 --- a/queries/ungrammar/highlights.scm +++ b/queries/ungrammar/highlights.scm @@ -18,9 +18,7 @@ "?" ] @keyword.repeat -[ - ":" -] @punctuation.delimiter +":" @punctuation.delimiter [ "(" diff --git a/queries/ungrammar/injections.scm b/queries/ungrammar/injections.scm index ac82a3e5f..2f0e58eb6 100644 --- a/queries/ungrammar/injections.scm +++ b/queries/ungrammar/injections.scm @@ -1,3 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) - + (#set! injection.language "comment")) diff --git a/queries/unison/highlights.scm b/queries/unison/highlights.scm index 88b2a1373..6f97474fa 100644 --- a/queries/unison/highlights.scm +++ b/queries/unison/highlights.scm @@ -1,12 +1,17 @@ -;; Primitives +; Primitives (comment) @comment @spell + (nat) @number + (unit) @constant.builtin + (literal_char) @character + (literal_text) @string + (literal_boolean) @boolean -;; Keywords +; Keywords [ (kw_forall) (unique_kw) @@ -18,18 +23,19 @@ ] @keyword (kw_equals) @keyword.operator + (structural_kw) @type.qualifier + (unique) @type.qualifier (type_constructor) @constructor (doc_block) @comment.documentation - [ (operator) - (pipe) - (arrow_symbol) + (pipe) + (arrow_symbol) ">" (or) ] @keyword.operator @@ -45,32 +51,52 @@ (blank_pattern) @variable.builtin -(pattern) @variable (constructor_or_variable_pattern) @type +(pattern) @variable + +(constructor_or_variable_pattern) @type (use_clause) @keyword.import -;; Types -(record_field name: (wordy_id) @variable type: (wordy_id) @type) +; Types +(record_field + name: (wordy_id) @variable + type: (wordy_id) @type) + (type_name) @type -(ability_declaration type_name: (wordy_id) @type type_arg: (wordy_id) @variable.parameter) -(effect (wordy_id) @attribute) ;; NOTE: an effect is a special type +(ability_declaration + type_name: (wordy_id) @type + type_arg: (wordy_id) @variable.parameter) +(effect + (wordy_id) @attribute) ; NOTE: an effect is a special type -;; Namespaces +; Namespaces (path) @module + (namespace) @module -;; Terms -(type_signature term_name: (path) @module term_name: (wordy_id) @variable) -(type_signature term_name: (wordy_id) @variable) +; Terms +(type_signature + term_name: (path) @module + term_name: (wordy_id) @variable) + +(type_signature + term_name: (wordy_id) @variable) + (term_type) @type -(function_application function_name: (path) function_name: (wordy_id) @function) +(function_application + function_name: (path) + function_name: (wordy_id) @function) + +(term_definition + name: (wordy_id) @variable) + +(term_definition + param: (wordy_id) @variable.parameter) -(term_definition name: (wordy_id) @variable) -(term_definition param: (wordy_id) @variable.parameter) -;; Punctuation +; Punctuation [ (type_signature_colon) ":" @@ -85,4 +111,5 @@ "]" ] @punctuation.bracket -(test_watch_expression (wordy_id) @keyword.directive) +(test_watch_expression + (wordy_id) @keyword.directive) diff --git a/queries/unison/injections.scm b/queries/unison/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/unison/injections.scm +++ b/queries/unison/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/usd/folds.scm b/queries/usd/folds.scm index c4815bd07..fd7d23999 100644 --- a/queries/usd/folds.scm +++ b/queries/usd/folds.scm @@ -1,3 +1 @@ -[ - (block) -] @fold +(block) @fold diff --git a/queries/usd/highlights.scm b/queries/usd/highlights.scm index 180b6d219..894d1613d 100644 --- a/queries/usd/highlights.scm +++ b/queries/usd/highlights.scm @@ -1,28 +1,42 @@ (None) @constant.builtin + (asset_path) @string.special.url + (attribute_property) @property + (bool) @boolean + (comment) @comment @spell + (custom) @function.builtin + (float) @number.float + (integer) @number + (orderer) @function.call + (prim_path) @string.special + (relationship_type) @type + (string) @string + (uniform) @function.builtin + (variant_set_definition) @keyword -;; Prefer namespace highlighting, if any. -;; -;; e.g. `rel fizz` - `fizz` uses `@identifier` -;; e.g. `rel foo:bar:fizz` - `foo` and `bar` use `@module` and `fizz` uses `@identifier` -;; +; Prefer namespace highlighting, if any. +; +; e.g. `rel fizz` - `fizz` uses `@identifier` +; e.g. `rel foo:bar:fizz` - `foo` and `bar` use `@module` and `fizz` uses `@identifier` +; (identifier) @variable + (namespace_identifier) @module + (namespace_identifier - (identifier) @module -) + (identifier) @module) [ "class" @@ -30,16 +44,26 @@ "over" ] @keyword.function -["(" ")" "[" "]" "{" "}"] @punctuation.bracket -[":" ";" "."] @punctuation.delimiter +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket [ - "=" -] @operator + ":" + ";" + "." +] @punctuation.delimiter + +"=" @operator (attribute_type) @type -( - (attribute_type) @type.builtin + +((attribute_type) @type.builtin ;format-ignore (#any-of? @type.builtin ;; Reference: https://openusd.org/release/api/sdf_page_front.html @@ -98,8 +122,7 @@ "Transform" "Transform[]" "Vec3f" "Vec3f[]")) -( - (identifier) @keyword +((identifier) @keyword ; format-ignore (#any-of? @keyword ; Reference: https://openusd.org/release/api/sdf_page_front.html @@ -159,20 +182,12 @@ ; Prim metadata "instanceable")) -;; Common attribute metadata -( - (layer_offset +; Common attribute metadata +((layer_offset (identifier) @keyword - (#any-of? @keyword - - "offset" - "scale" - ) - ) -) + (#any-of? @keyword "offset" "scale"))) -;; Docstrings in USD +; Docstrings in USD (metadata - (comment)* - (string) @comment.documentation -) + (comment)* + (string) @comment.documentation) diff --git a/queries/usd/indents.scm b/queries/usd/indents.scm index 78146d188..217d12d3f 100644 --- a/queries/usd/indents.scm +++ b/queries/usd/indents.scm @@ -11,14 +11,29 @@ (variant_set_definition) ; The {}s in `variantSet "foo" = { "vr1" { ... } "vr2" { ... } }` ] @indent.begin -(block "}" @indent.end) -(dictionary "}" @indent.end) -(list "]" @indent.end) -(list_proxy "]" @indent.end) -(metadata ")" @indent.end) -(timeSamples "}" @indent.end) -(tuple ")" @indent.end) -(variant_set_definition "}" @indent.end) +(block + "}" @indent.end) + +(dictionary + "}" @indent.end) + +(list + "]" @indent.end) + +(list_proxy + "]" @indent.end) + +(metadata + ")" @indent.end) + +(timeSamples + "}" @indent.end) + +(tuple + ")" @indent.end) + +(variant_set_definition + "}" @indent.end) [ ")" diff --git a/queries/uxntal/folds.scm b/queries/uxntal/folds.scm index 2043df867..9e3f27db0 100644 --- a/queries/uxntal/folds.scm +++ b/queries/uxntal/folds.scm @@ -2,6 +2,5 @@ (macro) (memory_execution) (subroutine) - (comment) ] @fold diff --git a/queries/uxntal/highlights.scm b/queries/uxntal/highlights.scm index ce81e77ef..622e00b4f 100644 --- a/queries/uxntal/highlights.scm +++ b/queries/uxntal/highlights.scm @@ -1,15 +1,12 @@ ; Includes - (include "~" @keyword.import _ @string.special.url) ; Variables - (identifier) @variable ; Macros - (macro "%" (identifier) @function.macro) @@ -18,22 +15,28 @@ (#lua-match? @function.macro "^[a-z]?[0-9]*[A-Z-_]+$")) (rune - . rune_start: (rune_char ",") - . (identifier) @function.call) + . + rune_start: + (rune_char + ",") + . + (identifier) @function.call) (rune - . rune_start: (rune_char ";") - . (identifier) @function.call) + . + rune_start: + (rune_char + ";") + . + (identifier) @function.call) ((identifier) @function.call (#lua-match? @function.call "^:")) ; Keywords - (opcode) @keyword ; Labels - (label "@" @string.special.symbol (identifier) @function) @@ -44,12 +47,10 @@ (identifier) @label) ; Repeats - ((identifier) @keyword.repeat (#eq? @keyword.repeat "while")) ; Literals - (raw_ascii) @string (hex_literal @@ -59,10 +60,15 @@ (number) @number ; Punctuation +[ + "{" + "}" +] @punctuation.bracket -[ "{" "}" ] @punctuation.bracket - -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket [ "%" @@ -80,5 +86,4 @@ ] @punctuation.special ; Comments - (comment) @comment @spell diff --git a/queries/uxntal/indents.scm b/queries/uxntal/indents.scm index cb07a52ee..b795b89ea 100644 --- a/queries/uxntal/indents.scm +++ b/queries/uxntal/indents.scm @@ -7,9 +7,15 @@ "}" @indent.end -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch [ (ERROR) diff --git a/queries/uxntal/injections.scm b/queries/uxntal/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/uxntal/injections.scm +++ b/queries/uxntal/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/uxntal/locals.scm b/queries/uxntal/locals.scm index e31616223..41fbb5b66 100644 --- a/queries/uxntal/locals.scm +++ b/queries/uxntal/locals.scm @@ -1,5 +1,4 @@ ; Scopes - [ (program) (macro) @@ -8,15 +7,15 @@ ] @local.scope ; References - (identifier) @local.reference ; Definitions - (label "@" - . (identifier) @local.definition.function) + . + (identifier) @local.definition.function) (macro "%" - . (identifier) @local.definition.macro) + . + (identifier) @local.definition.macro) diff --git a/queries/v/folds.scm b/queries/v/folds.scm index 8bed31c52..952b6bbe9 100644 --- a/queries/v/folds.scm +++ b/queries/v/folds.scm @@ -1,6 +1,8 @@ -[(function_declaration) - (const_declaration) - (type_declaration) - (import_declaration) - (if_expression) - (struct_declaration)] @fold +[ + (function_declaration) + (const_declaration) + (type_declaration) + (import_declaration) + (if_expression) + (struct_declaration) +] @fold diff --git a/queries/v/highlights.scm b/queries/v/highlights.scm index 221b05028..821aef6be 100644 --- a/queries/v/highlights.scm +++ b/queries/v/highlights.scm @@ -1,12 +1,10 @@ ; Includes - [ "import" "module" ] @keyword.import ; Keywords - [ "asm" "assert" @@ -71,30 +69,29 @@ ] @keyword.coroutine ; Variables - (identifier) @variable ; Namespace - (module_clause - (identifier) @module) + (identifier) @module) (import_path - (import_name) @module) + (import_name) @module) (import_alias - (import_name) @module) + (import_name) @module) ; Literals - -[ (true) (false) ] @boolean +[ + (true) + (false) +] @boolean (interpreted_string_literal) @string (string_interpolation) @none ; Types - (struct_declaration name: (identifier) @type) @@ -107,15 +104,17 @@ (type_declaration name: (identifier) @type) -(type_reference_expression (identifier) @type) +(type_reference_expression + (identifier) @type) ; Labels - (label_reference) @label ; Fields - -(selector_expression field: (reference_expression (identifier) @variable.member)) +(selector_expression + field: + (reference_expression + (identifier) @variable.member)) (field_name) @variable.member @@ -123,7 +122,6 @@ name: (identifier) @variable.member) ; Parameters - (parameter_declaration name: (identifier) @variable.parameter) @@ -131,7 +129,6 @@ name: (identifier) @variable.parameter) ; Constants - ((identifier) @constant (#has-ancestor? @constant compile_time_if_expression)) @@ -148,11 +145,9 @@ (#any-of? @variable.builtin "err" "macos" "linux" "windows")) ; Attributes - (attribute) @attribute ; Functions - (function_declaration name: (identifier) @function) @@ -161,242 +156,38 @@ name: (identifier) @function.method) (call_expression - name: (selector_expression - field: (reference_expression) @function.method.call)) + name: + (selector_expression + field: (reference_expression) @function.method.call)) (call_expression - name: (reference_expression) @function.call) + name: (reference_expression) @function.call) ((identifier) @function.builtin - (#any-of? @function.builtin - "eprint" - "eprintln" - "error" - "exit" - "panic" - "print" - "println" - "after" - "after_char" - "all" - "all_after" - "all_after_last" - "all_before" - "all_before_last" - "any" - "ascii_str" - "before" - "bool" - "byte" - "byterune" - "bytes" - "bytestr" - "c_error_number_str" - "capitalize" - "clear" - "clone" - "clone_to_depth" - "close" - "code" - "compare" - "compare_strings" - "contains" - "contains_any" - "contains_any_substr" - "copy" - "count" - "cstring_to_vstring" - "delete" - "delete_last" - "delete_many" - "ends_with" - "eprint" - "eprintln" - "eq_epsilon" - "error" - "error_with_code" - "exit" - "f32" - "f32_abs" - "f32_max" - "f32_min" - "f64" - "f64_max" - "fields" - "filter" - "find_between" - "first" - "flush_stderr" - "flush_stdout" - "free" - "gc_check_leaks" - "get_str_intp_u32_format" - "get_str_intp_u64_format" - "grow_cap" - "grow_len" - "hash" - "hex" - "hex2" - "hex_full" - "i16" - "i64" - "i8" - "index" - "index_after" - "index_any" - "index_byte" - "insert" - "int" - "is_alnum" - "is_bin_digit" - "is_capital" - "is_digit" - "is_hex_digit" - "is_letter" - "is_lower" - "is_oct_digit" - "is_space" - "is_title" - "is_upper" - "isnil" - "join" - "join_lines" - "keys" - "last" - "last_index" - "last_index_byte" - "length_in_bytes" - "limit" - "malloc" - "malloc_noscan" - "map" - "match_glob" - "memdup" - "memdup_noscan" - "move" - "msg" - "panic" - "panic_error_number" - "panic_lasterr" - "panic_optional_not_set" - "parse_int" - "parse_uint" - "pointers" - "pop" - "prepend" - "print" - "print_backtrace" - "println" - "proc_pidpath" - "ptr_str" - "push_many" - "realloc_data" - "reduce" - "repeat" - "repeat_to_depth" - "replace" - "replace_each" - "replace_once" - "reverse" - "reverse_in_place" - "runes" - "sort" - "sort_by_len" - "sort_ignore_case" - "sort_with_compare" - "split" - "split_any" - "split_into_lines" - "split_nth" - "starts_with" - "starts_with_capital" - "str" - "str_escaped" - "str_intp" - "str_intp_g32" - "str_intp_g64" - "str_intp_rune" - "str_intp_sq" - "str_intp_sub" - "strg" - "string_from_wide" - "string_from_wide2" - "strip_margin" - "strip_margin_custom" - "strlong" - "strsci" - "substr" - "substr_ni" - "substr_with_check" - "title" - "to_lower" - "to_upper" - "to_wide" - "tos" - "tos2" - "tos3" - "tos4" - "tos5" - "tos_clone" - "trim" - "trim_left" - "trim_pr" - "try_pop" - "try_push" - "utf32_decode_to_buffer" - "utf32_to_str" - "utf32_to_str_no_malloc" - "utf8_char_len" - "utf8_getchar" - "utf8_str_len" - "utf8_str_visible_length" - "utf8_to_utf32" - "v_realloc" - "vbytes" - "vcalloc" - "vcalloc_noscan" - "vmemcmp" - "vmemcpy" - "vmemmove" - "vmemset" - "vstring" - "vstring_literal" - "vstring_literal_with_len" - "vstring_with_len" - "vstrlen" - "vstrlen_char" - "winapi_lasterr_str")) - + (#any-of? @function.builtin "eprint" "eprintln" "error" "exit" "panic" "print" "println" "after" "after_char" "all" "all_after" "all_after_last" "all_before" "all_before_last" "any" "ascii_str" "before" "bool" "byte" "byterune" "bytes" "bytestr" "c_error_number_str" "capitalize" "clear" "clone" "clone_to_depth" "close" "code" "compare" "compare_strings" "contains" "contains_any" "contains_any_substr" "copy" "count" "cstring_to_vstring" "delete" "delete_last" "delete_many" "ends_with" "eprint" "eprintln" "eq_epsilon" "error" "error_with_code" "exit" "f32" "f32_abs" "f32_max" "f32_min" "f64" "f64_max" "fields" "filter" "find_between" "first" "flush_stderr" "flush_stdout" "free" "gc_check_leaks" "get_str_intp_u32_format" "get_str_intp_u64_format" "grow_cap" "grow_len" "hash" "hex" "hex2" "hex_full" "i16" "i64" "i8" "index" "index_after" "index_any" "index_byte" "insert" "int" "is_alnum" "is_bin_digit" "is_capital" "is_digit" "is_hex_digit" "is_letter" "is_lower" "is_oct_digit" "is_space" "is_title" "is_upper" "isnil" "join" "join_lines" "keys" "last" "last_index" "last_index_byte" "length_in_bytes" "limit" "malloc" "malloc_noscan" "map" "match_glob" "memdup" "memdup_noscan" "move" "msg" "panic" "panic_error_number" "panic_lasterr" "panic_optional_not_set" "parse_int" "parse_uint" "pointers" "pop" "prepend" "print" "print_backtrace" "println" "proc_pidpath" "ptr_str" "push_many" "realloc_data" "reduce" "repeat" "repeat_to_depth" "replace" "replace_each" "replace_once" "reverse" "reverse_in_place" "runes" "sort" "sort_by_len" "sort_ignore_case" "sort_with_compare" "split" "split_any" "split_into_lines" "split_nth" "starts_with" "starts_with_capital" "str" "str_escaped" "str_intp" "str_intp_g32" "str_intp_g64" "str_intp_rune" "str_intp_sq" "str_intp_sub" "strg" "string_from_wide" "string_from_wide2" "strip_margin" "strip_margin_custom" "strlong" "strsci" "substr" "substr_ni" "substr_with_check" "title" "to_lower" "to_upper" "to_wide" "tos" "tos2" "tos3" "tos4" "tos5" "tos_clone" "trim" "trim_left" "trim_pr" "try_pop" "try_push" "utf32_decode_to_buffer" "utf32_to_str" "utf32_to_str_no_malloc" "utf8_char_len" "utf8_getchar" "utf8_str_len" "utf8_str_visible_length" "utf8_to_utf32" "v_realloc" "vbytes" "vcalloc" "vcalloc_noscan" "vmemcmp" "vmemcpy" "vmemmove" "vmemset" "vstring" "vstring_literal" "vstring_literal_with_len" "vstring_with_len" "vstrlen" "vstrlen_char" "winapi_lasterr_str")) ; Operators - [ "++" "--" - "+" "-" "*" "/" "%" - "~" "&" "|" "^" - "!" "&&" "||" "!=" - "<<" ">>" - "<" ">" "<=" ">=" - "+=" "-=" "*=" @@ -406,11 +197,9 @@ "^=" "<<=" ">>=" - "=" ":=" "==" - "?" "<-" "$" @@ -419,13 +208,23 @@ ] @operator ; Punctuation +[ + "." + "," + ":" + ";" +] @punctuation.delimiter -[ "." "," ":" ";" ] @punctuation.delimiter - -[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket ; Literals - (int_literal) @number (float_literal) @number.float @@ -455,9 +254,12 @@ (none) @variable.builtin ; Comments - (comment) @comment @spell (_ (comment)+ @comment.documentation - [(function_declaration) (type_declaration) (enum_declaration)]) + [ + (function_declaration) + (type_declaration) + (enum_declaration) + ]) diff --git a/queries/v/indents.scm b/queries/v/indents.scm index a806b35ed..752585127 100644 --- a/queries/v/indents.scm +++ b/queries/v/indents.scm @@ -1,16 +1,17 @@ -[(import_declaration) - (const_declaration) - (type_declaration) - (type_initializer) - (block) - (map_init_expression) - (call_expression) - (parameter_list)] -@indent.begin +[ + (import_declaration) + (const_declaration) + (type_declaration) + (type_initializer) + (block) + (map_init_expression) + (call_expression) + (parameter_list) +] @indent.begin -[ "}"] -@indent.branch +"}" @indent.branch -(parameter_list ")" @indent.branch) +(parameter_list + ")" @indent.branch) (comment) @indent.ignore diff --git a/queries/v/injections.scm b/queries/v/injections.scm index 9fa581377..f7c0f6608 100644 --- a/queries/v/injections.scm +++ b/queries/v/injections.scm @@ -1,17 +1,22 @@ ((comment) @injection.content - (#set! injection.language "comment")) -;; asm_statement if asm ever highlighted :) - -;; #include <...> + (#set! injection.language "comment")) +; asm_statement if asm ever highlighted :) +; #include <...> ((hash_statement) @injection.content - (#set! injection.language "c")) + (#set! injection.language "c")) -;; regex for the methods defined in `re` module +; regex for the methods defined in `re` module ((call_expression - name: (selector_expression - field: (reference_expression (identifier) @_re)) - arguments: (argument_list - (argument (literal (raw_string_literal) @injection.content - (#offset! @injection.content 0 2 0 -1))))) + name: + (selector_expression + field: + (reference_expression + (identifier) @_re)) + arguments: + (argument_list + (argument + (literal + (raw_string_literal) @injection.content + (#offset! @injection.content 0 2 0 -1))))) (#any-of? @_re "regex_base" "regex_opt" "compile_opt") (#set! injection.language "regex")) diff --git a/queries/v/locals.scm b/queries/v/locals.scm index 03623a717..524483b8e 100644 --- a/queries/v/locals.scm +++ b/queries/v/locals.scm @@ -1,28 +1,41 @@ ((function_declaration - name: (identifier) @local.definition.function)) ;@function + name: (identifier) @local.definition.function)) ;@function (var_declaration - var_list: (expression_list - (reference_expression - (identifier) @local.definition.var))) + var_list: + (expression_list + (reference_expression + (identifier) @local.definition.var))) ((function_declaration name: (identifier) @local.definition.function)) -(const_declaration (const_definition name: (identifier) @local.definition.var)) +(const_declaration + (const_definition + name: (identifier) @local.definition.var)) (identifier) @local.reference -((call_expression name: (reference_expression (identifier)) @local.reference) - (#set! reference.kind "call")) +((call_expression + name: + (reference_expression + (identifier)) @local.reference) + (#set! reference.kind "call")) ((call_expression - name: (selector_expression - field: (reference_expression (identifier) @local.definition.function))) - (#set! reference.kind "call")) + name: + (selector_expression + field: + (reference_expression + (identifier) @local.definition.function))) + (#set! reference.kind "call")) (source_file) @local.scope + (function_declaration) @local.scope + (if_expression) @local.scope + (block) @local.scope + (for_statement) @local.scope diff --git a/queries/vala/folds.scm b/queries/vala/folds.scm index 86b731eea..a334e609c 100644 --- a/queries/vala/folds.scm +++ b/queries/vala/folds.scm @@ -9,4 +9,3 @@ (block) (class_member) ] @fold - diff --git a/queries/vala/highlights.scm b/queries/vala/highlights.scm index 3250adcb4..31c02ad1b 100644 --- a/queries/vala/highlights.scm +++ b/queries/vala/highlights.scm @@ -1,118 +1,200 @@ ; highlights.scm - ; highlight comments and symbols (comment) @comment @spell + ((comment) @comment.documentation (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$")) + (symbol) @string.special.symbol -(member_access_expression (_) (identifier) @string.special.symbol) + +(member_access_expression + (_) + (identifier) @string.special.symbol) ; highlight constants -( - (member_access_expression (identifier) @constant) - (#lua-match? @constant "^[%u][%u%d_]*$") -) +((member_access_expression + (identifier) @constant) + (#lua-match? @constant "^[%u][%u%d_]*$")) -( - (member_access_expression (member_access_expression) @keyword.import (identifier) @constant) - (#lua-match? @constant "^[%u][%u%d_]*$") -) +((member_access_expression + (member_access_expression) @keyword.import + (identifier) @constant) + (#lua-match? @constant "^[%u][%u%d_]*$")) ; highlight types and probable types -(type (symbol (_)? @module (identifier) @type)) -( - (member_access_expression . (identifier) @type) - (#match? @type "^[A-Z][A-Za-z_0-9]{2,}$") -) +(type + (symbol + (_)? @module + (identifier) @type)) + +((member_access_expression + . + (identifier) @type) + (#match? @type "^[A-Z][A-Za-z_0-9]{2,}$")) ; highlight creation methods in object creation expressions -( - (object_creation_expression (type (symbol (symbol (symbol)? @keyword.import (identifier) @type) (identifier) @constructor))) - (#lua-match? @constructor "^[%l][%l%d_]*$") -) +((object_creation_expression + (type + (symbol + (symbol + (symbol)? @keyword.import + (identifier) @type) + (identifier) @constructor))) + (#lua-match? @constructor "^[%l][%l%d_]*$")) + +(unqualified_type + (symbol + . + (identifier) @type)) -(unqualified_type (symbol . (identifier) @type)) -(unqualified_type (symbol (symbol) @module (identifier) @type)) +(unqualified_type + (symbol + (symbol) @module + (identifier) @type)) (attribute) @attribute -(namespace_declaration (symbol) @module) -(method_declaration (symbol (symbol) @type (identifier) @function)) -(method_declaration (symbol (identifier) @function)) -(local_declaration (assignment (identifier) @variable)) -(local_function_declaration (identifier) @function) -(destructor_declaration (identifier) @function) -(creation_method_declaration (symbol (symbol) @type (identifier) @constructor)) -(creation_method_declaration (symbol (identifier) @constructor)) -(constructor_declaration (_)? "construct" @keyword.function) -(enum_declaration (symbol) @type) -(enum_value (identifier) @constant) -(errordomain_declaration (symbol) @type) -(errorcode (identifier) @constant) -(constant_declaration (identifier) @constant) -(method_call_expression (member_access_expression (identifier) @function)) + +(namespace_declaration + (symbol) @module) + +(method_declaration + (symbol + (symbol) @type + (identifier) @function)) + +(method_declaration + (symbol + (identifier) @function)) + +(local_declaration + (assignment + (identifier) @variable)) + +(local_function_declaration + (identifier) @function) + +(destructor_declaration + (identifier) @function) + +(creation_method_declaration + (symbol + (symbol) @type + (identifier) @constructor)) + +(creation_method_declaration + (symbol + (identifier) @constructor)) + +(constructor_declaration + (_)? + "construct" @keyword.function) + +(enum_declaration + (symbol) @type) + +(enum_value + (identifier) @constant) + +(errordomain_declaration + (symbol) @type) + +(errorcode + (identifier) @constant) + +(constant_declaration + (identifier) @constant) + +(method_call_expression + (member_access_expression + (identifier) @function)) + ; highlight macros -( - (method_call_expression (member_access_expression (identifier) @function.macro)) - (#match? @function.macro "^assert[A-Za-z_0-9]*|error|info|debug|print|warning|warning_once$") -) -(lambda_expression (identifier) @variable.parameter) -(parameter (identifier) @variable.parameter) -(property_declaration (symbol (identifier) @property)) -(field_declaration (identifier) @variable.member) +((method_call_expression + (member_access_expression + (identifier) @function.macro)) + (#match? @function.macro "^assert[A-Za-z_0-9]*|error|info|debug|print|warning|warning_once$")) + +(lambda_expression + (identifier) @variable.parameter) + +(parameter + (identifier) @variable.parameter) + +(property_declaration + (symbol + (identifier) @property)) + +(field_declaration + (identifier) @variable.member) + [ - (this_access) - (base_access) - (value_access) + (this_access) + (base_access) + (value_access) ] @constant.builtin + (boolean) @boolean + (character) @character + (escape_sequence) @string.escape + (integer) @number + (null) @constant.builtin + (real) @number.float + (regex) @string.regexp + (string) @string + (string_formatter) @string.special + (template_string) @string + (template_string_expression) @string.special + (verbatim_string) @string + [ - "var" - "void" + "var" + "void" ] @type.builtin (if_directive - expression: (_) @keyword.directive -) @keyword + expression: (_) @keyword.directive) @keyword + (elif_directive - expression: (_) @keyword.directive -) @keyword + expression: (_) @keyword.directive) @keyword + (else_directive) @keyword + (endif_directive) @keyword [ - "abstract" - "class" - "construct" - "continue" - "default" - "delegate" - "enum" - "errordomain" - "get" - "inline" - "interface" - "namespace" - "new" - "out" - "override" - "partial" - "ref" - "set" - "signal" - "struct" - "virtual" - "with" + "abstract" + "class" + "construct" + "continue" + "default" + "delegate" + "enum" + "errordomain" + "get" + "inline" + "interface" + "namespace" + "new" + "out" + "override" + "partial" + "ref" + "set" + "signal" + "struct" + "virtual" + "with" ] @keyword [ @@ -121,54 +203,66 @@ ] @keyword.coroutine [ - "const" - "dynamic" - "owned" - "weak" - "unowned" + "const" + "dynamic" + "owned" + "weak" + "unowned" ] @type.qualifier [ - "case" - "else" - "if" - "switch" + "case" + "else" + "if" + "switch" ] @keyword.conditional ; specially highlight break statements in switch sections -(switch_section (break_statement "break" @keyword.conditional)) +(switch_section + (break_statement + "break" @keyword.conditional)) [ - "extern" - "internal" - "private" - "protected" - "public" - "static" + "extern" + "internal" + "private" + "protected" + "public" + "static" ] @keyword.storage [ - "and" - "as" - "delete" - "in" - "is" - "lock" - "not" - "or" - "sizeof" - "typeof" + "and" + "as" + "delete" + "in" + "is" + "lock" + "not" + "or" + "sizeof" + "typeof" ] @keyword.operator "using" @keyword.import -(using_directive (symbol) @module) -(symbol "global::" @module) +(using_directive + (symbol) @module) + +(symbol + "global::" @module) + +(array_creation_expression + "new" @keyword.operator) -(array_creation_expression "new" @keyword.operator) -(object_creation_expression "new" @keyword.operator) -(argument "out" @keyword.operator) -(argument "ref" @keyword.operator) +(object_creation_expression + "new" @keyword.operator) + +(argument + "out" @keyword.operator) + +(argument + "ref" @keyword.operator) [ "break" @@ -187,64 +281,62 @@ "try" ] @keyword.exception -[ - "return" -] @keyword.return +"return" @keyword.return [ - "=" - "==" - "+" - "+=" - "-" - "-=" - "++" - "--" - "|" - "|=" - "&" - "&=" - "^" - "^=" - "/" - "/=" - "*" - "*=" - "%" - "%=" - "<<" - "<<=" - ">>" - ">>=" - "." - "?." - "->" - "!" - "!=" - "~" - "??" - "?" - ":" - "<" - "<=" - ">" - ">=" - "||" - "&&" - "=>" + "=" + "==" + "+" + "+=" + "-" + "-=" + "++" + "--" + "|" + "|=" + "&" + "&=" + "^" + "^=" + "/" + "/=" + "*" + "*=" + "%" + "%=" + "<<" + "<<=" + ">>" + ">>=" + "." + "?." + "->" + "!" + "!=" + "~" + "??" + "?" + ":" + "<" + "<=" + ">" + ">=" + "||" + "&&" + "=>" ] @operator [ - "," - ";" + "," + ";" ] @punctuation.delimiter [ - "$(" - "(" - ")" - "{" - "}" - "[" - "]" + "$(" + "(" + ")" + "{" + "}" + "[" + "]" ] @punctuation.bracket diff --git a/queries/verilog/highlights.scm b/queries/verilog/highlights.scm index 1c6e578f6..61c1e5974 100644 --- a/queries/verilog/highlights.scm +++ b/queries/verilog/highlights.scm @@ -1,5 +1,4 @@ ; Keywords - [ ; block delimiters (module_keyword) @@ -16,14 +15,12 @@ "endchecker" "config" "endconfig" - "pure" "virtual" "extends" "implements" "super" (class_item_qualifier) - "parameter" "localparam" "defparam" @@ -45,7 +42,6 @@ [ "function" "endfunction" - "task" "endtask" ] @keyword.function @@ -78,27 +74,28 @@ (comment) @comment @spell (include_compiler_directive) @constant.macro + (package_import_declaration - "import" @keyword.import) + "import" @keyword.import) (package_import_declaration - (package_import_item - (package_identifier - (simple_identifier) @constant))) + (package_import_item + (package_identifier + (simple_identifier) @constant))) (text_macro_identifier - (simple_identifier) @constant.macro) + (simple_identifier) @constant.macro) (package_scope - (package_identifier - (simple_identifier) @constant)) + (package_identifier + (simple_identifier) @constant)) (package_declaration - (package_identifier - (simple_identifier) @constant)) + (package_identifier + (simple_identifier) @constant)) (parameter_port_list - "#" @constructor) + "#" @constructor) [ "=" @@ -139,13 +136,18 @@ ] @keyword.operator (cast - ["'" "(" ")"] @operator) + [ + "'" + "(" + ")" + ] @operator) (edge_identifier) @attribute (port_direction) @label + (port_identifier - (simple_identifier) @variable) + (simple_identifier) @variable) [ (net_type) @@ -159,20 +161,20 @@ ] @type.qualifier (data_type - (simple_identifier) @type) + (simple_identifier) @type) (method_call_body (method_identifier) @variable.member) (interface_identifier - (simple_identifier) @type) + (simple_identifier) @type) (modport_identifier - (modport_identifier - (simple_identifier) @variable.member)) + (modport_identifier + (simple_identifier) @variable.member)) (net_port_type1 - (simple_identifier) @type) + (simple_identifier) @type) [ (double_quoted_string) @@ -188,31 +190,30 @@ ; begin/end label (seq_block - (simple_identifier) @comment) + (simple_identifier) @comment) [ - ";" - "::" - "," - "." + ";" + "::" + "," + "." ] @punctuation.delimiter - (default_nettype_compiler_directive - (default_nettype_value) @string) + (default_nettype_value) @string) (text_macro_identifier - (simple_identifier) @constant) + (simple_identifier) @constant) (module_declaration - (module_header - (simple_identifier) @constructor)) + (module_header + (simple_identifier) @constructor)) (class_constructor_declaration - "new" @constructor) + "new" @constructor) (parameter_identifier - (simple_identifier) @variable.parameter) + (simple_identifier) @variable.parameter) [ (integral_number) @@ -223,63 +224,61 @@ (time_unit) @attribute (checker_instantiation - (checker_identifier - (simple_identifier) @constructor)) + (checker_identifier + (simple_identifier) @constructor)) (module_instantiation - (simple_identifier) @constructor) + (simple_identifier) @constructor) (name_of_instance - (instance_identifier - (simple_identifier) @variable)) + (instance_identifier + (simple_identifier) @variable)) (interface_port_declaration - (interface_identifier - (simple_identifier) @type)) + (interface_identifier + (simple_identifier) @type)) (net_declaration - (simple_identifier) @type) + (simple_identifier) @type) (lifetime) @label -(function_identifier - (function_identifier - (simple_identifier) @function)) +(function_identifier + (function_identifier + (simple_identifier) @function)) -(function_subroutine_call - (subroutine_call - (tf_call - (simple_identifier) @function))) +(function_subroutine_call + (subroutine_call + (tf_call + (simple_identifier) @function))) -(function_subroutine_call - (subroutine_call - (system_tf_call - (system_tf_identifier) @function.builtin))) +(function_subroutine_call + (subroutine_call + (system_tf_call + (system_tf_identifier) @function.builtin))) (task_identifier - (task_identifier - (simple_identifier) @function.method)) + (task_identifier + (simple_identifier) @function.method)) -;;TODO: fixme +;TODO: fixme ;(assignment_pattern_expression - ;(assignment_pattern - ;(parameter_identifier) @variable.member)) - +;(assignment_pattern +;(parameter_identifier) @variable.member)) (type_declaration - (data_type ["packed"] @type.qualifier)) + (data_type + "packed" @type.qualifier)) (struct_union) @type -[ - "enum" -] @type +"enum" @type (enum_name_declaration - (enum_identifier - (simple_identifier) @constant)) + (enum_identifier + (simple_identifier) @constant)) (type_declaration - (simple_identifier) @type) + (simple_identifier) @type) [ (integer_atom_type) @@ -288,20 +287,20 @@ ] @type.builtin (struct_union_member - (list_of_variable_decl_assignments - (variable_decl_assignment - (simple_identifier) @variable.member))) + (list_of_variable_decl_assignments + (variable_decl_assignment + (simple_identifier) @variable.member))) (member_identifier - (simple_identifier) @variable.member) + (simple_identifier) @variable.member) (struct_union_member - (data_type_or_void - (data_type - (simple_identifier) @type))) + (data_type_or_void + (data_type + (simple_identifier) @type))) (type_declaration - (simple_identifier) @type) + (simple_identifier) @type) (generate_block_identifier) @comment diff --git a/queries/verilog/injections.scm b/queries/verilog/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/verilog/injections.scm +++ b/queries/verilog/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/verilog/locals.scm b/queries/verilog/locals.scm index 35b874ab4..e9ed89169 100644 --- a/queries/verilog/locals.scm +++ b/queries/verilog/locals.scm @@ -9,53 +9,52 @@ ] @local.scope (data_declaration - (list_of_variable_decl_assignments - (variable_decl_assignment - (simple_identifier) @local.definition.var))) + (list_of_variable_decl_assignments + (variable_decl_assignment + (simple_identifier) @local.definition.var))) (genvar_initialization - (genvar_identifier - (simple_identifier) @local.definition.var)) + (genvar_identifier + (simple_identifier) @local.definition.var)) (for_initialization - (for_variable_declaration - (simple_identifier) @local.definition.var)) + (for_variable_declaration + (simple_identifier) @local.definition.var)) (net_declaration - (list_of_net_decl_assignments - (net_decl_assignment - (simple_identifier) @local.definition.var))) + (list_of_net_decl_assignments + (net_decl_assignment + (simple_identifier) @local.definition.var))) (ansi_port_declaration - (port_identifier - (simple_identifier) @local.definition.var)) + (port_identifier + (simple_identifier) @local.definition.var)) (parameter_declaration - (list_of_param_assignments - (param_assignment - (parameter_identifier - (simple_identifier) @local.definition.parameter)))) + (list_of_param_assignments + (param_assignment + (parameter_identifier + (simple_identifier) @local.definition.parameter)))) (local_parameter_declaration - (list_of_param_assignments - (param_assignment - (parameter_identifier - (simple_identifier) @local.definition.parameter)))) + (list_of_param_assignments + (param_assignment + (parameter_identifier + (simple_identifier) @local.definition.parameter)))) -;; TODO: fixme +; TODO: fixme ;(function_declaration - ;(function_identifier - ;(simple_identifier) @local.definition.function)) - +;(function_identifier +;(simple_identifier) @local.definition.function)) (function_declaration - (function_body_declaration - (function_identifier - (function_identifier - (simple_identifier) @local.definition.function)))) + (function_body_declaration + (function_identifier + (function_identifier + (simple_identifier) @local.definition.function)))) (tf_port_item1 - (port_identifier - (simple_identifier) @local.definition.parameter)) + (port_identifier + (simple_identifier) @local.definition.parameter)) ; too broad, now includes types etc (simple_identifier) @local.reference diff --git a/queries/vhs/highlights.scm b/queries/vhs/highlights.scm index 70b6ca20a..469fdd139 100644 --- a/queries/vhs/highlights.scm +++ b/queries/vhs/highlights.scm @@ -13,9 +13,11 @@ "Type" "Sleep" "Hide" - "Show" ] @keyword + "Show" +] @keyword -[ "Shell" +[ + "Shell" "FontFamily" "FontSize" "Framerate" @@ -27,13 +29,24 @@ "Padding" "Theme" "LoopOffset" - "Width" ] @type + "Width" +] @type + +"@" @operator -[ "@" ] @operator (control) @function.macro + (float) @number.float + (integer) @number + (comment) @comment @spell -[(string) (json)] @string + +[ + (string) + (json) +] @string + (path) @string.special.path + (time) @string.special diff --git a/queries/vim/folds.scm b/queries/vim/folds.scm index 4c9973583..0a1fb695f 100644 --- a/queries/vim/folds.scm +++ b/queries/vim/folds.scm @@ -1,4 +1,4 @@ [ - (if_statement) - (function_definition) + (if_statement) + (function_definition) ] @fold diff --git a/queries/vim/highlights.scm b/queries/vim/highlights.scm index 7b28b4759..67f8546b0 100644 --- a/queries/vim/highlights.scm +++ b/queries/vim/highlights.scm @@ -1,9 +1,9 @@ (identifier) @variable -((identifier) @constant - (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) -;; Keywords +((identifier) @constant + (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) +; Keywords [ "if" "else" @@ -34,24 +34,43 @@ "endfunction" ] @keyword.function -;; Function related -(function_declaration name: (_) @function) -(call_expression function: (identifier) @function.call) -(call_expression function: (scoped_identifier (identifier) @function.call)) -(parameters (identifier) @variable.parameter) -(default_parameter (identifier) @variable.parameter) +; Function related +(function_declaration + name: (_) @function) + +(call_expression + function: (identifier) @function.call) + +(call_expression + function: + (scoped_identifier + (identifier) @function.call)) + +(parameters + (identifier) @variable.parameter) -[ (bang) (spread) ] @punctuation.special +(default_parameter + (identifier) @variable.parameter) + +[ + (bang) + (spread) +] @punctuation.special + +[ + (no_option) + (inv_option) + (default_option) + (option_name) +] @variable.builtin -[ (no_option) (inv_option) (default_option) (option_name) ] @variable.builtin [ (scope) "a:" "$" ] @module -;; Commands and user defined commands - +; Commands and user defined commands [ "let" "unlet" @@ -109,40 +128,46 @@ "eval" "sign" ] @keyword -(map_statement cmd: _ @keyword) -(command_name) @function.macro -;; Filetype command +(map_statement + cmd: _ @keyword) + +(command_name) @function.macro -(filetype_statement [ - "detect" - "plugin" - "indent" - "on" - "off" -] @keyword) +; Filetype command +(filetype_statement + [ + "detect" + "plugin" + "indent" + "on" + "off" + ] @keyword) -;; Syntax command +; Syntax command +(syntax_statement + (keyword) @string) -(syntax_statement (keyword) @string) -(syntax_statement [ - "enable" - "on" - "off" - "reset" - "case" - "spell" - "foldlevel" - "iskeyword" - "keyword" - "match" - "cluster" - "region" - "clear" - "include" -] @keyword) +(syntax_statement + [ + "enable" + "on" + "off" + "reset" + "case" + "spell" + "foldlevel" + "iskeyword" + "keyword" + "match" + "cluster" + "region" + "clear" + "include" + ] @keyword) -(syntax_argument name: _ @keyword) +(syntax_argument + name: _ @keyword) [ "<buffer>" @@ -156,70 +181,92 @@ (augroup_name) @module (au_event) @constant -(normal_statement (commands) @constant) -;; Highlight command +(normal_statement + (commands) @constant) +; Highlight command (hl_attribute key: _ @property val: _ @constant) (hl_group) @type -(highlight_statement [ - "default" - "link" - "clear" -] @keyword) - -;; Command command +(highlight_statement + [ + "default" + "link" + "clear" + ] @keyword) +; Command command (command) @string (command_attribute name: _ @property - val: (behavior - name: _ @constant - val: (identifier)? @function)?) + val: + (behavior + name: _ @constant + val: (identifier)? @function)?) -;; Edit command +; Edit command (plus_plus_opt val: _? @constant) @property -(plus_cmd "+" @property) @property - -;; Runtime command - -(runtime_statement (where) @keyword.operator) - -;; Colorscheme command -(colorscheme_statement (name) @string) +(plus_cmd + "+" @property) @property -;; Scriptencoding command +; Runtime command +(runtime_statement + (where) @keyword.operator) -(scriptencoding_statement (encoding) @string.special) +; Colorscheme command +(colorscheme_statement + (name) @string) -;; Literals +; Scriptencoding command +(scriptencoding_statement + (encoding) @string.special) +; Literals (string_literal) @string + (integer_literal) @number + (float_literal) @number.float + (comment) @comment @spell + (line_continuation_comment) @comment @spell + (pattern) @string.special + (pattern_multi) @string.regexp + (filename) @string.special.path -(heredoc (body) @string) -(heredoc (parameter) @keyword) -[ (marker_definition) (endmarker) ] @label -(literal_dictionary (literal_key) @label) -((scoped_identifier - (scope) @_scope . (identifier) @boolean) - (#eq? @_scope "v:") - (#any-of? @boolean "true" "false")) -;; Operators +(heredoc + (body) @string) +(heredoc + (parameter) @keyword) + +[ + (marker_definition) + (endmarker) +] @label + +(literal_dictionary + (literal_key) @label) + +((scoped_identifier + (scope) @_scope + . + (identifier) @boolean) + (#eq? @_scope "v:") + (#any-of? @boolean "true" "false")) + +; Operators [ "||" "&&" @@ -254,12 +301,13 @@ ] @operator ; Some characters have different meanings based on the context -(unary_operation "!" @operator) -(binary_operation "." @operator) +(unary_operation + "!" @operator) +(binary_operation + "." @operator) -;; Punctuation - +; Punctuation [ "(" ")" @@ -270,27 +318,31 @@ "#{" ] @punctuation.bracket -(field_expression "." @punctuation.delimiter) +(field_expression + "." @punctuation.delimiter) [ "," ":" ] @punctuation.delimiter -(ternary_expression ["?" ":"] @keyword.conditional.ternary) +(ternary_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) ; Options ((set_value) @number - (#lua-match? @number "^[%d]+(%.[%d]+)?$")) + (#lua-match? @number "^[%d]+(%.[%d]+)?$")) + +(inv_option + "!" @operator) -(inv_option "!" @operator) -(set_item "?" @operator) +(set_item + "?" @operator) ((set_item - option: (option_name) @_option - value: (set_value) @function) - (#any-of? @_option - "tagfunc" "tfu" - "completefunc" "cfu" - "omnifunc" "ofu" - "operatorfunc" "opfunc")) + option: (option_name) @_option + value: (set_value) @function) + (#any-of? @_option "tagfunc" "tfu" "completefunc" "cfu" "omnifunc" "ofu" "operatorfunc" "opfunc")) diff --git a/queries/vim/injections.scm b/queries/vim/injections.scm index 553ac5e6a..c76feddb4 100644 --- a/queries/vim/injections.scm +++ b/queries/vim/injections.scm @@ -1,46 +1,42 @@ -(lua_statement - (script +(lua_statement + (script (body) @injection.content (#set! injection.language "lua"))) -(lua_statement + +(lua_statement (chunk) @injection.content (#set! injection.language "lua")) -(ruby_statement - (script - (body) @injection.content + +(ruby_statement + (script + (body) @injection.content (#set! injection.language "ruby"))) -(ruby_statement - (chunk) @injection.content + +(ruby_statement + (chunk) @injection.content (#set! injection.language "ruby")) -(python_statement - (script - (body) @injection.content + +(python_statement + (script + (body) @injection.content (#set! injection.language "python"))) -(python_statement - (chunk) @injection.content + +(python_statement + (chunk) @injection.content (#set! injection.language "python")) -;; If we support perl at some point... -;; (perl_statement (script (body) @perl)) -;; (perl_statement (chunk) @perl) -(autocmd_statement - (pattern) @injection.content +; If we support perl at some point... +; (perl_statement (script (body) @perl)) +; (perl_statement (chunk) @perl) +(autocmd_statement + (pattern) @injection.content (#set! injection.language "regex")) ((set_item - option: (option_name) @_option - value: (set_value) @injection.content) - (#any-of? @_option - "includeexpr" "inex" - "printexpr" "pexpr" - "formatexpr" "fex" - "indentexpr" "inde" - "foldtext" "fdt" - "foldexpr" "fde" - "diffexpr" "dex" - "patchexpr" "pex" - "charconvert" "ccv") + option: (option_name) @_option + value: (set_value) @injection.content) + (#any-of? @_option "includeexpr" "inex" "printexpr" "pexpr" "formatexpr" "fex" "indentexpr" "inde" "foldtext" "fdt" "foldexpr" "fde" "diffexpr" "dex" "patchexpr" "pex" "charconvert" "ccv") (#set! injection.language "vim")) -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/vim/locals.scm b/queries/vim/locals.scm index 4ba551e40..dff662680 100644 --- a/queries/vim/locals.scm +++ b/queries/vim/locals.scm @@ -3,8 +3,18 @@ (function_definition) ] @local.scope -(function_declaration name: (identifier) @local.definition.function) -(function_declaration parameters: (parameters (identifier) @local.definition.parameter)) -(let_statement [(scoped_identifier) (identifier)] @local.definition.var) +(function_declaration + name: (identifier) @local.definition.function) + +(function_declaration + parameters: + (parameters + (identifier) @local.definition.parameter)) + +(let_statement + [ + (scoped_identifier) + (identifier) + ] @local.definition.var) (identifier) @local.reference diff --git a/queries/vimdoc/highlights.scm b/queries/vimdoc/highlights.scm index eefc4e74b..255bdfa66 100644 --- a/queries/vimdoc/highlights.scm +++ b/queries/vimdoc/highlights.scm @@ -1,31 +1,58 @@ (h1) @markup.heading.1 + (h2) @markup.heading.2 + (h3) @markup.heading.3 + (column_heading) @markup.heading.4 + (column_heading - "~" @markup.heading.4.marker (#set! conceal "")) + "~" @markup.heading.4.marker + (#set! conceal "")) + (tag - "*" @markup.heading.5.marker (#set! conceal "") - text: (_) @label) + "*" @markup.heading.5.marker + (#set! conceal "") + text: (_) @label) + (taglink - "|" @markup.link (#set! conceal "") - text: (_) @markup.link) + "|" @markup.link + (#set! conceal "") + text: (_) @markup.link) + (optionlink - text: (_) @markup.link) + text: (_) @markup.link) + (codespan - "`" @markup.raw (#set! conceal "") - text: (_) @markup.raw) -((codeblock) @markup.raw.block (#set! "priority" 90)) + "`" @markup.raw + (#set! conceal "") + text: (_) @markup.raw) + +((codeblock) @markup.raw.block + (#set! "priority" 90)) + (codeblock - [">" (language)] @markup.raw.block (#set! conceal "")) + [ + ">" + (language) + ] @markup.raw.block + (#set! conceal "")) + (block - "<" @markup.raw.block (#set! conceal "")) + "<" @markup.raw.block + (#set! conceal "")) + (argument) @variable.parameter + (keycode) @string.special + (url) @string.special.url + ((note) @comment.hint - (#any-of? @comment.hint "Note:" "NOTE:" "Notes:")) + (#any-of? @comment.hint "Note:" "NOTE:" "Notes:")) + ((note) @comment.warning - (#any-of? @comment.warning "Warning:" "WARNING:")) + (#any-of? @comment.warning "Warning:" "WARNING:")) + ((note) @comment.error - (#any-of? @comment.error "Deprecated:" "DEPRECATED:")) + (#any-of? @comment.error "Deprecated:" "DEPRECATED:")) diff --git a/queries/vimdoc/injections.scm b/queries/vimdoc/injections.scm index 4ae65e19e..3b8fbf0f3 100644 --- a/queries/vimdoc/injections.scm +++ b/queries/vimdoc/injections.scm @@ -1,4 +1,4 @@ ((codeblock (language) @injection.language (code) @injection.content) - (#set! injection.include-children)) + (#set! injection.include-children)) diff --git a/queries/vue/highlights.scm b/queries/vue/highlights.scm index e53ef4b8a..066586459 100644 --- a/queries/vue/highlights.scm +++ b/queries/vue/highlights.scm @@ -1,11 +1,11 @@ ; inherits: html_tags - [ (directive_dynamic_argument) (directive_dynamic_argument_value) ] @tag (interpolation) @punctuation.special + (interpolation (raw_text) @none) @@ -15,7 +15,8 @@ (quoted_attribute_value) @punctuation.special) (directive_attribute - (quoted_attribute_value (attribute_value) @none)) + (quoted_attribute_value + (attribute_value) @none)) [ (directive_modifier) diff --git a/queries/vue/indents.scm b/queries/vue/indents.scm index 39355b020..8c8091ab5 100644 --- a/queries/vue/indents.scm +++ b/queries/vue/indents.scm @@ -1,7 +1,6 @@ ; inherits: html_tags +(template_element) @indent.begin -[ - (template_element) -] @indent.begin - -(template_element (end_tag ">" @indent.end) @indent.branch) +(template_element + (end_tag + ">" @indent.end) @indent.branch) diff --git a/queries/vue/injections.scm b/queries/vue/injections.scm index 583a05c3f..2fbf22c92 100644 --- a/queries/vue/injections.scm +++ b/queries/vue/injections.scm @@ -1,59 +1,63 @@ ; inherits html_tags - ; <script lang="css"> ((style_element - (start_tag - (attribute - (attribute_name) @_lang - (quoted_attribute_value (attribute_value) @injection.language))) - (raw_text) @injection.content) - (#eq? @_lang "lang") - (#any-of? @injection.language "css" "scss")) + (start_tag + (attribute + (attribute_name) @_lang + (quoted_attribute_value + (attribute_value) @injection.language))) + (raw_text) @injection.content) + (#eq? @_lang "lang") + (#any-of? @injection.language "css" "scss")) ; TODO: When nvim-treesitter has postcss and less parsers, use @injection.language and @injection.content instead ; <script lang="scss"> ((style_element - (start_tag - (attribute - (attribute_name) @_lang - (quoted_attribute_value (attribute_value) @_scss))) - (raw_text) @injection.content - (#eq? @_lang "lang") - (#any-of? @_scss "less" "postcss") - (#set! injection.language "scss"))) + (start_tag + (attribute + (attribute_name) @_lang + (quoted_attribute_value + (attribute_value) @_scss))) + (raw_text) @injection.content + (#eq? @_lang "lang") + (#any-of? @_scss "less" "postcss") + (#set! injection.language "scss"))) ; <script lang="js"> ((script_element - (start_tag - (attribute - (attribute_name) @_lang - (quoted_attribute_value (attribute_value) @_js))) - (raw_text) @injection.content) - (#eq? @_lang "lang") - (#eq? @_js "js") - (#set! injection.language "javascript")) + (start_tag + (attribute + (attribute_name) @_lang + (quoted_attribute_value + (attribute_value) @_js))) + (raw_text) @injection.content) + (#eq? @_lang "lang") + (#eq? @_js "js") + (#set! injection.language "javascript")) ; <script lang="ts"> ((script_element - (start_tag - (attribute - (attribute_name) @_lang - (quoted_attribute_value (attribute_value) @_ts))) - (raw_text) @injection.content) - (#eq? @_lang "lang") - (#eq? @_ts "ts") - (#set! injection.language "typescript")) + (start_tag + (attribute + (attribute_name) @_lang + (quoted_attribute_value + (attribute_value) @_ts))) + (raw_text) @injection.content) + (#eq? @_lang "lang") + (#eq? @_ts "ts") + (#set! injection.language "typescript")) ; <script lang="tsx"> ; <script lang="jsx"> ((script_element - (start_tag - (attribute - (attribute_name) @_attr - (quoted_attribute_value (attribute_value) @injection.language))) - (#eq? @_attr "lang") - (#any-of? @injection.language "tsx" "jsx") - (raw_text) @injection.content)) + (start_tag + (attribute + (attribute_name) @_attr + (quoted_attribute_value + (attribute_value) @injection.language))) + (#eq? @_attr "lang") + (#any-of? @injection.language "tsx" "jsx") + (raw_text) @injection.content)) ((interpolation (raw_text) @injection.content) @@ -65,8 +69,9 @@ (#set! injection.language "typescript"))) (template_element - (start_tag - (attribute - (quoted_attribute_value (attribute_value) @injection.language))) - (text) @injection.content - (#eq? @injection.language "pug")) + (start_tag + (attribute + (quoted_attribute_value + (attribute_value) @injection.language))) + (text) @injection.content + (#eq? @injection.language "pug")) diff --git a/queries/wgsl/folds.scm b/queries/wgsl/folds.scm index d8000edee..60b526c53 100644 --- a/queries/wgsl/folds.scm +++ b/queries/wgsl/folds.scm @@ -1,10 +1,10 @@ [ - (struct_declaration) - (function_declaration) - (if_statement) - (switch_statement) - (switch_body) - (loop_statement) - (for_statement) - (while_statement) + (struct_declaration) + (function_declaration) + (if_statement) + (switch_statement) + (switch_body) + (loop_statement) + (for_statement) + (while_statement) ] @fold diff --git a/queries/wgsl/highlights.scm b/queries/wgsl/highlights.scm index 6e190f06e..970c4e2eb 100644 --- a/queries/wgsl/highlights.scm +++ b/queries/wgsl/highlights.scm @@ -1,104 +1,126 @@ (identifier) @variable + (int_literal) @number + (float_literal) @number.float + (bool_literal) @boolean (type_declaration) @type (function_declaration - (identifier) @function) + (identifier) @function) (parameter - (variable_identifier_declaration (identifier) @variable.parameter)) + (variable_identifier_declaration + (identifier) @variable.parameter)) (struct_declaration - (identifier) @type) + (identifier) @type) (struct_declaration - (struct_member (variable_identifier_declaration (identifier) @variable.member))) + (struct_member + (variable_identifier_declaration + (identifier) @variable.member))) (type_constructor_or_function_call_expression - (type_declaration) @function.call) + (type_declaration) @function.call) [ - "struct" - "bitcast" - "discard" - "enable" - "fallthrough" - "let" - "type" - "var" - "override" - (texel_format) + "struct" + "bitcast" + "discard" + "enable" + "fallthrough" + "let" + "type" + "var" + "override" + (texel_format) ] @keyword [ - "private" - "storage" - "uniform" - "workgroup" + "private" + "storage" + "uniform" + "workgroup" ] @keyword.storage [ - "read" - "read_write" - "write" + "read" + "read_write" + "write" ] @type.qualifier "fn" @keyword.function "return" @keyword.return -[ "," "." ":" ";" "->" ] @punctuation.delimiter +[ + "," + "." + ":" + ";" + "->" +] @punctuation.delimiter -["(" ")" "[" "]" "{" "}"] @punctuation.bracket +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket [ - "loop" - "for" - "while" - "break" - "continue" - "continuing" + "loop" + "for" + "while" + "break" + "continue" + "continuing" ] @keyword.repeat [ - "if" - "else" - "switch" - "case" - "default" + "if" + "else" + "switch" + "case" + "default" ] @keyword.conditional [ - "&" - "&&" - "/" - "!" - "=" - "==" - "!=" - ">" - ">=" - ">>" - "<" - "<=" - "<<" - "%" - "-" - "+" - "|" - "||" - "*" - "~" - "^" - "@" - "++" - "--" + "&" + "&&" + "/" + "!" + "=" + "==" + "!=" + ">" + ">=" + ">>" + "<" + "<=" + "<<" + "%" + "-" + "+" + "|" + "||" + "*" + "~" + "^" + "@" + "++" + "--" ] @operator (attribute - (identifier) @attribute) + (identifier) @attribute) -[(line_comment) (block_comment)] @comment @spell +[ + (line_comment) + (block_comment) +] @comment @spell diff --git a/queries/wgsl/indents.scm b/queries/wgsl/indents.scm index 08be2255e..b74e56e34 100644 --- a/queries/wgsl/indents.scm +++ b/queries/wgsl/indents.scm @@ -5,10 +5,17 @@ (struct_declaration) ] @indent.begin -(compound_statement "}" @indent.end) -(loop_statement "}" @indent.end) -(function_declaration ")" @indent.end) -(struct_declaration "}" @indent.end) +(compound_statement + "}" @indent.end) + +(loop_statement + "}" @indent.end) + +(function_declaration + ")" @indent.end) + +(struct_declaration + "}" @indent.end) [ "else" @@ -16,4 +23,7 @@ "}" ] @indent.branch -[(line_comment) (block_comment)] @indent.auto +[ + (line_comment) + (block_comment) +] @indent.auto diff --git a/queries/wgsl_bevy/folds.scm b/queries/wgsl_bevy/folds.scm index 7d2547fa0..bb371406d 100644 --- a/queries/wgsl_bevy/folds.scm +++ b/queries/wgsl_bevy/folds.scm @@ -1,5 +1,2 @@ ; inherits wgsl - -[ - (preproc_ifdef) -] @fold +(preproc_ifdef) @fold diff --git a/queries/wgsl_bevy/highlights.scm b/queries/wgsl_bevy/highlights.scm index d14276733..9cd796c72 100644 --- a/queries/wgsl_bevy/highlights.scm +++ b/queries/wgsl_bevy/highlights.scm @@ -1,36 +1,44 @@ ; inherits wgsl - [ - "virtual" - "override" + "virtual" + "override" ] @keyword [ - "#import" - "#define_import_path" - "as" + "#import" + "#define_import_path" + "as" ] @keyword.import "::" @punctuation.delimiter (function_declaration (import_path - ((identifier) @function .))) + ((identifier) @function.))) -(import_path (identifier) @module (identifier)) +(import_path + (identifier) @module + (identifier)) (struct_declaration - (preproc_ifdef (struct_member (variable_identifier_declaration (identifier) @variable.member)))) + (preproc_ifdef + (struct_member + (variable_identifier_declaration + (identifier) @variable.member)))) + (struct_declaration - (preproc_ifdef - (preproc_else (struct_member (variable_identifier_declaration (identifier) @variable.member))))) + (preproc_ifdef + (preproc_else + (struct_member + (variable_identifier_declaration + (identifier) @variable.member))))) (preproc_ifdef name: (identifier) @constant.macro) [ - "#ifdef" - "#ifndef" - "#endif" - "#else" + "#ifdef" + "#ifndef" + "#endif" + "#else" ] @keyword.directive diff --git a/queries/wing/highlights.scm b/queries/wing/highlights.scm index 3ef530746..2fb7268e7 100644 --- a/queries/wing/highlights.scm +++ b/queries/wing/highlights.scm @@ -1,39 +1,49 @@ (identifier) @variable + (reference_identifier) @variable + (member_identifier) @property ; Classes - (custom_type) @type -(class_field + +(class_field name: (identifier) @variable.member) -(class_definition + +(class_definition name: (identifier) @type) + (method_definition name: (identifier) @function.method) ; Functions - (keyword_argument_key) @variable.parameter -(call - caller: (reference - (nested_identifier - property: (member_identifier) @function.method.call))) -(call - caller: (reference - (reference_identifier) @function.method.call)) -; Primitives +(call + caller: + (reference + (nested_identifier + property: (member_identifier) @function.method.call))) +(call + caller: + (reference + (reference_identifier) @function.method.call)) + +; Primitives (number) @number + (duration) @constant + (string) @string + (bool) @boolean + (builtin_type) @type.builtin + (json_container_type) @type.builtin ; Special - (comment) @comment @spell [ @@ -41,7 +51,7 @@ ")" "{" "}" -] @punctuation.bracket +] @punctuation.bracket [ "-" diff --git a/queries/wing/locals.scm b/queries/wing/locals.scm index c5515d15e..9a860c5f2 100644 --- a/queries/wing/locals.scm +++ b/queries/wing/locals.scm @@ -1,4 +1,5 @@ (block) @local.scope + (variable_definition_statement name: (identifier) @local.definition) diff --git a/queries/xcompose/highlights.scm b/queries/xcompose/highlights.scm index 811a67b1d..82ef8e6d4 100644 --- a/queries/xcompose/highlights.scm +++ b/queries/xcompose/highlights.scm @@ -1,20 +1,38 @@ (keysym) @constant ((keysym) @constant.builtin - (#eq? @constant.builtin "Multi_key")) + (#eq? @constant.builtin "Multi_key")) (text) @string "include" @keyword.import -[ (octal) (hex) ] @number +[ + (octal) + (hex) +] @number -[ (modifier) "None" ] @type.qualifier +[ + (modifier) + "None" +] @type.qualifier -[ "%L" "%H" "%S" ] @string.special +[ + "%L" + "%H" + "%S" +] @string.special -[ "!" "~" ] @operator +[ + "!" + "~" +] @operator -[ ":" "<" ">" "\"" ] @punctuation.delimiter +[ + ":" + "<" + ">" + "\"" +] @punctuation.delimiter (comment) @comment @spell diff --git a/queries/xcompose/injections.scm b/queries/xcompose/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/xcompose/injections.scm +++ b/queries/xcompose/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/xcompose/locals.scm b/queries/xcompose/locals.scm index 365472da2..9b6f359bf 100644 --- a/queries/xcompose/locals.scm +++ b/queries/xcompose/locals.scm @@ -1,3 +1,5 @@ -(result (keysym) @local.definition) +(result + (keysym) @local.definition) -(event (keysym) @local.reference) +(event + (keysym) @local.reference) diff --git a/queries/xml/highlights.scm b/queries/xml/highlights.scm index aa913352e..7881e0df0 100644 --- a/queries/xml/highlights.scm +++ b/queries/xml/highlights.scm @@ -1,53 +1,65 @@ ; inherits: dtd +; XML declaration +(XMLDecl + "standalone" @tag.attribute) -;; XML declaration +(XMLDecl + [ + "yes" + "no" + ] @boolean) -(XMLDecl "standalone" @tag.attribute) +; Processing instructions +(XmlModelPI + "xml-model" @keyword.directive) -(XMLDecl [ "yes" "no" ] @boolean) +(StyleSheetPI + "xml-stylesheet" @keyword.directive) -;; Processing instructions +(PseudoAtt + (Name) @tag.attribute) -(XmlModelPI "xml-model" @keyword.directive) +(PseudoAtt + (PseudoAttValue) @string) -(StyleSheetPI "xml-stylesheet" @keyword.directive) +; Doctype declaration +(doctypedecl + "DOCTYPE" @keyword.directive.define) -(PseudoAtt (Name) @tag.attribute) +(doctypedecl + (Name) @type.definition) -(PseudoAtt (PseudoAttValue) @string) +; Tags +(STag + (Name) @tag) -;; Doctype declaration +(ETag + (Name) @tag) -(doctypedecl "DOCTYPE" @keyword.directive.define) +(EmptyElemTag + (Name) @tag) -(doctypedecl (Name) @type.definition) +; Attributes +(Attribute + (Name) @tag.attribute) -;; Tags - -(STag (Name) @tag) - -(ETag (Name) @tag) - -(EmptyElemTag (Name) @tag) - -;; Attributes - -(Attribute (Name) @tag.attribute) - -(Attribute (AttValue) @string) - -;; Text +(Attribute + (AttValue) @string) +; Text (CharData) @none @spell ((CDSect (CDStart) @markup.environment (CData) @markup.raw "]]>" @markup.environment) - (#set! "priority" 105)) - -;; Delimiters & punctuation + (#set! "priority" 105)) -[ "<" "</" "/>" ] @tag.delimiter +; Delimiters & punctuation +[ + "<" + "</" + "/>" +] @tag.delimiter "]" @punctuation.bracket diff --git a/queries/xml/injections.scm b/queries/xml/injections.scm index 99b3a9cc8..942e54575 100644 --- a/queries/xml/injections.scm +++ b/queries/xml/injections.scm @@ -1,29 +1,31 @@ -((Comment) @injection.content - (#set! injection.language "comment")) - +((Comment) @injection.content + (#set! injection.language "comment")) ; SVG style ((element - (STag (Name) @_name) - (content) @injection.content) - (#eq? @_name "style") - (#set! injection.combined) - (#set! injection.include-children) - (#set! injection.language "css")) + (STag + (Name) @_name) + (content) @injection.content) + (#eq? @_name "style") + (#set! injection.combined) + (#set! injection.include-children) + (#set! injection.language "css")) ; SVG script ((element - (STag (Name) @_name) - (content) @injection.content) - (#eq? @_name "script") - (#set! injection.combined) - (#set! injection.include-children) - (#set! injection.language "javascript")) + (STag + (Name) @_name) + (content) @injection.content) + (#eq? @_name "script") + (#set! injection.combined) + (#set! injection.include-children) + (#set! injection.language "javascript")) ; phpMyAdmin dump ((element - (STag (Name) @_name) - (content) @injection.content) - (#eq? @_name "pma:table") - (#set! injection.combined) - (#set! injection.include-children) - (#set! injection.language "sql")) + (STag + (Name) @_name) + (content) @injection.content) + (#eq? @_name "pma:table") + (#set! injection.combined) + (#set! injection.include-children) + (#set! injection.language "sql")) diff --git a/queries/xml/locals.scm b/queries/xml/locals.scm index 214b43818..2806b530c 100644 --- a/queries/xml/locals.scm +++ b/queries/xml/locals.scm @@ -1,25 +1,35 @@ -;; tags - -(elementdecl (Name) @local.definition.type) +; tags +(elementdecl + (Name) @local.definition.type) (elementdecl (contentspec - (children (Name) @local.reference))) + (children + (Name) @local.reference))) -(AttlistDecl . (Name) @local.reference) +(AttlistDecl + . + (Name) @local.reference) -(STag (Name) @local.reference) -(ETag (Name) @local.reference) -(EmptyElemTag (Name) @local.reference) +(STag + (Name) @local.reference) -;; attributes +(ETag + (Name) @local.reference) -(AttDef (Name) @local.definition.field) +(EmptyElemTag + (Name) @local.reference) -(Attribute (Name) @local.reference) +; attributes +(AttDef + (Name) @local.definition.field) -;; entities +(Attribute + (Name) @local.reference) -(GEDecl (Name) @local.definition.macro) +; entities +(GEDecl + (Name) @local.definition.macro) -(EntityRef (Name) @local.reference) +(EntityRef + (Name) @local.reference) diff --git a/queries/yaml/highlights.scm b/queries/yaml/highlights.scm index 03234a5ce..32f77c2cd 100644 --- a/queries/yaml/highlights.scm +++ b/queries/yaml/highlights.scm @@ -1,15 +1,28 @@ (boolean_scalar) @boolean + (null_scalar) @constant.builtin + (double_quote_scalar) @string + (single_quote_scalar) @string -((block_scalar) @string (#set! "priority" 99)) + +((block_scalar) @string + (#set! "priority" 99)) + (string_scalar) @string + (escape_sequence) @string.escape + (integer_scalar) @number + (float_scalar) @number + (comment) @comment @spell + (anchor_name) @type + (alias_name) @type + (tag) @type [ @@ -19,34 +32,54 @@ ] @keyword.directive (block_mapping_pair - key: (flow_node [(double_quote_scalar) (single_quote_scalar)] @variable.member)) + key: + (flow_node + [ + (double_quote_scalar) + (single_quote_scalar) + ] @variable.member)) + (block_mapping_pair - key: (flow_node (plain_scalar (string_scalar) @variable.member))) + key: + (flow_node + (plain_scalar + (string_scalar) @variable.member))) (flow_mapping - (_ key: (flow_node [(double_quote_scalar) (single_quote_scalar)] @variable.member))) + (_ + key: + (flow_node + [ + (double_quote_scalar) + (single_quote_scalar) + ] @variable.member))) + (flow_mapping - (_ key: (flow_node (plain_scalar (string_scalar) @variable.member)))) + (_ + key: + (flow_node + (plain_scalar + (string_scalar) @variable.member)))) [ - "," - "-" - ":" - ">" - "?" - "|" + "," + "-" + ":" + ">" + "?" + "|" ] @punctuation.delimiter [ - "[" - "]" - "{" - "}" + "[" + "]" + "{" + "}" ] @punctuation.bracket [ - "*" - "&" - "---" - "..." + "*" + "&" + "---" + "..." ] @punctuation.special diff --git a/queries/yaml/indents.scm b/queries/yaml/indents.scm index f168bcc5a..f7146d316 100644 --- a/queries/yaml/indents.scm +++ b/queries/yaml/indents.scm @@ -1,5 +1,6 @@ [ - (block_mapping_pair value: (block_node)) + (block_mapping_pair + value: (block_node)) (block_sequence_item) ] @indent.begin diff --git a/queries/yaml/injections.scm b/queries/yaml/injections.scm index ae86e7950..4661276e3 100644 --- a/queries/yaml/injections.scm +++ b/queries/yaml/injections.scm @@ -1,72 +1,87 @@ ((comment) @injection.content - (#set! injection.language "comment")) - -;; Github actions ("run") / Gitlab CI ("scripts") + (#set! injection.language "comment")) +; Github actions ("run") / Gitlab CI ("scripts") (block_mapping_pair - key: (flow_node) @_run (#any-of? @_run "run" "script" "before_script" "after_script") - value: (flow_node - (plain_scalar - (string_scalar) @injection.content) - (#set! injection.language "bash"))) + key: (flow_node) @_run + (#any-of? @_run "run" "script" "before_script" "after_script") + value: + (flow_node + (plain_scalar + (string_scalar) @injection.content) + (#set! injection.language "bash"))) (block_mapping_pair - key: (flow_node) @_run (#any-of? @_run "run" "script" "before_script" "after_script") - value: (block_node - (block_scalar) @injection.content - (#set! injection.language "bash") - (#offset! @injection.content 0 1 0 0))) + key: (flow_node) @_run + (#any-of? @_run "run" "script" "before_script" "after_script") + value: + (block_node + (block_scalar) @injection.content + (#set! injection.language "bash") + (#offset! @injection.content 0 1 0 0))) (block_mapping_pair - key: (flow_node) @_run (#any-of? @_run "run" "script" "before_script" "after_script") - value: (block_node - (block_sequence - (block_sequence_item - (flow_node - (plain_scalar - (string_scalar) @injection.content)) - (#set! injection.language "bash"))))) + key: (flow_node) @_run + (#any-of? @_run "run" "script" "before_script" "after_script") + value: + (block_node + (block_sequence + (block_sequence_item + (flow_node + (plain_scalar + (string_scalar) @injection.content)) + (#set! injection.language "bash"))))) (block_mapping_pair - key: (flow_node) @_run (#any-of? @_run "script" "before_script" "after_script") - value: (block_node - (block_sequence - (block_sequence_item - (block_node - (block_scalar) @injection.content - (#set! injection.language "bash") - (#offset! @injection.content 0 1 0 0)))))) + key: (flow_node) @_run + (#any-of? @_run "script" "before_script" "after_script") + value: + (block_node + (block_sequence + (block_sequence_item + (block_node + (block_scalar) @injection.content + (#set! injection.language "bash") + (#offset! @injection.content 0 1 0 0)))))) -;; Prometheus Alertmanager ("expr") +; Prometheus Alertmanager ("expr") (block_mapping_pair - key: (flow_node) @_expr (#eq? @_expr "expr") - value: (flow_node - (plain_scalar - (string_scalar) @injection.content) - (#set! injection.language "promql"))) + key: (flow_node) @_expr + (#eq? @_expr "expr") + value: + (flow_node + (plain_scalar + (string_scalar) @injection.content) + (#set! injection.language "promql"))) (block_mapping_pair - key: (flow_node) @_expr (#eq? @_expr "expr") - value: (block_node - (block_scalar) @injection.content - (#set! injection.language "promql") - (#offset! @injection.content 0 1 0 0))) + key: (flow_node) @_expr + (#eq? @_expr "expr") + value: + (block_node + (block_scalar) @injection.content + (#set! injection.language "promql") + (#offset! @injection.content 0 1 0 0))) (block_mapping_pair - key: (flow_node) @_expr (#eq? @_expr "expr") - value: (block_node - (block_sequence - (block_sequence_item - (flow_node - (plain_scalar - (string_scalar) @injection.content)) - (#set! injection.language "promql"))))) + key: (flow_node) @_expr + (#eq? @_expr "expr") + value: + (block_node + (block_sequence + (block_sequence_item + (flow_node + (plain_scalar + (string_scalar) @injection.content)) + (#set! injection.language "promql"))))) (block_mapping_pair - key: (flow_node) @_expr (#eq? @_expr "expr") - value: (block_node - (block_sequence - (block_sequence_item - (block_node - (block_scalar) @injection.content - (#set! injection.language "promql") - (#offset! @injection.content 0 1 0 0)))))) + key: (flow_node) @_expr + (#eq? @_expr "expr") + value: + (block_node + (block_sequence + (block_sequence_item + (block_node + (block_scalar) @injection.content + (#set! injection.language "promql") + (#offset! @injection.content 0 1 0 0)))))) diff --git a/queries/yaml/locals.scm b/queries/yaml/locals.scm index 8a438434b..f7c79e082 100644 --- a/queries/yaml/locals.scm +++ b/queries/yaml/locals.scm @@ -1,8 +1,9 @@ [ - (stream) - (document) - (block_node) + (stream) + (document) + (block_node) ] @local.scope (anchor_name) @local.definition + (alias_name) @local.reference diff --git a/queries/yang/folds.scm b/queries/yang/folds.scm index adf0eb113..fd7d23999 100644 --- a/queries/yang/folds.scm +++ b/queries/yang/folds.scm @@ -1,3 +1 @@ -[ - (block) -] @fold +(block) @fold diff --git a/queries/yang/highlights.scm b/queries/yang/highlights.scm index 33e5517c3..133f99beb 100644 --- a/queries/yang/highlights.scm +++ b/queries/yang/highlights.scm @@ -1,29 +1,54 @@ - (comment) @comment @spell - ; Module / submodule -["module" "submodule"] @keyword +[ + "module" + "submodule" +] @keyword ; Keywords (statement_keyword) @keyword -(statement_keyword "import") @keyword.import + +(statement_keyword + "import") @keyword.import + (extension_keyword) @function ; Arguments (built_in_type) @type.builtin + (number) @number + (boolean) @boolean + (date) @number -(range (_ ".." @punctuation.special)) -(range (_ "|" @punctuation.special)) -(quoted_range "\"" @string.special) -(quoted_range "'" @string.special) + +(range + (_ + ".." @punctuation.special)) + +(range + (_ + "|" @punctuation.special)) + +(quoted_range + "\"" @string.special) + +(quoted_range + "'" @string.special) + (yang_version) @constant.builtin + (identifier) @variable + (node_identifier) @variable + (string) @string -(string (escape_sequence) @string.escape) + +(string + (escape_sequence) @string.escape) + (unquoted_string) @string + (keypath) @string.special.path ; Always highlight the value of an enum statement as a string @@ -31,13 +56,23 @@ ; Highlight xpath and pattern strings differently from plain strings (statement - (statement_keyword "must") - (argument (string) @string.special)) + (statement_keyword + "must") + (argument + (string) @string.special)) + (statement - (statement_keyword "pattern") - (argument (string) @string.regexp)) + (statement_keyword + "pattern") + (argument + (string) @string.regexp)) ; Punctuation (plus_symbol) @operator -["{" "}"] @punctuation.bracket -[";"] @punctuation.delimiter + +[ + "{" + "}" +] @punctuation.bracket + +";" @punctuation.delimiter diff --git a/queries/yang/indents.scm b/queries/yang/indents.scm index d8782f955..cc4b3caee 100644 --- a/queries/yang/indents.scm +++ b/queries/yang/indents.scm @@ -1,11 +1,20 @@ (module) @indent.begin + (submodule) @indent.begin + (statement) @indent.begin + (extension_statement) @indent.begin -(statement ";" @indent.end) -(extension_statement ";" @indent.end) -(block "}" @indent.end @indent.branch) + +(statement + ";" @indent.end) + +(extension_statement + ";" @indent.end) + +(block + "}" @indent.end @indent.branch) ((string) @indent.align - (#set! indent.open_delimiter "\"") - (#set! indent.close_delimiter "\"")) + (#set! indent.open_delimiter "\"") + (#set! indent.close_delimiter "\"")) diff --git a/queries/yang/injections.scm b/queries/yang/injections.scm index 44b0e44e9..4219eb30a 100644 --- a/queries/yang/injections.scm +++ b/queries/yang/injections.scm @@ -1,8 +1,10 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((statement - (statement_keyword "pattern") - (argument (string) @injection.content)) - (#set! injection.language "regex") - (#offset! @injection.content 0 1 0 -1)) + (statement_keyword + "pattern") + (argument + (string) @injection.content)) + (#set! injection.language "regex") + (#offset! @injection.content 0 1 0 -1)) diff --git a/queries/yuck/highlights.scm b/queries/yuck/highlights.scm index c885d909d..bd414b8e7 100644 --- a/queries/yuck/highlights.scm +++ b/queries/yuck/highlights.scm @@ -1,66 +1,54 @@ ; Tags - ; TODO apply to every symbol in list? I think it should probably only be applied to the first child of the list (list (symbol) @tag) ; Includes - -(list . +(list + . ((symbol) @keyword.import (#eq? @keyword.import "include"))) ; Keywords - ; I think there's a bug in tree-sitter the anchor doesn't seem to be working, see ; https://github.com/tree-sitter/tree-sitter/pull/2107 -(list . +(list + . ((symbol) @keyword (#any-of? @keyword "defwindow" "defwidget" "defvar" "defpoll" "deflisten" "geometry" "children" "struts"))) ; Loop +(loop_widget + . + "for" @keyword.repeat + . + (symbol) @variable + . + "in" @keyword.operator) -(loop_widget . "for" @keyword.repeat . (symbol) @variable . "in" @keyword.operator) - -(loop_widget . "for" @keyword.repeat . (symbol) @variable . "in" @keyword.operator . (symbol) @variable) +(loop_widget + . + "for" @keyword.repeat + . + (symbol) @variable + . + "in" @keyword.operator + . + (symbol) @variable) ; Builtin widgets - -(list . +(list + . ((symbol) @tag.builtin - (#any-of? @tag.builtin - "box" - "button" - "calendar" - "centerbox" - "checkbox" - "circular-progress" - "color-button" - "color-chooser" - "combo-box-text" - "eventbox" - "expander" - "graph" - "image" - "input" - "label" - "literal" - "overlay" - "progress" - "revealer" - "scale" - "scroll" - "transform"))) + (#any-of? @tag.builtin "box" "button" "calendar" "centerbox" "checkbox" "circular-progress" "color-button" "color-chooser" "combo-box-text" "eventbox" "expander" "graph" "image" "input" "label" "literal" "overlay" "progress" "revealer" "scale" "scroll" "transform"))) ; Variables - (ident) @variable (array (symbol) @variable) ; Properties & Fields - (keyword) @property (json_access @@ -87,12 +75,10 @@ (ident) @variable.member)) ; Functions - (function_call name: (ident) @function.call) ; Operators - [ "+" "-" @@ -114,17 +100,29 @@ ] @operator ; Punctuation +[ + ":" + "." + "," +] @punctuation.delimiter -[":" "." ","] @punctuation.delimiter -["{" "}" "[" "]" "(" ")"] @punctuation.bracket +[ + "{" + "}" + "[" + "]" + "(" + ")" +] @punctuation.bracket ; Ternary expression - (ternary_expression - ["?" ":"] @keyword.conditional.ternary) + [ + "?" + ":" + ] @keyword.conditional.ternary) ; Literals - (number) @number (float) @number.float @@ -132,8 +130,12 @@ (boolean) @boolean ; Strings - -[ (string_fragment) "\"" "'" "`" ] @string +[ + (string_fragment) + "\"" + "'" + "`" +] @string (string_interpolation "${" @punctuation.special @@ -142,5 +144,4 @@ (escape_sequence) @string.escape ; Comments - (comment) @comment @spell diff --git a/queries/yuck/indents.scm b/queries/yuck/indents.scm index bcf028ce4..cd326b923 100644 --- a/queries/yuck/indents.scm +++ b/queries/yuck/indents.scm @@ -6,21 +6,32 @@ (json_object) (parenthesized_expression) ] @indent.begin - ; TODO: can't get this to work, goal is to indent at the property ":" prefix ; ((list (identifier) (property)) @indent.align ; (#set! indent.open_delimiter "(") ; (#set! indent.close_delimiter ")")) +[ + ")" + "}" + "]" +] @indent.end -[")" "}" "]"] @indent.end - -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch [ - (ERROR) - (comment) + (ERROR) + (comment) ] @indent.auto diff --git a/queries/yuck/injections.scm b/queries/yuck/injections.scm index 4bb7d675d..2f0e58eb6 100644 --- a/queries/yuck/injections.scm +++ b/queries/yuck/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/yuck/locals.scm b/queries/yuck/locals.scm index 063d59b1a..9f40b2082 100644 --- a/queries/yuck/locals.scm +++ b/queries/yuck/locals.scm @@ -13,7 +13,7 @@ (keyword) @local.definition.field (json_object - (simplexpr + (simplexpr (ident) @local.definition.field)) (ast_block diff --git a/queries/zig/folds.scm b/queries/zig/folds.scm index 965987439..1d65a5280 100644 --- a/queries/zig/folds.scm +++ b/queries/zig/folds.scm @@ -6,11 +6,9 @@ (AsmExpr) (ErrorSetDecl) (LINESTRING) - ( - [ - (IfPrefix) - (WhilePrefix) - (ForPrefix) - ] - ) + ([ + (IfPrefix) + (WhilePrefix) + (ForPrefix) + ]) ] @fold diff --git a/queries/zig/highlights.scm b/queries/zig/highlights.scm index 875235412..c0477986d 100644 --- a/queries/zig/highlights.scm +++ b/queries/zig/highlights.scm @@ -9,7 +9,6 @@ variable: (IDENTIFIER) variable_type_function: (IDENTIFIER) ] @variable - parameter: (IDENTIFIER) @variable.parameter [ @@ -17,56 +16,45 @@ parameter: (IDENTIFIER) @variable.parameter field_access: (IDENTIFIER) ] @variable.member -;; assume TitleCase is a type -( - [ - variable_type_function: (IDENTIFIER) - field_access: (IDENTIFIER) - parameter: (IDENTIFIER) - ] @type - (#lua-match? @type "^%u([%l]+[%u%l%d]*)*$") -) -;; assume camelCase is a function -( - [ - variable_type_function: (IDENTIFIER) - field_access: (IDENTIFIER) - parameter: (IDENTIFIER) - ] @function - (#lua-match? @function "^%l+([%u][%l%d]*)+$") -) +; assume TitleCase is a type +([ + variable_type_function: (IDENTIFIER) + field_access: (IDENTIFIER) + parameter: (IDENTIFIER) +] @type + (#lua-match? @type "^%u([%l]+[%u%l%d]*)*$")) -;; assume all CAPS_1 is a constant -( - [ - variable_type_function: (IDENTIFIER) - field_access: (IDENTIFIER) - ] @constant - (#lua-match? @constant "^%u[%u%d_]+$") -) +; assume camelCase is a function +([ + variable_type_function: (IDENTIFIER) + field_access: (IDENTIFIER) + parameter: (IDENTIFIER) +] @function + (#lua-match? @function "^%l+([%u][%l%d]*)+$")) +; assume all CAPS_1 is a constant +([ + variable_type_function: (IDENTIFIER) + field_access: (IDENTIFIER) +] @constant + (#lua-match? @constant "^%u[%u%d_]+$")) function: (IDENTIFIER) @function function_call: (IDENTIFIER) @function.call - exception: "!" @keyword.exception -( - (IDENTIFIER) @variable.builtin - (#eq? @variable.builtin "_") -) - -(PtrTypeStart "c" @variable.builtin) +((IDENTIFIER) @variable.builtin + (#eq? @variable.builtin "_")) -( - (ContainerDeclType - [ - (ErrorUnionExpr) - "enum" - ] - ) - (ContainerField (IDENTIFIER) @constant) -) +(PtrTypeStart + "c" @variable.builtin) +((ContainerDeclType + [ + (ErrorUnionExpr) + "enum" + ]) + (ContainerField + (IDENTIFIER) @constant)) field_constant: (IDENTIFIER) @constant (BUILTINIDENTIFIER) @function.builtin @@ -89,11 +77,16 @@ field_constant: (IDENTIFIER) @constant ] @string @spell (CHAR_LITERAL) @character + (EscapeSequence) @string.escape + (FormatSequence) @string.special -(BreakLabel (IDENTIFIER) @label) -(BlockLabel (IDENTIFIER) @label) +(BreakLabel + (IDENTIFIER) @label) + +(BlockLabel + (IDENTIFIER) @label) [ "asm" @@ -115,9 +108,7 @@ field_constant: (IDENTIFIER) @constant "resume" ] @keyword.coroutine -[ - "fn" -] @keyword.function +"fn" @keyword.function [ "and" @@ -125,9 +116,7 @@ field_constant: (IDENTIFIER) @constant "orelse" ] @keyword.operator -[ - "return" -] @keyword.return +"return" @keyword.return [ "if" @@ -142,9 +131,7 @@ field_constant: (IDENTIFIER) @constant "continue" ] @keyword.repeat -[ - "usingnamespace" -] @keyword.import +"usingnamespace" @keyword.import [ "try" @@ -223,7 +210,10 @@ field_constant: (IDENTIFIER) @constant ")" "{" "}" - (Payload "|") - (PtrPayload "|") - (PtrIndexPayload "|") + (Payload + "|") + (PtrPayload + "|") + (PtrIndexPayload + "|") ] @punctuation.bracket diff --git a/queries/zig/indents.scm b/queries/zig/indents.scm index fdf7b183b..bf9d3e42a 100644 --- a/queries/zig/indents.scm +++ b/queries/zig/indents.scm @@ -5,7 +5,8 @@ (InitList) ] @indent.begin -(Block "}" @indent.end) +(Block + "}" @indent.end) [ "(" diff --git a/queries/zig/injections.scm b/queries/zig/injections.scm index 31e15a328..9e687ca76 100644 --- a/queries/zig/injections.scm +++ b/queries/zig/injections.scm @@ -2,6 +2,5 @@ (container_doc_comment) (doc_comment) (line_comment) - ] @injection.content - (#set! injection.language "comment")) - +] @injection.content + (#set! injection.language "comment")) diff --git a/queries/zig/locals.scm b/queries/zig/locals.scm index e69de29bb..8b1378917 100644 --- a/queries/zig/locals.scm +++ b/queries/zig/locals.scm @@ -0,0 +1 @@ + |
