Unnamed repository; edit this file 'description' to name the repository.
Reverse highlight precedence ordering (#9458)
Co-authored-by: postsolar <[email protected]> Co-authored-by: Iorvethe <[email protected]> Co-authored-by: Blaž Hrastnik <[email protected]> Co-authored-by: gabydd <[email protected]>
Michael Davis 2025-02-03
parent 3824010 · commit 5952d56
-rw-r--r--book/src/guides/adding_languages.md6
-rw-r--r--helix-core/src/syntax.rs8
-rw-r--r--languages.toml6
-rw-r--r--runtime/queries/_jsx/highlights.scm52
-rw-r--r--runtime/queries/_typescript/highlights.scm9
-rw-r--r--runtime/queries/awk/highlights.scm9
-rw-r--r--runtime/queries/bash/highlights.scm5
-rw-r--r--runtime/queries/bass/highlights.scm22
-rw-r--r--runtime/queries/bitbake/highlights.scm2
-rw-r--r--runtime/queries/c/highlights.scm23
-rw-r--r--runtime/queries/capnp/highlights.scm11
-rw-r--r--runtime/queries/cel/highlights.scm18
-rw-r--r--runtime/queries/clojure/highlights.scm16
-rw-r--r--runtime/queries/comment/highlights.scm24
-rw-r--r--runtime/queries/cpp/highlights.scm46
-rw-r--r--runtime/queries/css/highlights.scm6
-rw-r--r--runtime/queries/cue/highlights.scm173
-rw-r--r--runtime/queries/d/highlights.scm3
-rw-r--r--runtime/queries/devicetree/highlights.scm4
-rw-r--r--runtime/queries/dockerfile/highlights.scm12
-rw-r--r--runtime/queries/dot/highlights.scm10
-rw-r--r--runtime/queries/ecma/highlights.scm282
-rw-r--r--runtime/queries/edoc/highlights.scm2
-rw-r--r--runtime/queries/elisp/highlights.scm4
-rw-r--r--runtime/queries/elixir/highlights.scm264
-rw-r--r--runtime/queries/elvish/highlights.scm2
-rw-r--r--runtime/queries/erlang/highlights.scm85
-rw-r--r--runtime/queries/esdl/highlights.scm7
-rw-r--r--runtime/queries/fish/highlights.scm5
-rw-r--r--runtime/queries/fortran/highlights.scm3
-rw-r--r--runtime/queries/ghostty/highlights.scm14
-rw-r--r--runtime/queries/gjs/highlights.scm2
-rw-r--r--runtime/queries/gleam/highlights.scm8
-rw-r--r--runtime/queries/go/highlights.scm63
-rw-r--r--runtime/queries/gts/highlights.scm2
-rw-r--r--runtime/queries/hare/highlights.scm3
-rw-r--r--runtime/queries/haskell/highlights.scm17
-rw-r--r--runtime/queries/hcl/highlights.scm87
-rw-r--r--runtime/queries/hocon/highlights.scm4
-rw-r--r--runtime/queries/inko/highlights.scm12
-rw-r--r--runtime/queries/janet/highlights.scm11
-rw-r--r--runtime/queries/java/highlights.scm4
-rw-r--r--runtime/queries/javascript/highlights.scm2
-rw-r--r--runtime/queries/jsonnet/highlights.scm2
-rw-r--r--runtime/queries/jsx/highlights.scm2
-rw-r--r--runtime/queries/julia/folds.scm21
-rw-r--r--runtime/queries/julia/highlights.scm517
-rw-r--r--runtime/queries/julia/indents.scm30
-rw-r--r--runtime/queries/julia/injections.scm12
-rw-r--r--runtime/queries/julia/locals.scm93
-rw-r--r--runtime/queries/koka/highlights.scm90
-rw-r--r--runtime/queries/kotlin/highlights.scm63
-rw-r--r--runtime/queries/koto/highlights.scm9
-rw-r--r--runtime/queries/ld/highlights.scm4
-rw-r--r--runtime/queries/ldif/highlights.scm3
-rw-r--r--runtime/queries/lean/highlights.scm8
-rw-r--r--runtime/queries/lua/highlights.scm24
-rw-r--r--runtime/queries/meson/highlights.scm6
-rw-r--r--runtime/queries/mojo/highlights.scm49
-rw-r--r--runtime/queries/move/highlights.scm7
-rw-r--r--runtime/queries/nasm/highlights.scm12
-rw-r--r--runtime/queries/nim/highlights.scm4
-rw-r--r--runtime/queries/nix/highlights.scm60
-rw-r--r--runtime/queries/ocaml/highlights.scm52
-rw-r--r--runtime/queries/odin/highlights.scm9
-rw-r--r--runtime/queries/opencl/highlights.scm10
-rw-r--r--runtime/queries/openscad/highlights.scm5
-rw-r--r--runtime/queries/perl/highlights.scm4
-rw-r--r--runtime/queries/php-only/highlights.scm34
-rw-r--r--runtime/queries/php/highlights.scm30
-rw-r--r--runtime/queries/pkl/highlights.scm4
-rw-r--r--runtime/queries/ponylang/highlights.scm18
-rw-r--r--runtime/queries/purescript/highlights.scm67
-rw-r--r--runtime/queries/python/highlights.scm239
-rw-r--r--runtime/queries/r/highlights.scm3
-rw-r--r--runtime/queries/rescript/highlights.scm127
-rw-r--r--runtime/queries/ron/highlights.scm19
-rw-r--r--runtime/queries/ruby/highlights.scm156
-rw-r--r--runtime/queries/rust/highlights.scm246
-rw-r--r--runtime/queries/scala/highlights.scm7
-rw-r--r--runtime/queries/scheme/highlights.scm85
-rw-r--r--runtime/queries/scss/highlights.scm3
-rw-r--r--runtime/queries/solidity/highlights.scm13
-rw-r--r--runtime/queries/strace/highlights.scm2
-rw-r--r--runtime/queries/sway/highlights.scm214
-rw-r--r--runtime/queries/swift/highlights.scm83
-rw-r--r--runtime/queries/t32/highlights.scm8
-rw-r--r--runtime/queries/tact/highlights.scm216
-rw-r--r--runtime/queries/tsq/highlights.scm2
-rw-r--r--runtime/queries/tsx/highlights.scm2
-rw-r--r--runtime/queries/twig/highlights.scm10
-rw-r--r--runtime/queries/typescript/highlights.scm2
-rw-r--r--runtime/queries/typespec/highlights.scm8
-rw-r--r--runtime/queries/vala/highlights.scm2
-rw-r--r--runtime/queries/vhs/highlights.scm3
-rw-r--r--runtime/queries/wgsl/highlights.scm4
-rw-r--r--runtime/queries/wren/highlights.scm19
-rw-r--r--runtime/queries/yaml/highlights.scm20
-rw-r--r--runtime/queries/yuck/highlights.scm20
99 files changed, 2234 insertions, 1876 deletions
diff --git a/book/src/guides/adding_languages.md b/book/src/guides/adding_languages.md
index cb7e0eb6..f9824215 100644
--- a/book/src/guides/adding_languages.md
+++ b/book/src/guides/adding_languages.md
@@ -38,12 +38,6 @@ below.
for more information on writing queries.
4. A list of highlight captures can be found [on the themes page](https://docs.helix-editor.com/themes.html#scopes).
-> 💡 In Helix, the first matching query takes precedence when evaluating
-> queries, which is different from other editors such as Neovim where the last
-> matching query supersedes the ones before it. See
-> [this issue](https://github.com/helix-editor/helix/pull/1170#issuecomment-997294090)
-> for an example.
-
## Common issues
- If you encounter errors when running Helix after switching branches, you may
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index 852a9752..3f1853b0 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -2502,15 +2502,17 @@ impl Iterator for HighlightIter<'_> {
}
}
- // Once a highlighting pattern is found for the current node, skip over
- // any later highlighting patterns that also match this node. Captures
+ // Use the last capture found for the current node, skipping over any
+ // highlight patterns that also match this node. Captures
// for a given node are ordered by pattern index, so these subsequent
// captures are guaranteed to be for highlighting, not injections or
// local variables.
while let Some((next_match, next_capture_index)) = captures.peek() {
let next_capture = next_match.captures[*next_capture_index];
if next_capture.node == capture.node {
- captures.next();
+ match_.remove();
+ capture = next_capture;
+ match_ = captures.next().unwrap().0;
} else {
break;
}
diff --git a/languages.toml b/languages.toml
index 1b3b3c67..f5cab197 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1198,7 +1198,7 @@ indent = { tab-width = 4, unit = " " }
[[grammar]]
name = "julia"
-source = { git = "https://github.com/tree-sitter/tree-sitter-julia", rev = "8fb38abff74652c4faddbf04d2d5bbbc6b4bae25" }
+source = { git = "https://github.com/tree-sitter/tree-sitter-julia", rev = "e84f10db8eeb8b9807786bfc658808edaa1b4fa2" }
[[language]]
name = "java"
@@ -2008,7 +2008,7 @@ indent = { tab-width = 4, unit = " " }
[[grammar]]
name = "ron"
-source = { git = "https://github.com/zee-editor/tree-sitter-ron", rev = "7762d709a0f7c1f9e269d0125a2e8a7a69006146" }
+source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-ron", rev = "78938553b93075e638035f624973083451b29055" }
[[language]]
name = "robot"
@@ -2499,7 +2499,7 @@ formatter = { command = "cue", args = ["fmt", "-"] }
[[grammar]]
name = "cue"
-source = { git = "https://github.com/eonpatapon/tree-sitter-cue", rev = "61843e3beebf19417e4fede4e8be4df1084317ad" }
+source = { git = "https://github.com/eonpatapon/tree-sitter-cue", rev = "8a5f273bfa281c66354da562f2307c2d394b6c81" }
[[language]]
name = "slint"
diff --git a/runtime/queries/_jsx/highlights.scm b/runtime/queries/_jsx/highlights.scm
index 7061b581..70a03091 100644
--- a/runtime/queries/_jsx/highlights.scm
+++ b/runtime/queries/_jsx/highlights.scm
@@ -1,43 +1,43 @@
+; Punctuation
+; -----------
+
+; Handle attribute delimiter (<Component color="red"/>)
+(jsx_attribute "=" @punctuation.delimiter)
+
+; <Component>
+(jsx_opening_element ["<" ">"] @punctuation.bracket)
+
+; </Component>
+(jsx_closing_element ["</" ">"] @punctuation.bracket)
+
+; <Component />
+(jsx_self_closing_element ["<" "/>"] @punctuation.bracket)
+
+; Attributes
+; ----------
+
+(jsx_attribute (property_identifier) @attribute)
+
; Opening elements
; ----------------
+(jsx_opening_element (identifier) @tag)
+
(jsx_opening_element ((identifier) @constructor
(#match? @constructor "^[A-Z]")))
-(jsx_opening_element (identifier) @tag)
-
; Closing elements
; ----------------
+(jsx_closing_element (identifier) @tag)
+
(jsx_closing_element ((identifier) @constructor
(#match? @constructor "^[A-Z]")))
-(jsx_closing_element (identifier) @tag)
-
; Self-closing elements
; ---------------------
-(jsx_self_closing_element ((identifier) @constructor
- (#match? @constructor "^[A-Z]")))
-
(jsx_self_closing_element (identifier) @tag)
-; Attributes
-; ----------
-
-(jsx_attribute (property_identifier) @attribute)
-
-; Punctuation
-; -----------
-
-; Handle attribute delimiter (<Component color="red"/>)
-(jsx_attribute "=" @punctuation.delimiter)
-
-; <Component>
-(jsx_opening_element ["<" ">"] @punctuation.bracket)
-
-; </Component>
-(jsx_closing_element ["</" ">"] @punctuation.bracket)
-
-; <Component />
-(jsx_self_closing_element ["<" "/>"] @punctuation.bracket)
+(jsx_self_closing_element ((identifier) @constructor
+ (#match? @constructor "^[A-Z]")))
diff --git a/runtime/queries/_typescript/highlights.scm b/runtime/queries/_typescript/highlights.scm
index 45c98ba8..a5bfd9ed 100644
--- a/runtime/queries/_typescript/highlights.scm
+++ b/runtime/queries/_typescript/highlights.scm
@@ -107,9 +107,9 @@
; Types
; -----
+(type_identifier) @type
(type_parameter
name: (type_identifier) @type.parameter)
-(type_identifier) @type
(predefined_type) @type.builtin
; Type arguments and parameters
@@ -133,10 +133,3 @@
[
(template_literal_type)
] @string
-
-; Tokens
-; ------
-
-(template_type
- "${" @punctuation.special
- "}" @punctuation.special) @embedded
diff --git a/runtime/queries/awk/highlights.scm b/runtime/queries/awk/highlights.scm
index f8c903f2..d378f831 100644
--- a/runtime/queries/awk/highlights.scm
+++ b/runtime/queries/awk/highlights.scm
@@ -107,14 +107,15 @@
(number) @constant.numeric
(string) @string
-(func_call name: (identifier) @function)
-(func_def name: (identifier) @function)
-
-(field_ref (_) @variable)
[
(identifier)
(field_ref)
] @variable
+(func_call name: (identifier) @function)
+(func_def name: (identifier) @function)
+
+(field_ref (_) @variable)
+
(ns_qualified_name "::" @operator)
(ns_qualified_name (namespace) @namespace)
diff --git a/runtime/queries/bash/highlights.scm b/runtime/queries/bash/highlights.scm
index c3e504f3..19d3cc9f 100644
--- a/runtime/queries/bash/highlights.scm
+++ b/runtime/queries/bash/highlights.scm
@@ -48,6 +48,9 @@
(comment) @comment
+((word) @constant.builtin.boolean
+ (#any-of? @constant.builtin.boolean "true" "false"))
+
(function_definition name: (word) @function)
(file_descriptor) @constant.numeric.integer
@@ -56,7 +59,7 @@
(command_substitution)
(process_substitution)
(expansion)
-]@embedded
+] @embedded
[
"$"
diff --git a/runtime/queries/bass/highlights.scm b/runtime/queries/bass/highlights.scm
index f8b70fc1..e0d67350 100644
--- a/runtime/queries/bass/highlights.scm
+++ b/runtime/queries/bass/highlights.scm
@@ -38,6 +38,17 @@
(subpath (slash) @function)
+;;; generic highlighting for all forms
+
+; first symbol in a list form is a combiner call
+(list . (symbol) @function)
+
+; highlight symbols as vars only when they're clearly vars
+(cons (symbol) @variable)
+(scope (symbol) @variable)
+(path form: (symbol) @variable)
+(symbind form: (symbol) @variable)
+
;;; specific highlighting for builtins & special forms
@@ -88,14 +99,3 @@
.
(_)
(symbol) @function)
-
-;;; generic highlighting for all forms
-
-; first symbol in a list form is a combiner call
-(list . (symbol) @function)
-
-; highlight symbols as vars only when they're clearly vars
-(cons (symbol) @variable)
-(scope (symbol) @variable)
-(path form: (symbol) @variable)
-(symbind form: (symbol) @variable)
diff --git a/runtime/queries/bitbake/highlights.scm b/runtime/queries/bitbake/highlights.scm
index 6e8ab0cf..7b37a79b 100644
--- a/runtime/queries/bitbake/highlights.scm
+++ b/runtime/queries/bitbake/highlights.scm
@@ -23,8 +23,8 @@
] @operator
-(variable_expansion [ "${" "}" ] @punctuation.special)
[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket
+(variable_expansion [ "${" "}" ] @punctuation.special)
[
"noexec"
diff --git a/runtime/queries/c/highlights.scm b/runtime/queries/c/highlights.scm
index 07915f4e..e48e45ab 100644
--- a/runtime/queries/c/highlights.scm
+++ b/runtime/queries/c/highlights.scm
@@ -1,3 +1,9 @@
+
+(identifier) @variable
+
+((identifier) @constant
+ (#match? @constant "^[A-Z][A-Z\\d_]*$"))
+
"sizeof" @keyword
[
@@ -109,6 +115,12 @@
(char_literal) @constant.character
(escape_sequence) @constant.character.escape
+(field_identifier) @variable.other.member
+(statement_identifier) @label
+(type_identifier) @type
+(primitive_type) @type.builtin
+(sized_type_specifier) @type.builtin
+
(call_expression
function: (identifier) @function)
(call_expression
@@ -128,15 +140,4 @@
(attribute
name: (identifier) @attribute)
-(field_identifier) @variable.other.member
-(statement_identifier) @label
-(type_identifier) @type
-(primitive_type) @type.builtin
-(sized_type_specifier) @type.builtin
-
-((identifier) @constant
- (#match? @constant "^[A-Z][A-Z\\d_]*$"))
-
-(identifier) @variable
-
(comment) @comment
diff --git a/runtime/queries/capnp/highlights.scm b/runtime/queries/capnp/highlights.scm
index 27ddf8e2..34b023be 100644
--- a/runtime/queries/capnp/highlights.scm
+++ b/runtime/queries/capnp/highlights.scm
@@ -1,7 +1,9 @@
; Preproc
-(unique_id) @keyword.directive
-(top_level_annotation_body) @keyword.directive
+[
+ (unique_id)
+ (top_level_annotation_body)
+] @keyword.directive
; Includes
@@ -9,6 +11,7 @@
"import"
"$import"
"embed"
+ "using"
] @keyword.control.import
(import_path) @string
@@ -84,10 +87,10 @@
"union"
] @keyword.storage.type
+"extends" @keyword
+
[
- "extends"
"namespace"
- "using"
(annotation_target)
] @special
diff --git a/runtime/queries/cel/highlights.scm b/runtime/queries/cel/highlights.scm
index ab3bae5a..73770752 100644
--- a/runtime/queries/cel/highlights.scm
+++ b/runtime/queries/cel/highlights.scm
@@ -22,16 +22,10 @@
"in"
] @keyword
-; Function calls
-
-(call_expression
- function: (identifier) @function)
-
-(member_call_expression
- function: (identifier) @function)
-
; Identifiers
+(identifier) @variable.other.member
+
(select_expression
operand: (identifier) @type)
@@ -39,7 +33,13 @@
operand: (select_expression
member: (identifier) @type))
-(identifier) @variable.other.member
+; Function calls
+
+(call_expression
+ function: (identifier) @function)
+
+(member_call_expression
+ function: (identifier) @function)
; Literals
diff --git a/runtime/queries/clojure/highlights.scm b/runtime/queries/clojure/highlights.scm
index 1441ea97..8155e6e3 100644
--- a/runtime/queries/clojure/highlights.scm
+++ b/runtime/queries/clojure/highlights.scm
@@ -10,6 +10,14 @@
(comment) @comment
+;; other symbols
+(sym_lit) @variable
+
+;; other calls
+(list_lit
+ .
+ (sym_lit) @function)
+
;; metadata experiment
(meta_lit
marker: "^" @punctuation)
@@ -61,20 +69,12 @@
((sym_lit) @operator
(#match? @operator "^%"))
-;; other calls
-(list_lit
- .
- (sym_lit) @function)
-
;; interop-ish
(list_lit
.
(sym_lit) @function.method
(#match? @function.method "^\\."))
-;; other symbols
-(sym_lit) @variable
-
;; quote
(quoting_lit) @constant.character.escape
diff --git a/runtime/queries/comment/highlights.scm b/runtime/queries/comment/highlights.scm
index e88288d5..56c1fd7d 100644
--- a/runtime/queries/comment/highlights.scm
+++ b/runtime/queries/comment/highlights.scm
@@ -1,34 +1,34 @@
+(tag
+ (name) @ui.text
+ (user)? @constant)
+
; Hint level tags
((tag (name) @hint)
- (#match? @hint "^(HINT|MARK|PASSED|STUB|MOCK)$"))
+ (#any-of? @hint "HINT" "MARK" "PASSED" "STUB" "MOCK"))
("text" @hint
- (#match? @hint "^(HINT|MARK|PASSED|STUB|MOCK)$"))
+ (#any-of? @hint "HINT" "MARK" "PASSED" "STUB" "MOCK"))
; Info level tags
((tag (name) @info)
- (#match? @info "^(INFO|NOTE|TODO|PERF|OPTIMIZE|PERFORMANCE|QUESTION|ASK)$"))
+ (#any-of? @info "INFO" "NOTE" "TODO" "PERF" "OPTIMIZE" "PERFORMANCE" "QUESTION" "ASK"))
("text" @info
- (#match? @info "^(INFO|NOTE|TODO|PERF|OPTIMIZE|PERFORMANCE|QUESTION|ASK)$"))
+ (#any-of? @info "INFO" "NOTE" "TODO" "PERF" "OPTIMIZE" "PERFORMANCE" "QUESTION" "ASK"))
; Warning level tags
((tag (name) @warning)
- (#match? @warning "^(HACK|WARN|WARNING|TEST|TEMP)$"))
+ (#any-of? @warning "HACK" "WARN" "WARNING" "TEST" "TEMP"))
("text" @warning
- (#match? @warning "^(HACK|WARN|WARNING|TEST|TEMP)$"))
+ (#any-of? @warning "HACK" "WARN" "WARNING" "TEST" "TEMP"))
; Error level tags
((tag (name) @error)
- (#match? @error "^(BUG|FIXME|ISSUE|XXX|FIX|SAFETY|FIXIT|FAILED|DEBUG|INVARIANT|COMPLIANCE)$"))
+ (#any-of? @error "BUG" "FIXME" "ISSUE" "XXX" "FIX" "SAFETY" "FIXIT" "FAILED" "DEBUG" "INVARIANT" "COMPLIANCE"))
("text" @error
- (#match? @error "^(BUG|FIXME|ISSUE|XXX|FIX|SAFETY|FIXIT|FAILED|DEBUG|INVARIANT|COMPLIANCE)$"))
-
-(tag
- (name) @ui.text
- (user)? @constant)
+ (#any-of? @error "BUG" "FIXME" "ISSUE" "XXX" "FIX" "SAFETY" "FIXIT" "FAILED" "DEBUG" "INVARIANT" "COMPLIANCE"))
; Issue number (#123)
("text" @constant.numeric
diff --git a/runtime/queries/cpp/highlights.scm b/runtime/queries/cpp/highlights.scm
index c1d14a0b..291163d3 100644
--- a/runtime/queries/cpp/highlights.scm
+++ b/runtime/queries/cpp/highlights.scm
@@ -1,3 +1,26 @@
+; inherits: c
+
+; Constants
+
+(this) @variable.builtin
+(nullptr) @constant.builtin
+
+; Types
+
+(using_declaration ("using" "namespace" (identifier) @namespace))
+(using_declaration ("using" "namespace" (qualified_identifier name: (identifier) @namespace)))
+(namespace_definition name: (namespace_identifier) @namespace)
+(namespace_identifier) @namespace
+
+(qualified_identifier name: (identifier) @type.enum.variant)
+
+(auto) @type
+"decltype" @type
+
+(ref_qualifier ["&" "&&"] @type.builtin)
+(reference_declarator ["&" "&&"] @type.builtin)
+(abstract_reference_declarator ["&" "&&"] @type.builtin)
+
; Functions
; These casts are parsed as function calls, but are not.
@@ -28,27 +51,6 @@
(function_declarator
declarator: (field_identifier) @function)
-; Types
-
-(using_declaration ("using" "namespace" (identifier) @namespace))
-(using_declaration ("using" "namespace" (qualified_identifier name: (identifier) @namespace)))
-(namespace_definition name: (namespace_identifier) @namespace)
-(namespace_identifier) @namespace
-
-(qualified_identifier name: (identifier) @type.enum.variant)
-
-(auto) @type
-"decltype" @type
-
-(ref_qualifier ["&" "&&"] @type.builtin)
-(reference_declarator ["&" "&&"] @type.builtin)
-(abstract_reference_declarator ["&" "&&"] @type.builtin)
-
-; Constants
-
-(this) @variable.builtin
-(nullptr) @constant.builtin
-
; Parameters
(parameter_declaration
@@ -132,5 +134,3 @@
; Strings
(raw_string_literal) @string
-
-; inherits: c
diff --git a/runtime/queries/css/highlights.scm b/runtime/queries/css/highlights.scm
index b5262e8f..ee85d141 100644
--- a/runtime/queries/css/highlights.scm
+++ b/runtime/queries/css/highlights.scm
@@ -28,6 +28,9 @@
"or"
] @keyword.operator
+(property_name) @variable.other.member
+(plain_value) @constant
+
((property_name) @variable
(#match? @variable "^--"))
((plain_value) @variable
@@ -39,7 +42,6 @@
(function_name) @function
(id_name) @label
(namespace_name) @namespace
-(property_name) @variable.other.member
[
"@charset"
@@ -81,5 +83,3 @@
":"
"::"
] @punctuation.delimiter
-
-(plain_value) @constant
diff --git a/runtime/queries/cue/highlights.scm b/runtime/queries/cue/highlights.scm
index aef016e8..4168036b 100644
--- a/runtime/queries/cue/highlights.scm
+++ b/runtime/queries/cue/highlights.scm
@@ -1,12 +1,46 @@
-(package_clause "package" @keyword.control.import)
+; Includes
+[
+ "package"
+ "import"
+] @keyword.control.import
-(package_identifier) @variable
+; Namespaces
+(package_identifier) @namespace
-(import_declaration "import" @keyword.control.import)
+(import_spec
+ [
+ "."
+ "_"
+ ] @punctuation.special)
[
- "!"
+ (attr_path)
+ (package_path)
+] @string.special.url ; In attributes
+
+; Attributes
+(attribute) @attribute
+
+; Conditionals
+"if" @keyword.control.conditional
+
+; Repeats
+"for" @keyword.control.repeat
+
+(for_clause
+ "_" @punctuation.special)
+
+; Keywords
+"let" @keyword
+
+"in" @keyword.operator
+
+; Operators
+[
+ "+"
+ "-"
"*"
+ "/"
"|"
"&"
"||"
@@ -19,92 +53,103 @@
">="
"=~"
"!~"
- "+"
- "-"
- "*"
- "/"
+ "!"
+ "="
] @operator
-(unary_expression "*" @operator.default)
-
-(unary_expression "=~" @operator.regexp)
-
-(unary_expression "!~" @operator.regexp)
-
-(binary_expression _ "&" @operator.unify _)
-
-(binary_expression _ "|" @operator.disjunct _)
+; Fields & Properties
+(field
+ (label
+ (identifier) @variable.other.member))
-(builtin) @function.builtin
+(selector_expression
+ (_)
+ (identifier) @variable.other.member)
-(qualified_identifier) @function.builtin
+; Functions
+(call_expression
+ function: (identifier) @function)
-(let_clause "let" @keyword.storage.type)
+(call_expression
+ function: (selector_expression
+ (_)
+ (identifier) @function))
-(for_clause "for" @keyword.control.repeat)
-(for_clause "in" @keyword.control.repeat)
+(call_expression
+ function: (builtin_function) @function)
-(guard_clause "if" @keyword.control.conditional)
+(builtin_function) @function.builtin
-(comment) @comment
+; Variables
+(identifier) @variable
-[
- (string_type)
- (simple_string_lit)
- (multiline_string_lit)
- (bytes_type)
- (simple_bytes_lit)
- (multiline_bytes_lit)
-] @string
+; Types
+(primitive_type) @type.builtin
-[
- (number_type)
- (int_lit)
- (int_type)
- (uint_type)
-] @constant.numeric.integer
+((identifier) @type
+ (#match? @type "^_?#"))
[
- (float_lit)
- (float_type)
-] @constant.numeric.float
-
-[
- (bool_type)
- (true)
- (false)
-] @constant.builtin.boolean
-
-(null) @constant.builtin
-
-(ellipsis) @punctuation.bracket
+ (slice_type)
+ (pointer_type)
+] @type ; In attributes
+; Punctuation
[
","
":"
] @punctuation.delimiter
[
- "("
- ")"
- "["
- "]"
"{"
"}"
+ "["
+ "]"
+ "("
+ ")"
+ "<"
+ ">"
] @punctuation.bracket
-(interpolation "\\(" @punctuation.bracket (_) ")" @punctuation.bracket) @variable.other.member
+[
+ (ellipsis)
+ "?"
+] @punctuation.special
+
+; Literals
+(string) @string
-(field (label (identifier) @variable.other.member))
+[
+ (escape_char)
+ (escape_unicode)
+] @constant.character.escape
-(
- (identifier) @keyword.storage.type
- (#match? @keyword.storage.type "^#")
-)
+(number) @constant.numeric
-(field (label alias: (identifier) @label))
+(float) @constant.numeric.float
-(let_clause left: (identifier) @label)
+(si_unit
+ (float)
+ (_) @string.special.symbol)
+(boolean) @constant.builtin.boolean
-(attribute (identifier) @tag)
+[
+ (null)
+ (top)
+ (bottom)
+] @constant.builtin
+
+; Interpolations
+(interpolation
+ "\\(" @punctuation.special
+ (_)
+ ")" @punctuation.special)
+
+(interpolation
+ "\\("
+ (identifier) @variable
+ ")")
+
+; Comments
+(comment) @comment
diff --git a/runtime/queries/d/highlights.scm b/runtime/queries/d/highlights.scm
index b5db8431..ee16c901 100644
--- a/runtime/queries/d/highlights.scm
+++ b/runtime/queries/d/highlights.scm
@@ -217,6 +217,8 @@
(cfloat)
] @warning ; these types are deprecated
+(identifier) @variable
+
(label (identifier) @label)
(goto_statement (goto) @keyword (identifier) @label)
@@ -224,7 +226,6 @@
(int_literal) @constant.numeric.integer
(float_literal) @constant.numeric.float
(char_literal) @constant.character
-(identifier) @variable
(at_attribute) @attribute
; everything after __EOF_ is plain text
diff --git a/runtime/queries/devicetree/highlights.scm b/runtime/queries/devicetree/highlights.scm
index d27c79e4..b9b29fe2 100644
--- a/runtime/queries/devicetree/highlights.scm
+++ b/runtime/queries/devicetree/highlights.scm
@@ -51,14 +51,14 @@
(integer_literal) @constant.numeric.integer
+(identifier) @variable
+
(call_expression
function: (identifier) @function)
(labeled_item
label: (identifier) @label)
-(identifier) @variable
-
(unit_address) @tag
(reference) @constant
diff --git a/runtime/queries/dockerfile/highlights.scm b/runtime/queries/dockerfile/highlights.scm
index 51398e59..7e638ecb 100644
--- a/runtime/queries/dockerfile/highlights.scm
+++ b/runtime/queries/dockerfile/highlights.scm
@@ -44,6 +44,15 @@
(heredoc_line)
] @string
+[
+ (heredoc_marker)
+ (heredoc_end)
+] @label
+
+((heredoc_block
+ (heredoc_line) @string)
+ (#set! "priority" 90))
+
(expansion
[
"$"
@@ -59,3 +68,6 @@
(param)
(mount_param)
] @constant
+
+(expose_instruction
+ (expose_port) @constant.numeric.integer)
diff --git a/runtime/queries/dot/highlights.scm b/runtime/queries/dot/highlights.scm
index 6ad64d28..eefb81f9 100644
--- a/runtime/queries/dot/highlights.scm
+++ b/runtime/queries/dot/highlights.scm
@@ -1,3 +1,5 @@
+(identifier) @variable
+
(keyword) @keyword
(string_literal) @string
(number_literal) @constant.numeric
@@ -33,11 +35,9 @@
(identifier) @constant)
)
-[
- (comment)
- (preproc)
-] @comment
+(comment) @comment
+
+(preproc) @keyword.directive
(ERROR) @error
-(identifier) @variable
diff --git a/runtime/queries/ecma/highlights.scm b/runtime/queries/ecma/highlights.scm
index b8df07a5..d56bbe14 100644
--- a/runtime/queries/ecma/highlights.scm
+++ b/runtime/queries/ecma/highlights.scm
@@ -1,148 +1,6 @@
-; Special identifiers
-;--------------------
-
-([
- (identifier)
- (shorthand_property_identifier)
- (shorthand_property_identifier_pattern)
- ] @constant
- (#match? @constant "^[A-Z_][A-Z\\d_]+$"))
-
-
-((identifier) @constructor
- (#match? @constructor "^[A-Z]"))
-
-((identifier) @variable.builtin
- (#match? @variable.builtin "^(arguments|module|console|window|document)$")
- (#is-not? local))
-
-(call_expression
- (identifier) @function.builtin
- (#any-of? @function.builtin
- "eval"
- "fetch"
- "isFinite"
- "isNaN"
- "parseFloat"
- "parseInt"
- "decodeURI"
- "decodeURIComponent"
- "encodeURI"
- "encodeURIComponent"
- "require"
- "alert"
- "prompt"
- "btoa"
- "atob"
- "confirm"
- "structuredClone"
- "setTimeout"
- "clearTimeout"
- "setInterval"
- "clearInterval"
- "queueMicrotask")
- (#is-not? local))
-
-; Function and method definitions
-;--------------------------------
-
-(function
- name: (identifier) @function)
-(function_declaration
- name: (identifier) @function)
-(method_definition
- name: (property_identifier) @function.method)
-(method_definition
- name: (private_property_identifier) @function.method.private)
-
-(pair
- key: (property_identifier) @function.method
- value: [(function) (arrow_function)])
-(pair
- key: (private_property_identifier) @function.method.private
- value: [(function) (arrow_function)])
-
-(assignment_expression
- left: (member_expression
- property: (property_identifier) @function.method)
- right: [(function) (arrow_function)])
-(assignment_expression
- left: (member_expression
- property: (private_property_identifier) @function.method.private)
- right: [(function) (arrow_function)])
-
-(variable_declarator
- name: (identifier) @function
- value: [(function) (arrow_function)])
-
-(assignment_expression
- left: (identifier) @function
- right: [(function) (arrow_function)])
-
-; Function and method parameters
-;-------------------------------
-
-; Arrow function parameters in the form `p => ...` are supported by both
-; javascript and typescript grammars without conflicts.
-(arrow_function
- parameter: (identifier) @variable.parameter)
-
-; Function and method calls
-;--------------------------
-
-(call_expression
- function: (identifier) @function)
-
-(call_expression
- function: (member_expression
- property: (property_identifier) @function.method))
-(call_expression
- function: (member_expression
- property: (private_property_identifier) @function.method.private))
-
-; Variables
-;----------
-
-(identifier) @variable
-
-; Properties
-;-----------
-
-(property_identifier) @variable.other.member
-(private_property_identifier) @variable.other.member.private
-(shorthand_property_identifier) @variable.other.member
-(shorthand_property_identifier_pattern) @variable.other.member
-
-; Literals
-;---------
-
-(this) @variable.builtin
-(super) @variable.builtin
-
-[
- (true)
- (false)
- (null)
- (undefined)
-] @constant.builtin
-
-(comment) @comment
-
-[
- (string)
- (template_string)
-] @string
-
-(regex) @string.regexp
-(number) @constant.numeric.integer
-
; Tokens
;-------
-(template_substitution
- "${" @punctuation.special
- "}" @punctuation.special) @embedded
-
[
";"
(optional_chain) ; ?.
@@ -209,6 +67,10 @@
"}"
] @punctuation.bracket
+(template_substitution
+ "${" @punctuation.special
+ "}" @punctuation.special) @embedded
+
[
"async"
"debugger"
@@ -283,3 +145,139 @@
"catch"
] @keyword.control.exception
+; Variables
+;----------
+
+(identifier) @variable
+
+; Properties
+;-----------
+
+(property_identifier) @variable.other.member
+(private_property_identifier) @variable.other.member.private
+(shorthand_property_identifier) @variable.other.member
+(shorthand_property_identifier_pattern) @variable.other.member
+
+; Function and method definitions
+;--------------------------------
+
+(function
+ name: (identifier) @function)
+(function_declaration
+ name: (identifier) @function)
+(method_definition
+ name: (property_identifier) @function.method)
+(method_definition
+ name: (private_property_identifier) @function.method.private)
+
+(pair
+ key: (property_identifier) @function.method
+ value: [(function) (arrow_function)])
+(pair
+ key: (private_property_identifier) @function.method.private
+ value: [(function) (arrow_function)])
+
+(assignment_expression
+ left: (member_expression
+ property: (property_identifier) @function.method)
+ right: [(function) (arrow_function)])
+(assignment_expression
+ left: (member_expression
+ property: (private_property_identifier) @function.method.private)
+ right: [(function) (arrow_function)])
+
+(variable_declarator
+ name: (identifier) @function
+ value: [(function) (arrow_function)])
+
+(assignment_expression
+ left: (identifier) @function
+ right: [(function) (arrow_function)])
+
+; Function and method parameters
+;-------------------------------
+
+; Arrow function parameters in the form `p => ...` are supported by both
+; javascript and typescript grammars without conflicts.
+(arrow_function
+ parameter: (identifier) @variable.parameter)
+
+; Function and method calls
+;--------------------------
+
+(call_expression
+ function: (identifier) @function)
+
+(call_expression
+ function: (member_expression
+ property: (property_identifier) @function.method))
+(call_expression
+ function: (member_expression
+ property: (private_property_identifier) @function.method.private))
+
+; Literals
+;---------
+
+(this) @variable.builtin
+(super) @variable.builtin
+
+[
+ (true)
+ (false)
+ (null)
+ (undefined)
+] @constant.builtin
+
+(comment) @comment
+
+[
+ (string)
+ (template_string)
+] @string
+
+(regex) @string.regexp
+(number) @constant.numeric.integer
+
+; Special identifiers
+;--------------------
+
+((identifier) @constructor
+ (#match? @constructor "^[A-Z]"))
+
+([
+ (identifier)
+ (shorthand_property_identifier)
+ (shorthand_property_identifier_pattern)
+ ] @constant
+ (#match? @constant "^[A-Z_][A-Z\\d_]+$"))
+
+((identifier) @variable.builtin
+ (#match? @variable.builtin "^(arguments|module|console|window|document)$")
+ (#is-not? local))
+
+(call_expression
+ (identifier) @function.builtin
+ (#any-of? @function.builtin
+ "eval"
+ "fetch"
+ "isFinite"
+ "isNaN"
+ "parseFloat"
+ "parseInt"
+ "decodeURI"
+ "decodeURIComponent"
+ "encodeURI"
+ "encodeURIComponent"
+ "require"
+ "alert"
+ "prompt"
+ "btoa"
+ "atob"
+ "confirm"
+ "structuredClone"
+ "setTimeout"
+ "clearTimeout"
+ "setInterval"
+ "clearInterval"
+ "queueMicrotask")
+ (#is-not? local))
diff --git a/runtime/queries/edoc/highlights.scm b/runtime/queries/edoc/highlights.scm
index 5bab7992..66b3ccf9 100644
--- a/runtime/queries/edoc/highlights.scm
+++ b/runtime/queries/edoc/highlights.scm
@@ -16,8 +16,8 @@
(section_marker) @markup.heading.marker)
(#eq? @markup.heading.marker "===="))
-(macro (tag) @function.macro)
(tag) @keyword
+(macro (tag) @function.macro)
(macro_escape) @constant.character.escape
(inline_quote) @markup.raw.inline
(email_address) @markup.link.url
diff --git a/runtime/queries/elisp/highlights.scm b/runtime/queries/elisp/highlights.scm
index 1639168b..648c0221 100644
--- a/runtime/queries/elisp/highlights.scm
+++ b/runtime/queries/elisp/highlights.scm
@@ -26,6 +26,8 @@
"while"
] @keyword
+(string) @string
+
;; Function definitions
[
"defun"
@@ -47,8 +49,6 @@
(float) @constant.numeric.float
(char) @constant.character
-(string) @string
-
[
"("
")"
diff --git a/runtime/queries/elixir/highlights.scm b/runtime/queries/elixir/highlights.scm
index db4c6476..c93accd0 100644
--- a/runtime/queries/elixir/highlights.scm
+++ b/runtime/queries/elixir/highlights.scm
@@ -15,80 +15,56 @@
; See the License for the specific language governing permissions and
; limitations under the License.
-; Reserved keywords
-
-["when" "and" "or" "not" "in" "not in" "fn" "do" "end" "catch" "rescue" "after" "else"] @keyword
-
-; Operators
-
-; * doc string
-(unary_operator
- operator: "@" @comment.block.documentation
- operand: (call
- target: (identifier) @comment.block.documentation.__attribute__
- (arguments
- [
- (string) @comment.block.documentation
- (charlist) @comment.block.documentation
- (sigil
- quoted_start: _ @comment.block.documentation
- quoted_end: _ @comment.block.documentation) @comment.block.documentation
- (boolean) @comment.block.documentation
- ]))
- (#any-of? @comment.block.documentation.__attribute__ "moduledoc" "typedoc" "doc"))
-
-; * module attribute
-(unary_operator
- operator: "@" @variable.other.member
- operand: [
- (identifier) @variable.other.member
- (call
- target: (identifier) @variable.other.member)
- (boolean) @variable.other.member
- (nil) @variable.other.member
- ])
-
-; * capture operator
-(unary_operator
- operator: "&"
- operand: [
- (integer) @operator
- (binary_operator
- left: [
- (call target: (dot left: (_) right: (identifier) @function))
- (identifier) @function
- ] operator: "/" right: (integer) @operator)
- ])
-
-(operator_identifier) @operator
-
-(unary_operator
- operator: _ @operator)
+; Punctuation
-(binary_operator
- operator: _ @operator)
+[
+ "%"
+] @punctuation
-(dot
- operator: _ @operator)
+[
+ ","
+ ";"
+] @punctuation.delimiter
-(stab_clause
- operator: _ @operator)
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+ "<<"
+ ">>"
+] @punctuation.bracket
; Literals
-(nil) @constant.builtin
-
(boolean) @constant.builtin.boolean
+(nil) @constant.builtin
(integer) @constant.numeric.integer
(float) @constant.numeric.float
+(char) @constant.character
-(alias) @namespace
+; Identifiers
-(call
- target: (dot
- left: (atom) @namespace))
+; * regular
+(identifier) @variable
-(char) @constant.character
+; * unused
+(
+ (identifier) @comment.unused
+ (#match? @comment.unused "^_")
+)
+
+; * special
+(
+ (identifier) @constant.builtin
+ (#any-of? @constant.builtin "__MODULE__" "__DIR__" "__ENV__" "__CALLER__" "__STACKTRACE__")
+)
+
+; Comment
+
+(comment) @comment
; Quoted content
@@ -97,38 +73,63 @@
(escape_sequence) @constant.character.escape
[
+ (string)
+ (charlist)
+] @string
+
+[
(atom)
(quoted_atom)
(keyword)
(quoted_keyword)
] @string.special.symbol
-[
- (string)
- (charlist)
-] @string
-
; Note that we explicitly target sigil quoted start/end, so they are not overridden by delimiters
(sigil
(sigil_name) @__name__
- quoted_start: _ @string
- quoted_end: _ @string
- (#any-of? @__name__ "s" "S")) @string
+ quoted_start: _ @string.special
+ quoted_end: _ @string.special) @string.special
(sigil
(sigil_name) @__name__
- quoted_start: _ @string.regexp
- quoted_end: _ @string.regexp
- (#any-of? @__name__ "r" "R")) @string.regexp
+ quoted_start: _ @string
+ quoted_end: _ @string
+ (#match? @__name__ "^[sS]$")) @string
(sigil
(sigil_name) @__name__
- quoted_start: _ @string.special
- quoted_end: _ @string.special) @string.special
+ quoted_start: _ @string.regex
+ quoted_end: _ @string.regex
+ (#match? @__name__ "^[rR]$")) @string.regex
; Calls
+; * local function call
+(call
+ target: (identifier) @function)
+
+; * remote function call
+(call
+ target: (dot
+ right: (identifier) @function))
+
+; * field without parentheses or block
+(call
+ target: (dot
+ right: (identifier) @variable.other.member)
+ .)
+
+; * remote call without parentheses or block (overrides above)
+(call
+ target: (dot
+ left: [
+ (alias)
+ (atom)
+ ]
+ right: (identifier) @function)
+ .)
+
; * definition keyword
(call
target: (identifier) @keyword
@@ -137,17 +138,7 @@
; * kernel or special forms keyword
(call
target: (identifier) @keyword
- (#any-of? @keyword "alias" "case" "cond" "else" "for" "if" "import" "quote" "raise" "receive" "require" "reraise" "super" "throw" "try" "unless" "unquote" "unquote_splicing" "use" "with"))
-
-; * function call
-(call
- target: [
- ; local
- (identifier) @function
- ; remote
- (dot
- right: (identifier) @function)
- ])
+ (#any-of? @keyword "alias" "case" "cond" "for" "if" "import" "quote" "raise" "receive" "require" "reraise" "super" "throw" "try" "unless" "unquote" "unquote_splicing" "use" "with"))
; * just identifier in function definition
(call
@@ -161,6 +152,11 @@
])
(#any-of? @keyword "def" "defdelegate" "defguard" "defguardp" "defmacro" "defmacrop" "defn" "defnp" "defp"))
+; * pipe into identifier (function call)
+(binary_operator
+ operator: "|>"
+ right: (identifier) @function)
+
; * pipe into identifier (definition)
(call
target: (identifier) @keyword
@@ -170,50 +166,76 @@
right: (identifier) @variable))
(#any-of? @keyword "def" "defdelegate" "defguard" "defguardp" "defmacro" "defmacrop" "defn" "defnp" "defp"))
-; * pipe into identifier (function call)
+; * pipe into field without parentheses (function call)
(binary_operator
operator: "|>"
- right: (identifier) @function)
+ right: (call
+ target: (dot
+ right: (identifier) @function)))
-; Identifiers
+; Operators
-; * special
-(
- (identifier) @constant.builtin
- (#any-of? @constant.builtin "__MODULE__" "__DIR__" "__ENV__" "__CALLER__" "__STACKTRACE__")
-)
+; * capture operand
+(unary_operator
+ operator: "&"
+ operand: [
+ (integer) @operator
+ (binary_operator
+ left: [
+ (call target: (dot left: (_) right: (identifier) @function))
+ (identifier) @function
+ ] operator: "/" right: (integer) @operator)
+ ])
-; * unused
-(
- (identifier) @comment
- (#match? @comment "^_")
-)
+(operator_identifier) @operator
-; * regular
-(identifier) @variable
+(unary_operator
+ operator: _ @operator)
-; Comment
+(binary_operator
+ operator: _ @operator)
-(comment) @comment
+(dot
+ operator: _ @operator)
-; Punctuation
+(stab_clause
+ operator: _ @operator)
-[
- "%"
-] @punctuation
+; * module attribute
+(unary_operator
+ operator: "@" @variable.other.member
+ operand: [
+ (identifier) @variable.other.member
+ (call
+ target: (identifier) @variable.other.member)
+ (boolean) @variable.other.member
+ (nil) @variable.other.member
+ ])
-[
- ","
- ";"
-] @punctuation.delimiter
+; * doc string
+(unary_operator
+ operator: "@" @comment.block.documentation
+ operand: (call
+ target: (identifier) @comment.block.documentation.__attribute__
+ (arguments
+ [
+ (string) @comment.block.documentation
+ (charlist) @comment.block.documentation
+ (sigil
+ quoted_start: _ @comment.block.documentation
+ quoted_end: _ @comment.block.documentation) @comment.block.documentation
+ (boolean) @comment.block.documentation
+ ]))
+ (#any-of? @comment.block.documentation.__attribute__ "moduledoc" "typedoc" "doc"))
-[
- "("
- ")"
- "["
- "]"
- "{"
- "}"
- "<<"
- ">>"
-] @punctuation.bracket
+; Module
+
+(alias) @namespace
+
+(call
+ target: (dot
+ left: (atom) @namespace))
+
+; Reserved keywords
+
+["when" "and" "or" "not" "in" "not in" "fn" "do" "end" "catch" "rescue" "after" "else"] @keyword
diff --git a/runtime/queries/elvish/highlights.scm b/runtime/queries/elvish/highlights.scm
index fd70488d..af26d5c2 100644
--- a/runtime/queries/elvish/highlights.scm
+++ b/runtime/queries/elvish/highlights.scm
@@ -63,13 +63,13 @@
(number) @constant.numeric
(string) @string
+(variable (identifier) @variable)
((variable (identifier) @function)
(#match? @function ".+\\~$"))
((variable (identifier) @constant.builtin.boolean)
(#match? @constant.builtin.boolean "(true|false)"))
((variable (identifier) @constant.builtin)
(#match? @constant.builtin "(_|after-chdir|args|before-chdir|buildinfo|nil|notify-bg-job-success|num-bg-jobs|ok|paths|pid|pwd|value-out-indicator|version)"))
-(variable (identifier) @variable)
["$" "@"] @punctuation.special
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
diff --git a/runtime/queries/erlang/highlights.scm b/runtime/queries/erlang/highlights.scm
index f09f6104..041fb021 100644
--- a/runtime/queries/erlang/highlights.scm
+++ b/runtime/queries/erlang/highlights.scm
@@ -1,3 +1,45 @@
+; Comments
+(tripledot) @comment.discard
+
+[(comment) (line_comment) (shebang)] @comment
+
+; Basic types
+(variable) @variable
+((atom) @constant.builtin.boolean
+ (#match? @constant.builtin.boolean "^(true|false)$"))
+(atom) @string.special.symbol
+[(string) (sigil)] @string
+(character) @constant.character
+(escape_sequence) @constant.character.escape
+
+(integer) @constant.numeric.integer
+(float) @constant.numeric.float
+
+; Punctuation
+["," "." "-" ";"] @punctuation.delimiter
+["(" ")" "#" "{" "}" "[" "]" "<<" ">>"] @punctuation.bracket
+
+; Operators
+(binary_operator
+ left: (atom) @function
+ operator: "/"
+ right: (integer) @constant.numeric.integer)
+
+((binary_operator operator: _ @keyword.operator)
+ (#match? @keyword.operator "^\\w+$"))
+((unary_operator operator: _ @keyword.operator)
+ (#match? @keyword.operator "^\\w+$"))
+
+(binary_operator operator: _ @operator)
+(unary_operator operator: _ @operator)
+["/" ":" "->"] @operator
+
+
+; Keywords
+(attribute name: (atom) @keyword)
+
+["case" "fun" "if" "of" "when" "end" "receive" "try" "catch" "after" "begin" "maybe"] @keyword
+
; Attributes
; module declaration
(attribute
@@ -122,46 +164,3 @@
(record field: (atom) @variable.other.member)
(record name: (atom) @type)
-
-; Keywords
-(attribute name: (atom) @keyword)
-
-["case" "fun" "if" "of" "when" "end" "receive" "try" "catch" "after" "begin" "maybe"] @keyword
-
-; Operators
-(binary_operator
- left: (atom) @function
- operator: "/"
- right: (integer) @constant.numeric.integer)
-
-((binary_operator operator: _ @keyword.operator)
- (#match? @keyword.operator "^\\w+$"))
-((unary_operator operator: _ @keyword.operator)
- (#match? @keyword.operator "^\\w+$"))
-
-(binary_operator operator: _ @operator)
-(unary_operator operator: _ @operator)
-["/" ":" "->"] @operator
-
-; Comments
-(tripledot) @comment.discard
-
-[(comment) (line_comment) (shebang)] @comment
-
-; Basic types
-(variable) @variable
-((atom) @constant.builtin.boolean
- (#match? @constant.builtin.boolean "^(true|false)$"))
-(atom) @string.special.symbol
-[(string) (sigil)] @string
-(character) @constant.character
-(escape_sequence) @constant.character.escape
-
-(integer) @constant.numeric.integer
-(float) @constant.numeric.float
-
-; Punctuation
-["," "." "-" ";"] @punctuation.delimiter
-["(" ")" "#" "{" "}" "[" "]" "<<" ">>"] @punctuation.bracket
-
-; (ERROR) @error
diff --git a/runtime/queries/esdl/highlights.scm b/runtime/queries/esdl/highlights.scm
index 7dfde022..a009933f 100644
--- a/runtime/queries/esdl/highlights.scm
+++ b/runtime/queries/esdl/highlights.scm
@@ -18,6 +18,8 @@
"function"
] @keyword
+(identifier) @variable
+
(modifier) @keyword
(extending) @keyword
@@ -31,7 +33,6 @@
(link) @variable.other.member
(annotation) @variable.other.member
-(identifier) @variable
(string) @string
(edgeql_fragment) @string
; Builtins
@@ -56,8 +57,8 @@
"anytype"
] @type.builtin
-(true) @constant.builtin
-(false) @constant.builtin
+(true) @constant.builtin.boolean
+(false) @constant.builtin.boolean
(null) @constant.builtin
; Delimiters
diff --git a/runtime/queries/fish/highlights.scm b/runtime/queries/fish/highlights.scm
index d9b5b427..b5668e7b 100644
--- a/runtime/queries/fish/highlights.scm
+++ b/runtime/queries/fish/highlights.scm
@@ -94,6 +94,8 @@
;; Commands
+(command name: (word) @function)
+
(command
name: (word) @function.builtin (#match? @function.builtin "^test$")
argument: (word) @operator (#match? @operator "^(!?=|-[a-zA-Z]+)$"))
@@ -116,9 +118,6 @@
]
)
-; non-builtin command names
-(command name: (word) @function)
-
;; Functions
(function_definition ["function" "end"] @keyword.function)
diff --git a/runtime/queries/fortran/highlights.scm b/runtime/queries/fortran/highlights.scm
index 90f4ecd0..0901a4aa 100644
--- a/runtime/queries/fortran/highlights.scm
+++ b/runtime/queries/fortran/highlights.scm
@@ -112,6 +112,8 @@
"\\.neqv\\."
] @keyword.operator
+(identifier) @variable
+
;; Brackets
[
"("
@@ -163,7 +165,6 @@
(derived_type_member_expression
(type_member) @variable.other.member)
-(identifier) @variable
(string_literal) @string
(number_literal) @constant.numeric
(boolean_literal) @constant.builtin.boolean
diff --git a/runtime/queries/ghostty/highlights.scm b/runtime/queries/ghostty/highlights.scm
index aa31bbc3..4ae953e5 100644
--- a/runtime/queries/ghostty/highlights.scm
+++ b/runtime/queries/ghostty/highlights.scm
@@ -22,6 +22,11 @@
(":") @punctuation.delimiter
+[
+ (string)
+ (color)
+] @string
+
; (color) are hex values
(color "#" @punctuation.special
(#eq? @punctuation.special "#"))
@@ -44,18 +49,13 @@
(tuple "," @punctuation.delimiter.special
(#eq? @punctuation.delimiter.special ","))
-[
- (string)
- (color)
-] @string
+; `keybind`
+(keybind_value) @string.special
; clear is a special keyword that clear all existing keybind up to that point
((keybind_value) @keyword
(#eq? @keyword "clear"))
-; `keybind`
-(keybind_value) @string.special
-
; NOTE: The order here matters!
[
(key_qualifier)
diff --git a/runtime/queries/gjs/highlights.scm b/runtime/queries/gjs/highlights.scm
index 51983852..3e63dc79 100644
--- a/runtime/queries/gjs/highlights.scm
+++ b/runtime/queries/gjs/highlights.scm
@@ -1 +1 @@
-; inherits: _gjs,_javascript,ecma
+; inherits: ecma,_javascript,_gjs
diff --git a/runtime/queries/gleam/highlights.scm b/runtime/queries/gleam/highlights.scm
index b40574b0..961afc34 100644
--- a/runtime/queries/gleam/highlights.scm
+++ b/runtime/queries/gleam/highlights.scm
@@ -1,3 +1,7 @@
+; Variables
+(identifier) @variable
+(discard) @comment.unused
+
; Comments
(module_comment) @comment
(statement_comment) @comment
@@ -72,10 +76,6 @@
((identifier) @error
(#any-of? @error "auto" "delegate" "derive" "else" "implement" "macro" "test" "echo"))
-; Variables
-(identifier) @variable
-(discard) @comment.unused
-
; Keywords
[
(visibility_modifier) ; "pub"
diff --git a/runtime/queries/go/highlights.scm b/runtime/queries/go/highlights.scm
index 7dc20e69..0f9be048 100644
--- a/runtime/queries/go/highlights.scm
+++ b/runtime/queries/go/highlights.scm
@@ -1,8 +1,34 @@
-; Function calls
-(call_expression
- function: (identifier) @function.builtin
- (#match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)$"))
+; Identifiers
+
+(field_identifier) @variable.other.member
+
+(identifier) @variable
+
+(package_identifier) @namespace
+
+(parameter_declaration (identifier) @variable.parameter)
+(variadic_parameter_declaration (identifier) @variable.parameter)
+
+(const_spec
+ name: (identifier) @constant)
+
+(type_spec
+ name: (type_identifier) @constructor)
+
+(keyed_element (literal_element (identifier) @variable.other.member))
+(field_declaration
+ name: (field_identifier) @variable.other.member)
+
+(parameter_declaration (identifier) @variable.parameter)
+(variadic_parameter_declaration (identifier) @variable.parameter)
+
+(label_name) @label
+
+(const_spec
+ name: (identifier) @constant)
+
+; Function calls
(call_expression
function: (identifier) @function)
@@ -11,9 +37,14 @@
function: (selector_expression
field: (field_identifier) @function.method))
+(call_expression
+ function: (identifier) @function.builtin
+ (#match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)$"))
; Types
+(type_identifier) @type
+
(type_parameter_list
(parameter_declaration
name: (identifier) @type.parameter))
@@ -21,8 +52,6 @@
((type_identifier) @type.builtin
(#match? @type.builtin "^(any|bool|byte|comparable|complex128|complex64|error|float32|float64|int|int16|int32|int64|int8|rune|string|uint|uint16|uint32|uint64|uint8|uintptr)$"))
-(type_identifier) @type
-
; Function definitions
(function_declaration
@@ -34,28 +63,6 @@
(method_spec
name: (field_identifier) @function.method)
-; Identifiers
-
-(const_spec
- name: (identifier) @constant)
-
-(parameter_declaration (identifier) @variable.parameter)
-(variadic_parameter_declaration (identifier) @variable.parameter)
-
-(type_spec
- name: (type_identifier) @constructor)
-(field_identifier) @variable.other.member
-(keyed_element (literal_element (identifier) @variable.other.member))
-(identifier) @variable
-(package_identifier) @namespace
-
-(parameter_declaration (identifier) @variable.parameter)
-(variadic_parameter_declaration (identifier) @variable.parameter)
-
-(label_name) @label
-
-(const_spec
- name: (identifier) @constant)
; Operators
diff --git a/runtime/queries/gts/highlights.scm b/runtime/queries/gts/highlights.scm
index 5ad3ee1b..120e8f20 100644
--- a/runtime/queries/gts/highlights.scm
+++ b/runtime/queries/gts/highlights.scm
@@ -1 +1 @@
-; inherits: _gjs,_typescript,ecma
+; inherits: ecma,_typescript,_gjs
diff --git a/runtime/queries/hare/highlights.scm b/runtime/queries/hare/highlights.scm
index 5115328d..adaea14e 100644
--- a/runtime/queries/hare/highlights.scm
+++ b/runtime/queries/hare/highlights.scm
@@ -118,6 +118,8 @@
] @constant.builtin
(literal "void") @constant.builtin
+(identifier) @variable
+
(string_literal) @string
(escape_sequence) @constant.character.escape
(rune_literal) @string
@@ -138,5 +140,4 @@
(decl_attr) @special
(fndec_attrs) @special
-(identifier) @variable
(struct_union_field (name)) @variable
diff --git a/runtime/queries/haskell/highlights.scm b/runtime/queries/haskell/highlights.scm
index 8f079185..4178055c 100644
--- a/runtime/queries/haskell/highlights.scm
+++ b/runtime/queries/haskell/highlights.scm
@@ -280,6 +280,20 @@
;; ----------------------------------------------------------------------------
+;; Literals and comments
+
+(integer) @constant.numeric.integer
+(exp_negation) @constant.numeric.integer
+(exp_literal (float)) @constant.numeric.float
+(char) @constant.character
+(string) @string
+
+(comment) @comment
+
+(con_unit [ "(" ")" ] @constant.builtin) ; unit, as in ()
+
+
+;; ----------------------------------------------------------------------------
;; Keywords, operators, includes
[
@@ -352,6 +366,8 @@
;; ----------------------------------------------------------------------------
;; Functions and variables
+(variable) @variable
+
(signature name: (variable) @type)
(function
name: (variable) @function
@@ -366,7 +382,6 @@
(exp_apply . (exp_name (variable) @function))
(exp_apply . (exp_name (qualified_variable (variable) @function)))
-(variable) @variable
(pat_wildcard) @variable
;; ----------------------------------------------------------------------------
diff --git a/runtime/queries/hcl/highlights.scm b/runtime/queries/hcl/highlights.scm
index d00f74f3..7e6e6cf7 100644
--- a/runtime/queries/hcl/highlights.scm
+++ b/runtime/queries/hcl/highlights.scm
@@ -1,48 +1,5 @@
(ERROR) @error
-; { key: val }
-
-(object_elem val: (expression
- (variable_expr
- (identifier) @type.builtin (#match? @type.builtin "^(bool|string|number|object|tuple|list|map|set|any)$"))))
-
-(get_attr (identifier) @variable.builtin (#match? @variable.builtin "^(root|cwd|module)$"))
-(variable_expr (identifier) @variable.builtin (#match? @variable.builtin "^(var|local|path)$"))
-((identifier) @type.builtin (#match? @type.builtin "^(bool|string|number|object|tuple|list|map|set|any)$"))
-((identifier) @keyword (#match? @keyword "^(module|root|cwd|resource|variable|data|locals|terraform|provider|output)$"))
-
-; highlight identifier keys as though they were block attributes
-(object_elem key: (expression (variable_expr (identifier) @variable.other.member)))
-
-(attribute (identifier) @variable.other.member)
-(function_call (identifier) @function.method)
-(block (identifier) @type.builtin)
-
-(identifier) @variable
-(comment) @comment
-(null_lit) @constant.builtin
-(numeric_lit) @constant.numeric
-(bool_lit) @constant.builtin.boolean
-
-[
- (template_interpolation_start) ; ${
- (template_interpolation_end) ; }
- (template_directive_start) ; %{
- (template_directive_end) ; }
- (strip_marker) ; ~
-] @punctuation.special
-
-[
- (heredoc_identifier) ; <<END
- (heredoc_start) ; END
-] @punctuation.delimiter
-
-[
- (quoted_template_start) ; "
- (quoted_template_end); "
- (template_literal) ; non-interpolation/directive content
-] @string
-
[
"if"
"else"
@@ -98,3 +55,47 @@
"&&"
"||"
] @operator
+
+(identifier) @variable
+
+; { key: val }
+
+(object_elem val: (expression
+ (variable_expr
+ (identifier) @type.builtin (#match? @type.builtin "^(bool|string|number|object|tuple|list|map|set|any)$"))))
+
+(get_attr (identifier) @variable.builtin (#match? @variable.builtin "^(root|cwd|module)$"))
+(variable_expr (identifier) @variable.builtin (#match? @variable.builtin "^(var|local|path)$"))
+((identifier) @type.builtin (#match? @type.builtin "^(bool|string|number|object|tuple|list|map|set|any)$"))
+((identifier) @keyword (#match? @keyword "^(module|root|cwd|resource|variable|data|locals|terraform|provider|output)$"))
+
+; highlight identifier keys as though they were block attributes
+(object_elem key: (expression (variable_expr (identifier) @variable.other.member)))
+
+(attribute (identifier) @variable.other.member)
+(function_call (identifier) @function.method)
+(block (identifier) @type.builtin)
+
+(comment) @comment
+(null_lit) @constant.builtin
+(numeric_lit) @constant.numeric
+(bool_lit) @constant.builtin.boolean
+
+[
+ (template_interpolation_start) ; ${
+ (template_interpolation_end) ; }
+ (template_directive_start) ; %{
+ (template_directive_end) ; }
+ (strip_marker) ; ~
+] @punctuation.special
+
+[
+ (heredoc_identifier) ; <<END
+ (heredoc_start) ; END
+] @punctuation.delimiter
+
+[
+ (quoted_template_start) ; "
+ (quoted_template_end); "
+ (template_literal) ; non-interpolation/directive content
+] @string
diff --git a/runtime/queries/hocon/highlights.scm b/runtime/queries/hocon/highlights.scm
index d1aa38a2..95210394 100644
--- a/runtime/queries/hocon/highlights.scm
+++ b/runtime/queries/hocon/highlights.scm
@@ -10,6 +10,8 @@
(value [":" "=" "+=" ] @operator)
+[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket
+
(substitution (_) @string)
(substitution ["${" "${?" "}"] @punctuation.special)
@@ -22,8 +24,6 @@
(include) @keyword.directive
-[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket
-
(unit) @keyword
(path (_) @keyword)
(unquoted_path "." @punctuation.delimiter)
diff --git a/runtime/queries/inko/highlights.scm b/runtime/queries/inko/highlights.scm
index 2f1cdc12..d5730dce 100644
--- a/runtime/queries/inko/highlights.scm
+++ b/runtime/queries/inko/highlights.scm
@@ -49,6 +49,12 @@
"|="
] @operator
+; Identifiers/variable references
+(identifier) @variable
+
+((identifier) @function
+ (#is-not? local))
+
; Keywords
[
"as"
@@ -185,9 +191,3 @@
name: _ @function)
(field) @variable.other.member
-
-; Identifiers/variable references
-((identifier) @function
- (#is-not? local))
-
-(identifier) @variable
diff --git a/runtime/queries/janet/highlights.scm b/runtime/queries/janet/highlights.scm
index 13355943..94e4cdce 100644
--- a/runtime/queries/janet/highlights.scm
+++ b/runtime/queries/janet/highlights.scm
@@ -10,12 +10,15 @@
(num_lit) @constant.numeric
-[(bool_lit) (nil_lit)] @constant.builtin
+(bool_lit) @constant.builtin.boolean
+(nil_lit) @constant.builtin
(comment) @comment
-((sym_lit) @variable
- (#match? @variable "^\\*.+\\*$"))
+(sym_lit) @variable
+
+((sym_lit) @variable.builtin
+ (#match? @variable.builtin "^\\*.+\\*$"))
(short_fn_lit
.
@@ -57,8 +60,6 @@
.
(sym_lit) @function)
-(sym_lit) @variable
-
["{" "@{" "}"
"[" "@[" "]"
"(" "@(" ")"] @punctuation.bracket
diff --git a/runtime/queries/java/highlights.scm b/runtime/queries/java/highlights.scm
index ae99a33a..1f5da9c6 100644
--- a/runtime/queries/java/highlights.scm
+++ b/runtime/queries/java/highlights.scm
@@ -1,3 +1,5 @@
+(identifier) @variable
+
; Methods
(method_declaration
@@ -54,8 +56,6 @@
((identifier) @constant
(#match? @constant "^_*[A-Z][A-Z\\d_]+$"))
-(identifier) @variable
-
(this) @variable.builtin
; Literals
diff --git a/runtime/queries/javascript/highlights.scm b/runtime/queries/javascript/highlights.scm
index 2a40b372..bd09e048 100644
--- a/runtime/queries/javascript/highlights.scm
+++ b/runtime/queries/javascript/highlights.scm
@@ -1,3 +1,3 @@
; See runtime/queries/ecma/README.md for more info.
-; inherits: _javascript,ecma
+; inherits: ecma,_javascript
diff --git a/runtime/queries/jsonnet/highlights.scm b/runtime/queries/jsonnet/highlights.scm
index f54e7d5c..c5cb49ff 100644
--- a/runtime/queries/jsonnet/highlights.scm
+++ b/runtime/queries/jsonnet/highlights.scm
@@ -15,6 +15,7 @@
(binaryop) @operator
(unaryop) @operator
+(id) @variable
(param identifier: (id) @variable.parameter)
(bind function: (id) @function)
(fieldname (id) @variable.other.member)
@@ -35,4 +36,3 @@
";"
"="
] @punctuation.delimiter
-(id) @variable
diff --git a/runtime/queries/jsx/highlights.scm b/runtime/queries/jsx/highlights.scm
index eb2b1b1a..4d0e168a 100644
--- a/runtime/queries/jsx/highlights.scm
+++ b/runtime/queries/jsx/highlights.scm
@@ -1,3 +1,3 @@
; See runtime/queries/ecma/README.md for more info.
-; inherits: _jsx,_javascript,ecma
+; inherits: ecma,_javascript,_jsx
diff --git a/runtime/queries/julia/folds.scm b/runtime/queries/julia/folds.scm
index 91eede5f..91a26c0c 100644
--- a/runtime/queries/julia/folds.scm
+++ b/runtime/queries/julia/folds.scm
@@ -1,11 +1,14 @@
[
- (module_definition)
- (struct_definition)
- (macro_definition)
- (function_definition)
- (compound_expression) ; begin blocks
- (let_statement)
- (if_statement)
- (for_statement)
- (while_statement)
+ (module_definition)
+ (struct_definition)
+ (macro_definition)
+ (function_definition)
+ (if_statement)
+ (try_statement)
+ (for_statement)
+ (while_statement)
+ (let_statement)
+ (quote_statement)
+ (do_clause)
+ (compound_statement) ; begin block
] @fold
diff --git a/runtime/queries/julia/highlights.scm b/runtime/queries/julia/highlights.scm
index 013f5063..7072640f 100644
--- a/runtime/queries/julia/highlights.scm
+++ b/runtime/queries/julia/highlights.scm
@@ -1,39 +1,48 @@
-; ----------
-; Primitives
-; ----------
+; ------------
+; Variables identifiers
+; ------------
-[
- (line_comment)
- (block_comment)
-] @comment
+(identifier) @variable
+; Remaining identifiers that start with capital letters should be types (PascalCase)
(
- ((identifier) @constant.builtin)
- (#match? @constant.builtin "^(nothing|missing|undef)$"))
+ (identifier) @type
+ (#match? @type "^[A-Z]"))
-[
- (true)
- (false)
-] @constant.builtin.boolean
+; SCREAMING_SNAKE_CASE
+(
+ (identifier) @constant
+ (#match? @constant "^[A-Z][A-Z0-9_]*$"))
-(integer_literal) @constant.numeric.integer
-(float_literal) @constant.numeric.float
+(const_statement
+ (assignment
+ . (identifier) @constant))
-(
- ((identifier) @constant.numeric.float)
- (#match? @constant.numeric.float "^((Inf|NaN)(16|32|64)?)$"))
+; Field expressions are either module content or struct fields.
+; Module types and constants should already be captured, so this
+; assumes the remaining identifiers to be struct fields.
+(field_expression
+ (_)
+ (identifier) @variable.other.member)
-(character_literal) @constant.character
-(escape_sequence) @constant.character.escape
+(quote_expression
+ ":" @string.special.symbol
+ [
+ (identifier)
+ (operator)
+ ] @string.special.symbol)
-(string_literal) @string
+; ------
+; Macros
+; ------
-(prefixed_string_literal
- prefix: (identifier) @function.macro) @string
+(macro_definition
+ name: (identifier) @function.macro)
+
+(macro_identifier
+ "@" @function.macro
+ (identifier) @function.macro)
-(quote_expression
- (identifier) @string.special.symbol)
-
; -------------------
; Modules and Imports
; -------------------
@@ -50,49 +59,6 @@
(scoped_identifier
(identifier) @namespace)
-; -----
-; Types
-; -----
-
-(abstract_definition
- name: (identifier) @type)
-
-(primitive_definition
- name: (identifier) @type)
-
-(struct_definition
- name: (identifier) @type)
-
-(struct_definition
- . (_)
- (identifier) @variable.other.member)
-
-(struct_definition
- . (_)
- (typed_expression
- . (identifier) @variable.other.member))
-
-(type_parameter_list
- (identifier) @type)
-
-(constrained_type_parameter
- (identifier) @type)
-
-(subtype_clause
- (identifier) @type)
-
-(typed_expression
- (identifier) @type . )
-
-(parameterized_identifier
- (identifier) @type)
-
-(type_argument_list
- (identifier) @type)
-
-(where_clause
- (identifier) @type)
-
; -------------------
; Function definition
; -------------------
@@ -119,22 +85,6 @@
; prevent constructors (PascalCase) to be highlighted as functions
(#match? @function "^[^A-Z]"))
-(parameter_list
- (identifier) @variable.parameter)
-
-(typed_parameter
- (identifier) @variable.parameter
- (identifier)? @type)
-
-(optional_parameter
- . (identifier) @variable.parameter)
-
-(slurp_parameter
- (identifier) @variable.parameter)
-
-(function_expression
- . (identifier) @variable.parameter)
-
; ---------------
; Functions calls
; ---------------
@@ -146,13 +96,13 @@
(#match? @function "^[^A-Z]"))
(
- (broadcast_call_expression
- (identifier) @function)
+ (call_expression
+ (field_expression (identifier) @function .))
(#match? @function "^[^A-Z]"))
(
- (call_expression
- (field_expression (identifier) @function .))
+ (broadcast_call_expression
+ (identifier) @function)
(#match? @function "^[^A-Z]"))
(
@@ -160,78 +110,279 @@
(field_expression (identifier) @function .))
(#match? @function "^[^A-Z]"))
-; ------
-; Macros
-; ------
-(macro_definition
- name: (identifier) @function.macro)
+; -------------------
+; Functions 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
+; -----------
+
+(parameter_list
+ (identifier) @variable.parameter)
+
+(optional_parameter
+ . (identifier) @variable.parameter)
+
+(slurp_parameter
+ (identifier) @variable.parameter)
+
+(typed_parameter
+ parameter: (identifier)? @variable.parameter
+ type: (_) @type)
+
+(function_expression
+ . (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)
+
+(struct_definition
+ . (_)
+ (identifier) @variable.other.member)
+
+(struct_definition
+ . (_)
+ (typed_expression
+ . (identifier) @variable.other.member))
+
+(type_clause
+ [
+ (identifier) @type
+ (field_expression
+ (identifier) @type .)
+ ])
+
+; Annotations
+(parametrized_type_expression
+ (_) @type
+ (curly_expression
+ (_) @type))
+
+(type_parameter_list
+ (identifier) @type)
+
+(typed_expression
+ (identifier) @type . )
+
+(function_definition
+ return_type: (identifier) @type)
+
+(short_function_definition
+ return_type: (identifier) @type)
+
+(where_clause
+ (identifier) @type)
+
+(where_clause
+ (curly_expression
+ (_) @type))
+
+; ---------
+; 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
+ (#any-of? @type.builtin
+ "AbstractArray" "AbstractChannel" "AbstractChar" "AbstractDict" "AbstractDisplay"
+ "AbstractFloat" "AbstractIrrational" "AbstractLock" "AbstractMatch" "AbstractMatrix"
+ "AbstractPattern" "AbstractRange" "AbstractSet" "AbstractSlices" "AbstractString"
+ "AbstractUnitRange" "AbstractVecOrMat" "AbstractVector" "Any" "ArgumentError" "Array"
+ "AssertionError" "Atomic" "BigFloat" "BigInt" "BitArray" "BitMatrix" "BitSet" "BitVector" "Bool"
+ "BoundsError" "By" "CanonicalIndexError" "CapturedException" "CartesianIndex" "CartesianIndices"
+ "Cchar" "Cdouble" "Cfloat" "Channel" "Char" "Cint" "Cintmax_t" "Clong" "Clonglong" "Cmd" "Colon"
+ "ColumnSlices" "Complex" "ComplexF16" "ComplexF32" "ComplexF64" "ComposedFunction"
+ "CompositeException" "ConcurrencyViolationError" "Condition" "Cptrdiff_t" "Cshort" "Csize_t"
+ "Cssize_t" "Cstring" "Cuchar" "Cuint" "Cuintmax_t" "Culong" "Culonglong" "Cushort" "Cvoid"
+ "Cwchar_t" "Cwstring" "DataType" "DenseArray" "DenseMatrix" "DenseVecOrMat" "DenseVector" "Dict"
+ "DimensionMismatch" "Dims" "DivideError" "DomainError" "EOFError" "Enum" "ErrorException"
+ "Exception" "ExponentialBackOff" "Expr" "Float16" "Float32" "Float64" "Function" "GlobalRef"
+ "HTML" "IO" "IOBuffer" "IOContext" "IOStream" "IdDict" "IndexCartesian" "IndexLinear"
+ "IndexStyle" "InexactError" "InitError" "Int" "Int128" "Int16" "Int32" "Int64" "Int8" "Integer"
+ "InterruptException" "InvalidStateException" "Irrational" "KeyError" "LazyString" "LinRange"
+ "LineNumberNode" "LinearIndices" "LoadError" "Lt" "MIME" "Matrix" "Method" "MethodError"
+ "Missing" "MissingException" "Module" "NTuple" "NamedTuple" "Nothing" "Number" "Ordering"
+ "OrdinalRange" "OutOfMemoryError" "OverflowError" "Pair" "ParseError" "PartialQuickSort" "Perm"
+ "PermutedDimsArray" "Pipe" "ProcessFailedException" "Ptr" "QuoteNode" "Rational" "RawFD"
+ "ReadOnlyMemoryError" "Real" "ReentrantLock" "Ref" "Regex" "RegexMatch" "Returns"
+ "ReverseOrdering" "RoundingMode" "RowSlices" "SegmentationFault" "Set" "Signed" "Slices" "Some"
+ "SpinLock" "StackFrame" "StackOverflowError" "StackTrace" "Stateful" "StepRange" "StepRangeLen"
+ "StridedArray" "StridedMatrix" "StridedVecOrMat" "StridedVector" "String" "StringIndexError"
+ "SubArray" "SubString" "SubstitutionString" "Symbol" "SystemError" "Task" "TaskFailedException"
+ "Text" "TextDisplay" "Timer" "Tmstruct" "Tuple" "Type" "TypeError" "TypeVar" "UInt" "UInt128"
+ "UInt16" "UInt32" "UInt64" "UInt8" "UndefInitializer" "UndefKeywordError" "UndefRefError"
+ "UndefVarError" "Union" "UnionAll" "UnitRange" "Unsigned" "Val" "VecElement" "VecOrMat" "Vector"
+ "VersionNumber" "WeakKeyDict" "WeakRef"))
+
+((identifier) @variable.builtin
+ (#any-of? @variable.builtin "begin" "end")
+ (#has-ancestor? @variable.builtin index_expression))
+
+((identifier) @variable.builtin
+ (#any-of? @variable.builtin "begin" "end")
+ (#has-ancestor? @variable.builtin range_expression))
-(macro_identifier
- "@" @function.macro
- (identifier) @function.macro)
; --------
; Keywords
; --------
-(function_definition
- ["function" "end"] @keyword.function)
+[
+ "global"
+ "local"
+] @keyword
+
+(compound_statement
+ [
+ "begin"
+ "end"
+ ] @keyword)
+
+(quote_statement
+ [
+ "quote"
+ "end"
+ ] @keyword)
+
+(let_statement
+ [
+ "let"
+ "end"
+ ] @keyword)
(if_statement
- ["if" "end"] @keyword.control.conditional)
+ [
+ "if"
+ "end"
+ ] @keyword.control.conditional)
+
(elseif_clause
- ["elseif"] @keyword.control.conditional)
+ "elseif" @keyword.control.conditional)
+
(else_clause
- ["else"] @keyword.control.conditional)
-(ternary_expression
- ["?" ":"] @keyword.control.conditional)
+ "else" @keyword.control.conditional)
-(for_statement
- ["for" "end"] @keyword.control.repeat)
-(while_statement
- ["while" "end"] @keyword.control.repeat)
-(break_statement) @keyword.control.repeat
-(continue_statement) @keyword.control.repeat
-(for_binding
- "in" @keyword.control.repeat)
-(for_clause
- "for" @keyword.control.repeat)
+(if_clause
+ "if" @keyword.control.conditional) ; `if` clause in comprehensions
+
+(ternary_expression
+ [
+ "?"
+ ":"
+ ] @keyword.control.conditional)
(try_statement
- ["try" "end" ] @keyword.control.exception)
+ [
+ "try"
+ "end"
+ ] @keyword.control.exception)
+
(finally_clause
"finally" @keyword.control.exception)
+
(catch_clause
"catch" @keyword.control.exception)
+(for_statement
+ [
+ "for"
+ "end"
+ ] @keyword.control.repeat)
+
+(while_statement
+ [
+ "while"
+ "end"
+ ] @keyword.control.repeat)
+
+(for_clause
+ "for" @keyword.control.repeat)
+
[
- "export"
- "import"
- "using"
-] @keyword.control.import
+ (break_statement)
+ (continue_statement)
+] @keyword.control.repeat
+
+(module_definition
+ [
+ "module"
+ "baremodule"
+ "end"
+ ] @keyword.control.import)
+
+(import_statement
+ [
+ "import"
+ "using"
+ ] @keyword.control.import)
+
+(import_alias
+ "as" @keyword.control.import)
+
+(export_statement
+ "export" @keyword.control.import)
+
+(selected_import
+ ":" @punctuation.delimiter)
+
+(struct_definition
+ [
+ "struct"
+ "end"
+ ] @keyword)
+
+(macro_definition
+ [
+ "macro"
+ "end"
+ ] @keyword)
+
+(function_definition
+ [
+ "function"
+ "end"
+ ] @keyword.function)
+
+(do_clause
+ [
+ "do"
+ "end"
+ ] @keyword.function)
+
+(return_statement
+ "return" @keyword.control.return)
[
- "abstract"
- "baremodule"
- "begin"
"const"
- "do"
- "end"
- "let"
- "macro"
- "module"
"mutable"
- "primitive"
- "quote"
- "return"
- "struct"
- "type"
- "where"
-] @keyword
-
-; TODO: fix this
-((identifier) @keyword (#match? @keyword "global|local"))
+] @keyword.storage.modifier
; ---------
; Operators
@@ -239,14 +390,34 @@
[
(operator)
- "::"
- "<:"
- ":"
- "=>"
- "..."
- "$"
+ "="
+ "∈"
] @operator
+(adjoint_expression
+ "'" @operator)
+
+(range_expression
+ ":" @operator)
+
+((operator) @keyword.operator
+ (#any-of? @keyword.operator "in" "isa"))
+
+(for_binding
+ "in" @keyword.operator)
+
+(where_clause
+ "where" @keyword.operator)
+
+(where_expression
+ "where" @keyword.operator)
+
+(binary_expression
+ (_)
+ (operator) @operator
+ (identifier) @function
+ (#any-of? @operator "|>" ".|>"))
+
; ------------
; Punctuations
; ------------
@@ -255,40 +426,58 @@
"."
","
";"
+ "::"
+ "->"
] @punctuation.delimiter
+"..." @punctuation.special
+
[
- "["
- "]"
"("
")"
+ "["
+ "]"
"{"
"}"
] @punctuation.bracket
-; ---------------------
-; Remaining identifiers
-; ---------------------
+; ---------
+; Literals
+; ---------
+
+(boolean_literal) @constant.builtin.boolean
-(const_statement
- (variable_declaration
- . (identifier) @constant))
+(integer_literal) @constant.numeric.integer
+
+(float_literal) @constant.numeric.float
-; SCREAMING_SNAKE_CASE
(
- (identifier) @constant
- (#match? @constant "^[A-Z][A-Z0-9_]*$"))
+ ((identifier) @constant.numeric.float)
+ (#match? @constant.numeric.float "^((Inf|NaN)(16|32|64)?)$"))
-; remaining identifiers that start with capital letters should be types (PascalCase)
(
- (identifier) @type
- (#match? @type "^[A-Z]"))
+ ((identifier) @constant.builtin)
+ (#match? @constant.builtin "^(nothing|missing|undef)$"))
-; Field expressions are either module content or struct fields.
-; Module types and constants should already be captured, so this
-; assumes the remaining identifiers to be struct fields.
-(field_expression
- (_)
- (identifier) @variable.other.member)
+(character_literal) @constant.character
-(identifier) @variable
+(escape_sequence) @constant.character.escape
+
+(string_literal) @string
+
+(prefixed_string_literal
+ prefix: (identifier) @function.macro) @string
+
+(command_literal) @string
+
+(prefixed_command_literal
+ prefix: (identifier) @function.macro) @string
+
+; ---------
+; Comments
+; ---------
+
+[
+ (line_comment)
+ (block_comment)
+] @comment
diff --git a/runtime/queries/julia/indents.scm b/runtime/queries/julia/indents.scm
index 08f55aa7..d7320177 100644
--- a/runtime/queries/julia/indents.scm
+++ b/runtime/queries/julia/indents.scm
@@ -2,15 +2,39 @@
(struct_definition)
(macro_definition)
(function_definition)
- (compound_expression)
- (let_statement)
+ (compound_statement)
(if_statement)
+ (try_statement)
(for_statement)
(while_statement)
+ (let_statement)
+ (quote_statement)
(do_clause)
- (parameter_list)
+ (assignment)
+ (for_binding)
+ (call_expression)
+ (parenthesized_expression)
+ (tuple_expression)
+ (comprehension_expression)
+ (matrix_expression)
+ (vector_expression)
] @indent
[
"end"
+ ")"
+ "]"
+ "}"
] @outdent
+
+(argument_list
+ . (_) @anchor
+ (#set! "scope" "tail")) @align
+
+(parameter_list
+ . (_) @anchor
+ (#set! "scope" "tail")) @align
+
+(curly_expression
+ . (_) @anchor
+ (#set! "scope" "tail")) @align
diff --git a/runtime/queries/julia/injections.scm b/runtime/queries/julia/injections.scm
index fd174a4a..3b80163f 100644
--- a/runtime/queries/julia/injections.scm
+++ b/runtime/queries/julia/injections.scm
@@ -9,7 +9,8 @@
(primitive_definition)
(abstract_definition)
(struct_definition)
- (assignment_expression)
+ (short_function_definition)
+ (assignment)
(const_statement)
])
(#set! injection.language "markdown"))
@@ -22,9 +23,16 @@
(#set! injection.language "comment"))
(
+ [
+ (command_literal)
+ (prefixed_command_literal)
+ ] @injection.content
+ (#set! injection.language "sh"))
+
+(
(prefixed_string_literal
prefix: (identifier) @function.macro) @injection.content
- (#eq? @function.macro "re")
+ (#eq? @function.macro "r")
(#set! injection.language "regex"))
(
diff --git a/runtime/queries/julia/locals.scm b/runtime/queries/julia/locals.scm
index 70b31e50..bbf72c0e 100644
--- a/runtime/queries/julia/locals.scm
+++ b/runtime/queries/julia/locals.scm
@@ -2,43 +2,100 @@
; Definitions
; -----------
-; Imports
-(import_statement
+; Variables
+(assignment
(identifier) @local.definition)
-
+
+(assignment
+ (tuple_expression
+ (identifier) @local.definition))
+
; Constants
(const_statement
- (variable_declaration
+ (assignment
. (identifier) @local.definition))
+; let/const bindings
+(let_binding
+ (identifier) @local.definition)
+
+(let_binding
+ (tuple_expression
+ (identifier) @local.definition))
+
+; For bindings
+(for_binding
+ (identifier) @local.definition)
+
+(for_binding
+ (tuple_expression
+ (identifier) @local.definition))
+
+; Types
+(struct_definition
+ name: (identifier) @local.definition)
+
+(abstract_definition
+ name: (identifier) @local.definition)
+
+(abstract_definition
+ name: (identifier) @local.definition)
+
+(type_parameter_list
+ (identifier) @local.definition)
+
+; Module imports
+(import_statement
+ (identifier) @local.definition)
+
; Parameters
(parameter_list
(identifier) @local.definition)
-(typed_parameter
- . (identifier) @local.definition)
-
-(optional_parameter .
+(optional_parameter
+ .
(identifier) @local.definition)
(slurp_parameter
(identifier) @local.definition)
+(typed_parameter
+ parameter: (identifier) @local.definition
+ (_))
+
+; Single parameter arrow function
(function_expression
- . (identifier) @local.definition)
-
-; ------
-; Scopes
-; ------
+ .
+ (identifier) @local.definition)
-[
- (function_definition)
- (short_function_definition)
- (macro_definition)
-] @local.scope
+; Function/macro definitions
+(function_definition
+ name: (identifier) @local.definition) @local.scope
+
+(short_function_definition
+ name: (identifier) @local.definition) @local.scope
+
+(macro_definition
+ name: (identifier) @local.definition) @local.scope
; ----------
; References
; ----------
(identifier) @local.reference
+
+; ------
+; Scopes
+; ------
+
+[
+ (for_statement)
+ (while_statement)
+ (try_statement)
+ (catch_clause)
+ (finally_clause)
+ (let_statement)
+ (quote_statement)
+ (do_clause)
+] @local.scope
+
diff --git a/runtime/queries/koka/highlights.scm b/runtime/queries/koka/highlights.scm
index 1ef40927..cec2881f 100644
--- a/runtime/queries/koka/highlights.scm
+++ b/runtime/queries/koka/highlights.scm
@@ -1,3 +1,48 @@
+; Identifiers
+
+(qconid) @namespace
+
+(qidop) @namespace
+
+(varid) @variable
+
+(conid) @constructor
+
+(puredecl
+ (binder
+ (identifier
+ [(varid) (idop)] @constant)))
+
+; TODO: Highlight vars differently once helix has an appropriate highlight query
+; for that purpose.
+
+(pparameter
+ (pattern
+ (identifier
+ (varid) @variable.parameter)))
+
+(paramid
+ (identifier
+ (varid) @variable.parameter))
+
+(typedecl
+ "effect"
+ (varid) @type)
+
+(typeid
+ (varid) @type)
+
+(tbinder
+ (varid) @type)
+
+(typecon
+ (varid) @type)
+
+(qvarid
+ (qid) @namespace)
+
+(modulepath (varid) @namespace)
+
; Function calls
(appexpr
@@ -55,51 +100,6 @@
(identifier
[(varid) (idop)] @function))
-; Identifiers
-
-(puredecl
- (binder
- (identifier
- [(varid) (idop)] @constant)))
-
-; TODO: Highlight vars differently once helix has an appropriate highlight query
-; for that purpose.
-
-(pparameter
- (pattern
- (identifier
- (varid) @variable.parameter)))
-
-(paramid
- (identifier
- (varid) @variable.parameter))
-
-(typedecl
- "effect"
- (varid) @type)
-
-(typeid
- (varid) @type)
-
-(tbinder
- (varid) @type)
-
-(typecon
- (varid) @type)
-
-(qvarid
- (qid) @namespace)
-
-(modulepath (varid) @namespace)
-
-(qconid) @namespace
-
-(qidop) @namespace
-
-(varid) @variable
-
-(conid) @constructor
-
; Operators
[
diff --git a/runtime/queries/kotlin/highlights.scm b/runtime/queries/kotlin/highlights.scm
index 5b19f849..11fae331 100644
--- a/runtime/queries/kotlin/highlights.scm
+++ b/runtime/queries/kotlin/highlights.scm
@@ -1,21 +1,20 @@
-;;; Operators & Punctuation
+;;; Identifiers
+(simple_identifier) @variable
-(multi_line_string_literal
- "$" @punctuation
- (interpolated_identifier) @none)
-(multi_line_string_literal
- "${" @punctuation
- (interpolated_expression) @none
- "}" @punctuation.)
+; `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"))
-; NOTE: `interpolated_identifier`s can be highlighted in any way
-(line_string_literal
- "$" @punctuation
- (interpolated_identifier) @none)
-(line_string_literal
- "${" @punctuation
- (interpolated_expression) @none
- "}" @punctuation)
+; `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"))
+
+
+;;; Operators & Punctuation
[
"."
@@ -69,6 +68,23 @@
"->"
] @operator
+(multi_line_string_literal
+ "$" @punctuation
+ (interpolated_identifier) @none)
+(multi_line_string_literal
+ "${" @punctuation
+ (interpolated_expression) @none
+ "}" @punctuation.)
+
+; NOTE: `interpolated_identifier`s can be highlighted in any way
+(line_string_literal
+ "$" @punctuation
+ (interpolated_identifier) @none)
+(line_string_literal
+ "${" @punctuation
+ (interpolated_expression) @none
+ "}" @punctuation)
+
;;; Keywords
(type_alias "typealias" @keyword)
@@ -281,18 +297,3 @@
; `this` this keyword inside classes
(this_expression) @variable.builtin
-
-;;; Identifiers
-; `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"))
-
-; `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"))
-
-(simple_identifier) @variable
diff --git a/runtime/queries/koto/highlights.scm b/runtime/queries/koto/highlights.scm
index 61f97123..1e9104aa 100644
--- a/runtime/queries/koto/highlights.scm
+++ b/runtime/queries/koto/highlights.scm
@@ -70,9 +70,6 @@
"as"
] @keyword.control.import
-(string (interpolation ("{") @punctuation.special))
-(string (interpolation ("}") @punctuation.special))
-
[
"("
")"
@@ -83,12 +80,16 @@
"|"
] @punctuation.bracket
+(string (interpolation ["{" "}"] @punctuation.special))
+
[
";"
":"
","
] @punctuation.delimiter
+(identifier) @variable
+
(import_module
(identifier) @module)
@@ -148,5 +149,3 @@
(function
output_type: (identifier) @type)
-
-(identifier) @variable
diff --git a/runtime/queries/ld/highlights.scm b/runtime/queries/ld/highlights.scm
index e0c9dd1e..c4ba0bb1 100644
--- a/runtime/queries/ld/highlights.scm
+++ b/runtime/queries/ld/highlights.scm
@@ -1,11 +1,11 @@
; Identifiers
+[(NAME) (SYMBOLNAME)] @variable
+
(section
.
(NAME) @namespace)
-[(NAME) (SYMBOLNAME)] @variable
-
; Operators
[
diff --git a/runtime/queries/ldif/highlights.scm b/runtime/queries/ldif/highlights.scm
index 882ace9f..06f7f6c1 100644
--- a/runtime/queries/ldif/highlights.scm
+++ b/runtime/queries/ldif/highlights.scm
@@ -1,5 +1,7 @@
(comment) @comment
+(attributeType) @type.parameter
+
((distinguishedName
(name
(name_componet
@@ -13,7 +15,6 @@
(changerecord) @constant
(mod_spec) @constant
-(attributeType) @type.parameter
(change_modify) @string
(value_spec) @keyword
diff --git a/runtime/queries/lean/highlights.scm b/runtime/queries/lean/highlights.scm
index ca19b835..43e3a62e 100644
--- a/runtime/queries/lean/highlights.scm
+++ b/runtime/queries/lean/highlights.scm
@@ -1,3 +1,8 @@
+; Variables
+(identifier) @variable
+
+; Namespaces
+
(open
namespace: (identifier) @namespace)
(namespace
@@ -212,6 +217,3 @@
;; Error
(ERROR) @error
-
-; Variables
-(identifier) @variable
diff --git a/runtime/queries/lua/highlights.scm b/runtime/queries/lua/highlights.scm
index 2f3b3c05..4fedcd57 100644
--- a/runtime/queries/lua/highlights.scm
+++ b/runtime/queries/lua/highlights.scm
@@ -115,6 +115,18 @@
"}"
] @punctuation.bracket
+;; Variables
+(identifier) @variable
+
+((identifier) @variable.builtin
+ (#eq? @variable.builtin "self"))
+
+(variable_list
+ (attribute
+ "<" @punctuation.bracket
+ (identifier) @attribute
+ ">" @punctuation.bracket))
+
; ;; Constants
[
(false)
@@ -208,17 +220,5 @@
;; Property
(dot_index_expression field: (identifier) @variable.other.member)
-;; Variables
-((identifier) @variable.builtin
- (#eq? @variable.builtin "self"))
-
-(variable_list
- (attribute
- "<" @punctuation.bracket
- (identifier) @attribute
- ">" @punctuation.bracket))
-
-(identifier) @variable
-
;; Error
(ERROR) @error
diff --git a/runtime/queries/meson/highlights.scm b/runtime/queries/meson/highlights.scm
index c4775540..58c2baca 100644
--- a/runtime/queries/meson/highlights.scm
+++ b/runtime/queries/meson/highlights.scm
@@ -1,7 +1,6 @@
(comment) @comment
-; these are listed first, because they override keyword queries
-(function_expression (identifier) @function)
+(identifier) @variable
[
(assignment_operator)
@@ -59,4 +58,5 @@
(fstring_literal)
] @string
-(identifier) @variable
+; these are listed last, because they override keyword queries
+(function_expression (identifier) @function)
diff --git a/runtime/queries/mojo/highlights.scm b/runtime/queries/mojo/highlights.scm
index 7acaf1ea..4ad3500d 100644
--- a/runtime/queries/mojo/highlights.scm
+++ b/runtime/queries/mojo/highlights.scm
@@ -1,3 +1,28 @@
+; Variables
+
+(identifier) @variable
+
+(attribute attribute: (identifier) @variable.other.member)
+
+((identifier) @constant
+ (#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
+
+((identifier) @type
+ (#match? @type "^[A-Z]"))
+
+; Literals
+(none) @constant.builtin
+[
+ (true)
+ (false)
+] @constant.builtin.boolean
+
+(integer) @constant.numeric.integer
+(float) @constant.numeric.float
+(comment) @comment
+(string) @string
+(escape_sequence) @constant.character.escape
+
; Docstrings
(expression_statement (string) @comment.block.documentation)
@@ -98,30 +123,6 @@
(class_definition name: (identifier) @type)
(class_definition superclasses: (argument_list (identifier) @type))
-; Variables
-
-((identifier) @constant
- (#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
-
-((identifier) @type
- (#match? @type "^[A-Z]"))
-
-(attribute attribute: (identifier) @variable.other.member)
-(identifier) @variable
-
-; Literals
-(none) @constant.builtin
-[
- (true)
- (false)
-] @constant.builtin.boolean
-
-(integer) @constant.numeric.integer
-(float) @constant.numeric.float
-(comment) @comment
-(string) @string
-(escape_sequence) @constant.character.escape
-
["," "." ":" ";" (ellipsis)] @punctuation.delimiter
(interpolation
"{" @punctuation.special
diff --git a/runtime/queries/move/highlights.scm b/runtime/queries/move/highlights.scm
index 86a79dc2..bf607e1f 100644
--- a/runtime/queries/move/highlights.scm
+++ b/runtime/queries/move/highlights.scm
@@ -23,12 +23,16 @@
(borrow_expression "&" @keyword.storage.modifier.ref)
(borrow_expression "&mut" @keyword.storage.modifier.mut)
+(identifier) @variable
+
(constant_identifier) @constant
((identifier) @constant
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
(function_identifier) @function
+(primitive_type) @type.builtin
+
(struct_identifier) @type
(pack_expression
access: (module_access
@@ -152,6 +156,3 @@
"with"
] @keyword
-(primitive_type) @type.buildin
-
-(identifier) @variable
diff --git a/runtime/queries/nasm/highlights.scm b/runtime/queries/nasm/highlights.scm
index 5e3cfebe..6cdc4f97 100644
--- a/runtime/queries/nasm/highlights.scm
+++ b/runtime/queries/nasm/highlights.scm
@@ -4,6 +4,12 @@
(preproc_expression) @keyword.directive
+(word) @variable
+((word) @constant
+ (#match? @constant "^[A-Z_][?A-Z_0-9]+$"))
+((word) @constant.builtin
+ (#match? @constant.builtin "^__\\?[A-Z_a-z0-9]+\\?__$"))
+
[
(line_here_token)
(section_here_token)
@@ -56,12 +62,6 @@
(float_literal) @constant.numeric.float
(packed_bcd_literal) @constant.numeric.integer
-((word) @constant
- (#match? @constant "^[A-Z_][?A-Z_0-9]+$"))
-((word) @constant.builtin
- (#match? @constant.builtin "^__\\?[A-Z_a-z0-9]+\\?__$"))
-(word) @variable
-
(preproc_arg) @keyword.directive
[
diff --git a/runtime/queries/nim/highlights.scm b/runtime/queries/nim/highlights.scm
index e02ba516..04c4e1b2 100644
--- a/runtime/queries/nim/highlights.scm
+++ b/runtime/queries/nim/highlights.scm
@@ -1,3 +1,5 @@
+(identifier) @variable
+
;; Constants, Comments, and Literals
(comment) @comment.line
@@ -329,5 +331,3 @@
(dot_expression
left: (identifier) @variable
right: (identifier) @variable.other.member)
-
-(identifier) @variable
diff --git a/runtime/queries/nix/highlights.scm b/runtime/queries/nix/highlights.scm
index 4633e178..b55bcf8c 100644
--- a/runtime/queries/nix/highlights.scm
+++ b/runtime/queries/nix/highlights.scm
@@ -1,5 +1,23 @@
(comment) @comment
+[
+ ";"
+ "."
+ ","
+ "="
+ ":"
+ (ellipses)
+] @punctuation.delimiter
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+
"assert" @keyword.control.exception
"or" @keyword.operator
"rec" @keyword.control.repeat
@@ -17,6 +35,18 @@
"with"
] @keyword
+(variable_expression name: (identifier) @variable)
+
+(select_expression
+ attrpath: (attrpath attr: (identifier)) @variable.other.member)
+
+(apply_expression
+ function: [
+ (variable_expression name: (identifier) @function)
+ (select_expression
+ attrpath: (attrpath
+ attr: (identifier) @function .))])
+
((identifier) @variable.builtin
(#match? @variable.builtin "^(__currentSystem|__currentTime|__nixPath|__nixVersion|__storeDir|builtins)$")
(#is-not? local))
@@ -59,28 +89,16 @@
name: (identifier) @variable.parameter
"?"? @punctuation.delimiter)
-(select_expression
- attrpath: (attrpath attr: (identifier)) @variable.other.member)
-
(interpolation
"${" @punctuation.special
"}" @punctuation.special) @embedded
-(apply_expression
- function: [
- (variable_expression name: (identifier) @function)
- (select_expression
- attrpath: (attrpath
- attr: (identifier) @function .))])
-
(unary_expression
operator: _ @operator)
(binary_expression
operator: _ @operator)
-(variable_expression name: (identifier) @variable)
-
(binding
attrpath: (attrpath attr: (identifier)) @variable.other.member)
@@ -92,21 +110,3 @@
"?" @operator
attrpath: (attrpath
attr: (identifier) @variable.other.member))
-
-[
- ";"
- "."
- ","
- "="
- ":"
- (ellipses)
-] @punctuation.delimiter
-
-[
- "("
- ")"
- "["
- "]"
- "{"
- "}"
-] @punctuation.bracket \ No newline at end of file
diff --git a/runtime/queries/ocaml/highlights.scm b/runtime/queries/ocaml/highlights.scm
index f2a4f0a4..5e2a576f 100644
--- a/runtime/queries/ocaml/highlights.scm
+++ b/runtime/queries/ocaml/highlights.scm
@@ -1,3 +1,25 @@
+; Punctuation
+;------------
+
+"%" @punctuation.special
+
+["(" ")" "[" "]" "{" "}" "[|" "|]" "[<" "[>"] @punctuation.bracket
+
+[
+ "," "." ";" ":" "=" "|" "~" "?" "+" "-" "!" ">" "&"
+ "->" ";;" ":>" "+=" ":=" ".."
+] @punctuation.delimiter
+
+(object_type ["<" ">"] @punctuation.bracket)
+
+(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)
+
; Modules
;--------
@@ -83,9 +105,7 @@
; Operators
;----------
-(match_expression (match_operator) @keyword)
-
-(value_definition [(let_operator) (let_and_operator)] @keyword)
+["*" "#" "::" "<-"] @operator
[
(prefix_operator)
@@ -105,7 +125,9 @@
(match_operator)
] @operator
-["*" "#" "::" "<-"] @operator
+(match_expression (match_operator) @keyword)
+
+(value_definition [(let_operator) (let_and_operator)] @keyword)
; Keywords
;---------
@@ -118,28 +140,6 @@
"then" "to" "try" "type" "val" "virtual" "when" "while" "with"
] @keyword
-; Punctuation
-;------------
-
-(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)
-
-"%" @punctuation.special
-
-["(" ")" "[" "]" "{" "}" "[|" "|]" "[<" "[>"] @punctuation.bracket
-
-(object_type ["<" ">"] @punctuation.bracket)
-
-[
- "," "." ";" ":" "=" "|" "~" "?" "+" "-" "!" ">" "&"
- "->" ";;" ":>" "+=" ":=" ".."
-] @punctuation.delimiter
-
; Attributes
;-----------
diff --git a/runtime/queries/odin/highlights.scm b/runtime/queries/odin/highlights.scm
index ed302cdb..ed8f03ab 100644
--- a/runtime/queries/odin/highlights.scm
+++ b/runtime/queries/odin/highlights.scm
@@ -1,3 +1,8 @@
+
+; Variables
+
+(identifier) @variable
+
[
(calling_convention)
(tag)
@@ -264,7 +269,3 @@
(call_expression argument: (identifier) @variable.parameter "=")
(procedure_type (parameters (parameter (identifier) @variable.parameter)))
-
-; Variables
-
-(identifier) @variable
diff --git a/runtime/queries/opencl/highlights.scm b/runtime/queries/opencl/highlights.scm
index 9d76d6c6..36133bd2 100644
--- a/runtime/queries/opencl/highlights.scm
+++ b/runtime/queries/opencl/highlights.scm
@@ -106,6 +106,11 @@
[(true) (false)] @constant.builtin.boolean
+(identifier) @variable
+
+((identifier) @constant
+ (#match? @constant "^[A-Z][A-Z\\d_]*$"))
+
(enumerator name: (identifier) @type.enum.variant)
(string_literal) @string
@@ -142,9 +147,4 @@
(vector_type) @type.builtin
(other_builtin_type) @type.builtin
-((identifier) @constant
- (#match? @constant "^[A-Z][A-Z\\d_]*$"))
-
-(identifier) @variable
-
(comment) @comment
diff --git a/runtime/queries/openscad/highlights.scm b/runtime/queries/openscad/highlights.scm
index c06738e8..90d5ac59 100644
--- a/runtime/queries/openscad/highlights.scm
+++ b/runtime/queries/openscad/highlights.scm
@@ -3,13 +3,14 @@
(boolean) @constant.builtin.boolean
(include_path) @string.special.path
+(identifier) @variable
+
(parameters_declaration (identifier) @variable.parameter)
(function_declaration name: (identifier) @function)
(function_call function: (identifier) @function)
(module_call name: (identifier) @function)
-(identifier) @variable
(special_variable) @variable.builtin
[
@@ -60,4 +61,4 @@
"."
] @punctuation.delimiter
-(comment) @comment \ No newline at end of file
+(comment) @comment
diff --git a/runtime/queries/perl/highlights.scm b/runtime/queries/perl/highlights.scm
index bf5918b9..5f224333 100644
--- a/runtime/queries/perl/highlights.scm
+++ b/runtime/queries/perl/highlights.scm
@@ -39,6 +39,8 @@
(comment) @comment
+(function) @function
+
(eof_marker) @keyword.directive
(data_section) @comment
@@ -95,5 +97,3 @@
(func0op_call_expression function: _ @function.builtin)
(func1op_call_expression function: _ @function.builtin)
-
-(function) @function
diff --git a/runtime/queries/php-only/highlights.scm b/runtime/queries/php-only/highlights.scm
index 9fdbe029..d19e0cee 100644
--- a/runtime/queries/php-only/highlights.scm
+++ b/runtime/queries/php-only/highlights.scm
@@ -1,6 +1,23 @@
(php_tag) @tag
"?>" @tag
+; Variables
+
+(variable_name) @variable
+
+(relative_scope) @variable.builtin
+
+((name) @constant
+ (#match? @constant "^_?[A-Z][A-Z\\d_]+$"))
+((name) @constant.builtin
+ (#match? @constant.builtin "^__[A-Z][A-Z\d_]+__$"))
+
+((name) @constructor
+ (#match? @constructor "^[A-Z]"))
+
+((name) @variable.builtin
+ (#eq? @variable.builtin "this"))
+
; Types
(primitive_type) @type.builtin
@@ -38,23 +55,6 @@
(member_access_expression
name: (name) @variable.other.member)
-; Variables
-
-(relative_scope) @variable.builtin
-
-((name) @constant
- (#match? @constant "^_?[A-Z][A-Z\\d_]+$"))
-((name) @constant.builtin
- (#match? @constant.builtin "^__[A-Z][A-Z\d_]+__$"))
-
-((name) @constructor
- (#match? @constructor "^[A-Z]"))
-
-((name) @variable.builtin
- (#eq? @variable.builtin "this"))
-
-(variable_name) @variable
-
; Basic tokens
[
(string)
diff --git a/runtime/queries/php/highlights.scm b/runtime/queries/php/highlights.scm
index b9429ae8..737e2d5f 100644
--- a/runtime/queries/php/highlights.scm
+++ b/runtime/queries/php/highlights.scm
@@ -1,6 +1,21 @@
(php_tag) @tag
"?>" @tag
+; Variables
+
+(relative_scope) @variable.builtin
+
+(variable_name) @variable
+
+((name) @constant
+ (#match? @constant "^_?[A-Z][A-Z\\d_]+$"))
+
+((name) @constructor
+ (#match? @constructor "^[A-Z]"))
+
+((name) @variable.builtin
+ (#eq? @variable.builtin "this"))
+
; Types
[
(primitive_type)
@@ -110,21 +125,6 @@
(member_access_expression
name: (name) @variable.other.member)
-; Variables
-
-(relative_scope) @variable.builtin
-
-((name) @constant
- (#match? @constant "^_?[A-Z][A-Z\\d_]+$"))
-
-((name) @constructor
- (#match? @constructor "^[A-Z]"))
-
-((name) @variable.builtin
- (#eq? @variable.builtin "this"))
-
-(variable_name) @variable
-
; Attributes
(attribute_list) @attribute
diff --git a/runtime/queries/pkl/highlights.scm b/runtime/queries/pkl/highlights.scm
index 1de6ba3c..f08660d4 100644
--- a/runtime/queries/pkl/highlights.scm
+++ b/runtime/queries/pkl/highlights.scm
@@ -149,14 +149,14 @@
; Identifiers
+(identifier) @variable
+
(classProperty (identifier) @variable.other.member)
(objectProperty (identifier) @variable.other.member)
(parameterList (typedIdentifier (identifier) @variable.parameter))
(objectBodyParameters (typedIdentifier (identifier) @variable.parameter))
-(identifier) @variable
-
; Method definitions
(classMethod (methodHeader (identifier)) @function.method)
diff --git a/runtime/queries/ponylang/highlights.scm b/runtime/queries/ponylang/highlights.scm
index 2d0594a7..f67e9a68 100644
--- a/runtime/queries/ponylang/highlights.scm
+++ b/runtime/queries/ponylang/highlights.scm
@@ -9,6 +9,7 @@
(character) @constant.character
;; strings and docstring
+(string) @string
(source_file docstring: (string) @string.special)
(entity docstring: (string) @string.special)
(method docstring: (string) @string.special) ; docstring for methods without body
@@ -18,7 +19,6 @@
(behavior body: (block . (string) @string.special))
(constructor body: (block . (string) @string.special))
(field docstring: (string) @string.special)
-(string) @string
;; Punctuation
[
@@ -137,6 +137,14 @@
"<="
] @operator
+;; variables
+;; references to upper case things are considered constructors
+(identifier) @variable
+(
+ (identifier) @constructor
+ (#match? @constructor "^[A-Z]")
+)
+
;; Types
(entity name: (identifier) @type)
(nominal_type name: (identifier) @type)
@@ -166,11 +174,3 @@
;; annotations
(annotations (identifier) @attribute)
-;; variables
-;; references to upper case things are considered constructors
-(
- (identifier) @constructor
- (#match @constructor "^[A-Z]")
-)
-(identifier) @variable
-
diff --git a/runtime/queries/purescript/highlights.scm b/runtime/queries/purescript/highlights.scm
index b7868e6e..314fb313 100644
--- a/runtime/queries/purescript/highlights.scm
+++ b/runtime/queries/purescript/highlights.scm
@@ -1,26 +1,11 @@
; ----------------------------------------------------------------------------
-; Record fields would need to come before literal strings in order to be captured correctly
-
- (record_accessor
- field: [ (variable)
- (string)
- (triple_quote_string)
- ] @variable.other.member)
-
- (exp_record_access
- field: [ (variable)
- (string)
- (triple_quote_string)
- ] @variable.other.member)
-
-
-; ----------------------------------------------------------------------------
; Literals and comments
(integer) @constant.numeric.integer
(exp_negation) @constant.numeric.integer
(exp_literal (number)) @constant.numeric.float
(char) @constant.character
+
[
(string)
(triple_quote_string)
@@ -28,7 +13,6 @@
(comment) @comment
-
; ----------------------------------------------------------------------------
; Punctuation
@@ -41,18 +25,19 @@
"]"
] @punctuation.bracket
- [
- (comma)
- ";"
- ] @punctuation.delimiter
+ (comma) @punctuation.delimiter
+; ----------------------------------------------------------------------------
+; Types
+
+ (type) @type
+
+ (constructor) @constructor
; ----------------------------------------------------------------------------
; Keywords, operators, includes
- ; This needs to come before the other "else" in
- ; order to be highlighted correctly
- (class_instance "else" @keyword)
+ (module) @namespace
[
"if"
@@ -95,7 +80,6 @@
] @operator
(qualified_module (module) @constructor)
- (module) @namespace
(qualified_type (module) @namespace)
(qualified_variable (module) @namespace)
(import (module) @namespace)
@@ -122,6 +106,11 @@
"infixr"
] @keyword
+ ; NOTE
+ ; Needs to come after the other `else` in
+ ; order to be highlighted correctly
+ (class_instance "else" @keyword)
+
(type_role_declaration
"role" @keyword
role: (type_role) @keyword)
@@ -131,10 +120,27 @@
; ----------------------------------------------------------------------------
; Functions and variables
+ (variable) @variable
+
(row_field (field_name) @variable.other.member)
(record_field (field_name) @variable.other.member)
(record_field (field_pun) @variable.other.member)
+ ; NOTE
+ ; Record fields must come after literal strings and
+ ; plain variables in order to be highlighted correctly
+ (record_accessor
+ field: [ (variable)
+ (string)
+ (triple_quote_string)
+ ] @variable.other.member)
+
+ (exp_record_access
+ field: [ (variable)
+ (string)
+ (triple_quote_string)
+ ] @variable.other.member)
+
(signature name: (variable) @type)
(function name: (variable) @function)
(class_instance (instance_name) @function)
@@ -151,14 +157,5 @@
(exp_ticked (exp_name (variable) @operator))
(exp_ticked (exp_name (qualified_variable (variable) @operator)))
- (variable) @variable
-
- ("@" @namespace) ; "as" pattern operator, e.g. x@Constructor
-
-; ----------------------------------------------------------------------------
-; Types
-
- (type) @type
-
- (constructor) @constructor
+ (patterns (pat_as "@" @namespace))
diff --git a/runtime/queries/python/highlights.scm b/runtime/queries/python/highlights.scm
index 9f7d2790..0786eba6 100644
--- a/runtime/queries/python/highlights.scm
+++ b/runtime/queries/python/highlights.scm
@@ -1,125 +1,8 @@
-; Imports
-
-(dotted_name
- (identifier)* @namespace)
-
-(aliased_import
- alias: (identifier) @namespace)
-
-; Builtin functions
-
-((call
- function: (identifier) @function.builtin)
- (#match?
- @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 calls
-
-[
- "def"
- "lambda"
-] @keyword.function
-
-(call
- function: (attribute attribute: (identifier) @constructor)
- (#match? @constructor "^[A-Z]"))
-(call
- function: (identifier) @constructor
- (#match? @constructor "^[A-Z]"))
-
-(call
- function: (attribute attribute: (identifier) @function.method))
-
-(call
- function: (identifier) @function)
-
-; Function definitions
-
-(function_definition
- name: (identifier) @constructor
- (#match? @constructor "^(__new__|__init__)$"))
-
-(function_definition
- name: (identifier) @function)
-
-; Decorators
-
-(decorator) @function
-(decorator (identifier) @function)
-(decorator (attribute attribute: (identifier) @function))
-(decorator (call
- function: (attribute attribute: (identifier) @function)))
-
-; Parameters
-
-((identifier) @variable.builtin
- (#match? @variable.builtin "^(self|cls)$"))
-
-(parameters (identifier) @variable.parameter)
-(parameters (typed_parameter (identifier) @variable.parameter))
-(parameters (default_parameter name: (identifier) @variable.parameter))
-(parameters (typed_default_parameter name: (identifier) @variable.parameter))
-
-(parameters
- (list_splat_pattern ; *args
- (identifier) @variable.parameter))
-(parameters
- (dictionary_splat_pattern ; **kwargs
- (identifier) @variable.parameter))
-
-(lambda_parameters
- (identifier) @variable.parameter)
-
-; Types
-
-((identifier) @type.builtin
- (#match?
- @type.builtin
- "^(bool|bytes|dict|float|frozenset|int|list|set|str|tuple)$"))
-
-; In type hints make everything types to catch non-conforming identifiers
-; (e.g., datetime.datetime) and None
-(type [(identifier) (none)] @type)
-; Handle [] . and | nesting 4 levels deep
-(type
- (_ [(identifier) (none)]? @type
- (_ [(identifier) (none)]? @type
- (_ [(identifier) (none)]? @type
- (_ [(identifier) (none)]? @type)))))
-
-(class_definition name: (identifier) @type)
-(class_definition superclasses: (argument_list (identifier) @type))
-
-; Variables
-
-((identifier) @constant
- (#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
-
-((identifier) @type
- (#match? @type "^[A-Z]"))
-
-(attribute attribute: (identifier) @variable.other.member)
-(identifier) @variable
-
-; Literals
-(none) @constant.builtin
-[
- (true)
- (false)
-] @constant.builtin.boolean
-
-(integer) @constant.numeric.integer
-(float) @constant.numeric.float
-(comment) @comment
-(string) @string
-(escape_sequence) @constant.character.escape
-
["," "." ":" ";" (ellipsis)] @punctuation.delimiter
+["(" ")" "[" "]" "{" "}"] @punctuation.bracket
(interpolation
"{" @punctuation.special
"}" @punctuation.special) @embedded
-["(" ")" "[" "]" "{" "}"] @punctuation.bracket
[
"-"
@@ -223,8 +106,128 @@
"is"
] @keyword.operator
+; Literals
+(none) @constant.builtin
+[
+ (true)
+ (false)
+] @constant.builtin.boolean
+
+(integer) @constant.numeric.integer
+(float) @constant.numeric.float
+(comment) @comment
+(string) @string
+(escape_sequence) @constant.character.escape
+
+; Variables
+
+(identifier) @variable
+
+(attribute attribute: (identifier) @variable.other.member)
+
+; Imports
+
+(dotted_name
+ (identifier)* @namespace)
+
+(aliased_import
+ alias: (identifier) @namespace)
+
+; Function calls
+
+[
+ "def"
+ "lambda"
+] @keyword.function
+
+(call
+ function: (attribute attribute: (identifier) @function.method))
+
+(call
+ function: (identifier) @function)
+
+(call
+ function: (attribute attribute: (identifier) @constructor)
+ (#match? @constructor "^[A-Z]"))
+(call
+ function: (identifier) @constructor
+ (#match? @constructor "^[A-Z]"))
+
+; Builtin functions
+
+((call
+ function: (identifier) @function.builtin)
+ (#match?
+ @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)
+
+(function_definition
+ name: (identifier) @constructor
+ (#match? @constructor "^(__new__|__init__)$"))
+
+; Decorators
+
+(decorator) @function
+(decorator (identifier) @function)
+(decorator (attribute attribute: (identifier) @function))
+(decorator (call
+ function: (attribute attribute: (identifier) @function)))
+
+; Parameters
+
+(parameters (identifier) @variable.parameter)
+(parameters (typed_parameter (identifier) @variable.parameter))
+(parameters (default_parameter name: (identifier) @variable.parameter))
+(parameters (typed_default_parameter name: (identifier) @variable.parameter))
+
+(parameters
+ (list_splat_pattern ; *args
+ (identifier) @variable.parameter))
+(parameters
+ (dictionary_splat_pattern ; **kwargs
+ (identifier) @variable.parameter))
+
+(lambda_parameters
+ (identifier) @variable.parameter)
+
+; Builtins, constants, etc.
+
+((identifier) @variable.builtin
+ (#match? @variable.builtin "^(self|cls)$"))
+
((identifier) @type.builtin
(#match? @type.builtin
"^(BaseException|Exception|ArithmeticError|BufferError|LookupError|AssertionError|AttributeError|EOFError|FloatingPointError|GeneratorExit|ImportError|ModuleNotFoundError|IndexError|KeyError|KeyboardInterrupt|MemoryError|NameError|NotImplementedError|OSError|OverflowError|RecursionError|ReferenceError|RuntimeError|StopIteration|StopAsyncIteration|SyntaxError|IndentationError|TabError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ValueError|ZeroDivisionError|EnvironmentError|IOError|WindowsError|BlockingIOError|ChildProcessError|ConnectionError|BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|ConnectionResetError|FileExistsError|FileNotFoundError|InterruptedError|IsADirectoryError|NotADirectoryError|PermissionError|ProcessLookupError|TimeoutError|Warning|UserWarning|DeprecationWarning|PendingDeprecationWarning|SyntaxWarning|RuntimeWarning|FutureWarning|ImportWarning|UnicodeWarning|BytesWarning|ResourceWarning)$"))
+((identifier) @type
+ (#match? @type "^[A-Z]"))
+
+((identifier) @constant
+ (#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
+
+; Types
+
+((identifier) @type.builtin
+ (#match?
+ @type.builtin
+ "^(bool|bytes|dict|float|frozenset|int|list|set|str|tuple)$"))
+
+; In type hints make everything types to catch non-conforming identifiers
+; (e.g., datetime.datetime) and None
+(type [(identifier) (none)] @type)
+; Handle [] . and | nesting 4 levels deep
+(type
+ (_ [(identifier) (none)]? @type
+ (_ [(identifier) (none)]? @type
+ (_ [(identifier) (none)]? @type
+ (_ [(identifier) (none)]? @type)))))
+
+(class_definition name: (identifier) @type)
+(class_definition superclasses: (argument_list (identifier) @type))
+
(ERROR) @error
diff --git a/runtime/queries/r/highlights.scm b/runtime/queries/r/highlights.scm
index 4b931a05..34d70bd8 100644
--- a/runtime/queries/r/highlights.scm
+++ b/runtime/queries/r/highlights.scm
@@ -1,5 +1,6 @@
; highlights.scm
+(identifier) @variable
; Literals
@@ -122,7 +123,5 @@
(namespace_get function: (identifier) @function.method)
(namespace_get_internal function: (identifier) @function.method)
-(identifier) @variable
-
; Error
(ERROR) @error
diff --git a/runtime/queries/rescript/highlights.scm b/runtime/queries/rescript/highlights.scm
index 51d37b87..cfb8a351 100644
--- a/runtime/queries/rescript/highlights.scm
+++ b/runtime/queries/rescript/highlights.scm
@@ -1,5 +1,69 @@
(comment) @comment
+[
+ "."
+ ","
+ "|"
+] @punctuation.delimiter
+
+[
+ "++"
+ "+"
+ "+."
+ "-"
+ "-."
+ "*"
+ "**"
+ "*."
+ "/."
+ "<="
+ "=="
+ "==="
+ "!"
+ "!="
+ "!=="
+ ">="
+ "&&"
+ "||"
+ "="
+ ":="
+ "->"
+ "|>"
+ ":>"
+ "+="
+ (uncurry)
+] @operator
+
+; Explicitly enclose these operators with binary_expression
+; to avoid confusion with JSX tag delimiters
+(binary_expression ["<" ">" "/"] @operator)
+
+[
+ "("
+ ")"
+ "{"
+ "}"
+ "["
+ "]"
+] @punctuation.bracket
+
+(polyvar_type
+ [
+ "["
+ "[>"
+ "[<"
+ "]"
+ ] @punctuation.bracket)
+
+[
+ "~"
+ "?"
+ "=>"
+ ".."
+ "..."
+] @punctuation.special
+
+
; Identifiers
;------------
@@ -143,69 +207,6 @@
"while"
] @keyword.control.conditional
-[
- "."
- ","
- "|"
-] @punctuation.delimiter
-
-[
- "++"
- "+"
- "+."
- "-"
- "-."
- "*"
- "**"
- "*."
- "/."
- "<="
- "=="
- "==="
- "!"
- "!="
- "!=="
- ">="
- "&&"
- "||"
- "="
- ":="
- "->"
- "|>"
- ":>"
- "+="
- (uncurry)
-] @operator
-
-; Explicitly enclose these operators with binary_expression
-; to avoid confusion with JSX tag delimiters
-(binary_expression ["<" ">" "/"] @operator)
-
-[
- "("
- ")"
- "{"
- "}"
- "["
- "]"
-] @punctuation.bracket
-
-(polyvar_type
- [
- "["
- "[>"
- "[<"
- "]"
- ] @punctuation.bracket)
-
-[
- "~"
- "?"
- "=>"
- ".."
- "..."
-] @punctuation.special
-
(ternary_expression ["?" ":"] @operator)
; JSX
diff --git a/runtime/queries/ron/highlights.scm b/runtime/queries/ron/highlights.scm
index 1061d559..fe0545cd 100644
--- a/runtime/queries/ron/highlights.scm
+++ b/runtime/queries/ron/highlights.scm
@@ -1,21 +1,19 @@
-; Literals
-;------------
-
-(string) @string
-(boolean) @constant.builtin.boolean
-(integer) @constant.numeric.integer
-(float) @constant.numeric.float
-(char) @constant.character
-
; Structs
;------------
(enum_variant) @type.enum.variant
(struct_entry (_) @variable.other.member ":")
(struct_name (identifier)) @type
+(unit_struct) @type.builtin
+; Literals
+;------------
-
+(string) @string
+(boolean) @constant.builtin.boolean
+(integer) @constant.numeric.integer
+(float) @constant.numeric.float
+(char) @constant.character
; Comments
;------------
@@ -37,6 +35,7 @@
"{" @punctuation.bracket
"}" @punctuation.bracket
+"-" @operator
; Special
;------------
diff --git a/runtime/queries/ruby/highlights.scm b/runtime/queries/ruby/highlights.scm
index 7c69276b..35babfe3 100644
--- a/runtime/queries/ruby/highlights.scm
+++ b/runtime/queries/ruby/highlights.scm
@@ -1,3 +1,81 @@
+; Operators
+[
+":"
+"?"
+"~"
+"=>"
+"->"
+"!"
+] @operator
+
+(assignment
+ "=" @operator)
+
+(operator_assignment
+ operator: ["+=" "-=" "*=" "**=" "/=" "||=" "|=" "&&=" "&=" "%=" ">>=" "<<=" "^="] @operator)
+
+(binary
+ operator: ["/" "|" "==" "===" "||" "&&" ">>" "<<" "<" ">" "<=" ">=" "&" "^" "!~" "=~" "<=>" "**" "*" "!=" "%" "-" "+"] @operator)
+
+(range
+ operator: [".." "..."] @operator)
+
+[
+ ","
+ ";"
+ "."
+ "&."
+] @punctuation.delimiter
+
+[
+ "|"
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+ "%w("
+ "%i("
+] @punctuation.bracket
+
+; Identifiers
+
+[
+ (identifier)
+] @variable
+((identifier) @function.method
+ (#is-not? local))
+
+[
+ (class_variable)
+ (instance_variable)
+] @variable.other.member
+
+((identifier) @constant.builtin
+ (#match? @constant.builtin "^(__FILE__|__LINE__|__ENCODING__)$"))
+
+((constant) @constant.builtin
+ (#match? @constant.builtin "^(ENV|ARGV|ARGF|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING)$"))
+
+((constant) @constant
+ (#match? @constant "^[A-Z\\d_]+$"))
+
+(constant) @constructor
+
+(self) @variable.builtin
+(super) @function.builtin
+
+[(forward_parameter)(forward_argument)] @variable.parameter
+(keyword_parameter name:((_)":" @variable.parameter) @variable.parameter)
+(optional_parameter name:((_)"=" @operator) @variable.parameter)
+(optional_parameter name: (identifier) @variable.parameter)
+(splat_parameter name: (identifier) @variable.parameter) @variable.parameter
+(hash_splat_parameter name: (identifier) @variable.parameter) @variable.parameter
+(method_parameters (identifier) @variable.parameter)
+(block_parameter (identifier) @variable.parameter)
+(block_parameters (identifier) @variable.parameter)
+
; Keywords
[
@@ -73,43 +151,6 @@
(method name: [(identifier) (constant)] @function.method)
(singleton_method name: [(identifier) (constant)] @function.method)
-; Identifiers
-
-[
- (class_variable)
- (instance_variable)
-] @variable.other.member
-
-((identifier) @constant.builtin
- (#match? @constant.builtin "^(__FILE__|__LINE__|__ENCODING__)$"))
-
-((constant) @constant.builtin
- (#match? @constant.builtin "^(ENV|ARGV|ARGF|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING)$"))
-
-((constant) @constant
- (#match? @constant "^[A-Z\\d_]+$"))
-
-(constant) @constructor
-
-(self) @variable.builtin
-(super) @function.builtin
-
-[(forward_parameter)(forward_argument)] @variable.parameter
-(keyword_parameter name:((_)":" @variable.parameter) @variable.parameter)
-(optional_parameter name:((_)"=" @operator) @variable.parameter)
-(optional_parameter name: (identifier) @variable.parameter)
-(splat_parameter name: (identifier) @variable.parameter) @variable.parameter
-(hash_splat_parameter name: (identifier) @variable.parameter) @variable.parameter
-(method_parameters (identifier) @variable.parameter)
-(block_parameter (identifier) @variable.parameter)
-(block_parameters (identifier) @variable.parameter)
-
-((identifier) @function.method
- (#is-not? local))
-[
- (identifier)
-] @variable
-
; Literals
[
@@ -147,44 +188,3 @@
"}" @punctuation.special) @embedded
(comment) @comment
-
-; Operators
-[
-":"
-"?"
-"~"
-"=>"
-"->"
-"!"
-] @operator
-
-(assignment
- "=" @operator)
-
-(operator_assignment
- operator: ["+=" "-=" "*=" "**=" "/=" "||=" "|=" "&&=" "&=" "%=" ">>=" "<<=" "^="] @operator)
-
-(binary
- operator: ["/" "|" "==" "===" "||" "&&" ">>" "<<" "<" ">" "<=" ">=" "&" "^" "!~" "=~" "<=>" "**" "*" "!=" "%" "-" "+"] @operator)
-
-(range
- operator: [".." "..."] @operator)
-
-[
- ","
- ";"
- "."
- "&."
-] @punctuation.delimiter
-
-[
- "|"
- "("
- ")"
- "["
- "]"
- "{"
- "}"
- "%w("
- "%i("
-] @punctuation.bracket
diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm
index 32424ac2..66a21ffb 100644
--- a/runtime/queries/rust/highlights.scm
+++ b/runtime/queries/rust/highlights.scm
@@ -1,10 +1,90 @@
; -------
-; Tree-Sitter doesn't allow overrides in regards to captures,
-; though it is possible to affect the child node of a captured
-; node. Thus, the approach here is to flip the order so that
-; overrides are unnecessary.
+; Basic identifiers
; -------
+; We do not style ? as an operator on purpose as it allows styling ? differently, as many highlighters do. @operator.special might have been a better scope, but @special is already documented so the change would break themes (including the intent of the default theme)
+"?" @special
+
+(type_identifier) @type
+(identifier) @variable
+(field_identifier) @variable.other.member
+
+; -------
+; Operators
+; -------
+
+[
+ "*"
+ "'"
+ "->"
+ "=>"
+ "<="
+ "="
+ "=="
+ "!"
+ "!="
+ "%"
+ "%="
+ "&"
+ "&="
+ "&&"
+ "|"
+ "|="
+ "||"
+ "^"
+ "^="
+ "*"
+ "*="
+ "-"
+ "-="
+ "+"
+ "+="
+ "/"
+ "/="
+ ">"
+ "<"
+ ">="
+ ">>"
+ "<<"
+ ">>="
+ "<<="
+ "@"
+ ".."
+ "..="
+ "'"
+] @operator
+
+; -------
+; Paths
+; -------
+
+(use_declaration
+ argument: (identifier) @namespace)
+(use_wildcard
+ (identifier) @namespace)
+(extern_crate_declaration
+ name: (identifier) @namespace
+ alias: (identifier)? @namespace)
+(mod_item
+ name: (identifier) @namespace)
+(scoped_use_list
+ path: (identifier)? @namespace)
+(use_list
+ (identifier) @namespace)
+(use_as_clause
+ path: (identifier)? @namespace
+ alias: (identifier) @namespace)
+
+; ---
+; Remaining Paths
+; ---
+
+(scoped_identifier
+ path: (identifier)? @namespace
+ name: (identifier) @namespace)
+(scoped_type_identifier
+ path: (identifier) @namespace)
+
; -------
; Types
; -------
@@ -15,6 +95,8 @@
left: (type_identifier) @type.parameter)
(optional_type_parameter
name: (type_identifier) @type.parameter)
+(type_arguments
+ (type_identifier))
; ---
; Primitives
@@ -283,8 +365,41 @@
(#match? @constructor "^[A-Z]"))
; -------
+; Functions
+; -------
+
+(call_expression
+ function: [
+ ((identifier) @function)
+ (scoped_identifier
+ name: (identifier) @function)
+ (field_expression
+ field: (field_identifier) @function)
+ ])
+(generic_function
+ function: [
+ ((identifier) @function)
+ (scoped_identifier
+ name: (identifier) @function)
+ (field_expression
+ field: (field_identifier) @function.method)
+ ])
+
+(function_item
+ name: (identifier) @function)
+
+(function_signature_item
+ name: (identifier) @function)
+
+; -------
; Guess Other Types
; -------
+; Other PascalCase identifiers are assumed to be structs.
+
+((identifier) @type
+ (#match? @type "^[A-Z]"))
+
+(never_type "!" @type)
((identifier) @constant
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
@@ -320,42 +435,6 @@
(#match? @constructor "^[A-Z]")))
; ---
-; Other PascalCase identifiers are assumed to be structs.
-; ---
-
-((identifier) @type
- (#match? @type "^[A-Z]"))
-
-(never_type "!" @type)
-
-; -------
-; Functions
-; -------
-
-(call_expression
- function: [
- ((identifier) @function)
- (scoped_identifier
- name: (identifier) @function)
- (field_expression
- field: (field_identifier) @function)
- ])
-(generic_function
- function: [
- ((identifier) @function)
- (scoped_identifier
- name: (identifier) @function)
- (field_expression
- field: (field_identifier) @function.method)
- ])
-
-(function_item
- name: (identifier) @function)
-
-(function_signature_item
- name: (identifier) @function)
-
-; ---
; Macros
; ---
@@ -389,90 +468,3 @@
(metavariable) @variable.parameter
(fragment_specifier) @type
-
-; -------
-; Operators
-; -------
-
-[
- "*"
- "'"
- "->"
- "=>"
- "<="
- "="
- "=="
- "!"
- "!="
- "%"
- "%="
- "&"
- "&="
- "&&"
- "|"
- "|="
- "||"
- "^"
- "^="
- "*"
- "*="
- "-"
- "-="
- "+"
- "+="
- "/"
- "/="
- ">"
- "<"
- ">="
- ">>"
- "<<"
- ">>="
- "<<="
- "@"
- ".."
- "..="
- "'"
-] @operator
-
-; -------
-; Paths
-; -------
-
-(use_declaration
- argument: (identifier) @namespace)
-(use_wildcard
- (identifier) @namespace)
-(extern_crate_declaration
- name: (identifier) @namespace
- alias: (identifier)? @namespace)
-(mod_item
- name: (identifier) @namespace)
-(scoped_use_list
- path: (identifier)? @namespace)
-(use_list
- (identifier) @namespace)
-(use_as_clause
- path: (identifier)? @namespace
- alias: (identifier) @namespace)
-
-; ---
-; Remaining Paths
-; ---
-
-(scoped_identifier
- path: (identifier)? @namespace
- name: (identifier) @namespace)
-(scoped_type_identifier
- path: (identifier) @namespace)
-
-; -------
-; Remaining Identifiers
-; -------
-
-; We do not style ? as an operator on purpose as it allows styling ? differently, as many highlighters do. @operator.special might have been a better scope, but @special is already documented so the change would break themes (including the intent of the default theme)
-"?" @special
-
-(type_identifier) @type
-(identifier) @variable
-(field_identifier) @variable.other.member
diff --git a/runtime/queries/scala/highlights.scm b/runtime/queries/scala/highlights.scm
index e21a3909..5e5d63e4 100644
--- a/runtime/queries/scala/highlights.scm
+++ b/runtime/queries/scala/highlights.scm
@@ -2,6 +2,9 @@
;; variables
+(identifier) @variable
+
+(operator_identifier) @operator
((identifier) @variable.builtin
(#match? @variable.builtin "^this$"))
@@ -262,7 +265,3 @@
(case_block
(case_clause ("case") @keyword.control.conditional))
-
-(identifier) @variable
-
-(operator_identifier) @operator
diff --git a/runtime/queries/scheme/highlights.scm b/runtime/queries/scheme/highlights.scm
index c7050847..a0c15a12 100644
--- a/runtime/queries/scheme/highlights.scm
+++ b/runtime/queries/scheme/highlights.scm
@@ -10,32 +10,28 @@
(block_comment) @comment.block
(directive) @keyword.directive
-; operators
+; variables
-((symbol) @operator
- (#match? @operator "^(\\+|-|\\*|/|=|>|<|>=|<=)$"))
+((symbol) @variable.builtin
+ (#eq? @variable.builtin "..."))
-; keywords
+((symbol) @variable.builtin
+ (#eq? @variable.builtin "."))
-(list
- .
- ((symbol) @keyword.conditional
- (#match? @keyword.conditional "^(if|cond|case|when|unless)$"
- )))
-
-(list
- .
- (symbol) @keyword
- (#match? @keyword
- "^(define-syntax|let\\*|lambda|λ|case|=>|quote-splicing|unquote-splicing|set!|let|letrec|letrec-syntax|let-values|let\\*-values|do|else|define|cond|syntax-rules|unquote|begin|quote|let-syntax|and|if|quasiquote|letrec|delay|or|when|unless|identifier-syntax|assert|library|export|import|rename|only|except|prefix)$"
- ))
+(symbol) @variable
+
+["(" ")" "[" "]" "{" "}"] @punctuation.bracket
+
+(quote "'") @operator
+(unquote_splicing ",@") @operator
+(unquote ",") @operator
+(quasiquote "`") @operator
+
+; procedure
(list
.
- (symbol) @function.builtin
- (#match? @function.builtin
- "^(caar|cadr|call-with-input-file|call-with-output-file|cdar|cddr|list|open-input-file|open-output-file|with-input-from-file|with-output-to-file|\\*|\\+|-|/|<|<=|=|>|>=|abs|acos|angle|append|apply|asin|assoc|assq|assv|atan|boolean\\?|caaaar|caaadr|caaar|caadar|caaddr|caadr|cadaar|cadadr|cadar|caddar|cadddr|caddr|call-with-current-continuation|call-with-values|car|cdaaar|cdaadr|cdaar|cdadar|cdaddr|cdadr|cddaar|cddadr|cddar|cdddar|cddddr|cdddr|cdr|ceiling|char->integer|char-alphabetic\\?|char-ci<=\\?|char-ci<\\?|char-ci=\\?|char-ci>=\\?|char-ci>\\?|char-downcase|char-lower-case\\?|char-numeric\\?|char-ready\\?|char-upcase|char-upper-case\\?|char-whitespace\\?|char<=\\?|char<\\?|char=\\?|char>=\\?|char>\\?|char\\?|close-input-port|close-output-port|complex\\?|cons|cos|current-error-port|current-input-port|current-output-port|denominator|display|dynamic-wind|eof-object\\?|eq\\?|equal\\?|eqv\\?|eval|even\\?|exact->inexact|exact\\?|exp|expt|floor|flush-output|for-each|force|gcd|imag-part|inexact->exact|inexact\\?|input-port\\?|integer->char|integer\\?|interaction-environment|lcm|length|list->string|list->vector|list-ref|list-tail|list\\?|load|log|magnitude|make-polar|make-rectangular|make-string|make-vector|map|max|member|memq|memv|min|modulo|negative\\?|newline|not|null-environment|null\\?|number->string|number\\?|numerator|odd\\?|output-port\\?|pair\\?|peek-char|positive\\?|procedure\\?|quotient|rational\\?|rationalize|read|read-char|real-part|real\\?|remainder|reverse|round|scheme-report-environment|set-car!|set-cdr!|sin|sqrt|string|string->list|string->number|string->symbol|string-append|string-ci<=\\?|string-ci<\\?|string-ci=\\?|string-ci>=\\?|string-ci>\\?|string-copy|string-fill!|string-length|string-ref|string-set!|string<=\\?|string<\\?|string=\\?|string>=\\?|string>\\?|string\\?|substring|symbol->string|symbol\\?|tan|transcript-off|transcript-on|truncate|values|vector|vector->list|vector-fill!|vector-length|vector-ref|vector-set!|vector\\?|write|write-char|zero\\?)$"
- ))
+ (symbol) @function)
; special forms
@@ -62,12 +58,10 @@
(#match? @_f
"^(let|let\\*|let-syntax|let-values|let\\*-values|letrec|letrec\\*|letrec-syntax)$"))
-; quote
+; operators
-(list
- .
- (symbol) @_f
- (#eq? @_f "quote")) @string.symbol
+((symbol) @operator
+ (#match? @operator "^(\\+|-|\\*|/|=|>|<|>=|<=)$"))
; library
@@ -79,26 +73,31 @@
(#eq? @_lib "library"))
-; procedure
+; quote
(list
- .
- (symbol) @function)
-
-;; variables
-
-((symbol) @variable.builtin
- (#eq? @variable.builtin "..."))
-
-((symbol) @variable.builtin
- (#eq? @variable.builtin "."))
-
-(symbol) @variable
+ .
+ (symbol) @_f
+ (#eq? @_f "quote")) @string.symbol
-["(" ")" "[" "]" "{" "}"] @punctuation.bracket
+; keywords
-(quote "'") @operator
-(unquote_splicing ",@") @operator
-(unquote ",") @operator
-(quasiquote "`") @operator
+(list
+ .
+ ((symbol) @keyword.conditional
+ (#match? @keyword.conditional "^(if|cond|case|when|unless)$"
+ )))
+
+(list
+ .
+ (symbol) @keyword
+ (#match? @keyword
+ "^(define-syntax|let\\*|lambda|λ|case|=>|quote-splicing|unquote-splicing|set!|let|letrec|letrec-syntax|let-values|let\\*-values|do|else|define|cond|syntax-rules|unquote|begin|quote|let-syntax|and|if|quasiquote|letrec|delay|or|when|unless|identifier-syntax|assert|library|export|import|rename|only|except|prefix)$"
+ ))
+(list
+ .
+ (symbol) @function.builtin
+ (#match? @function.builtin
+ "^(caar|cadr|call-with-input-file|call-with-output-file|cdar|cddr|list|open-input-file|open-output-file|with-input-from-file|with-output-to-file|\\*|\\+|-|/|<|<=|=|>|>=|abs|acos|angle|append|apply|asin|assoc|assq|assv|atan|boolean\\?|caaaar|caaadr|caaar|caadar|caaddr|caadr|cadaar|cadadr|cadar|caddar|cadddr|caddr|call-with-current-continuation|call-with-values|car|cdaaar|cdaadr|cdaar|cdadar|cdaddr|cdadr|cddaar|cddadr|cddar|cdddar|cddddr|cdddr|cdr|ceiling|char->integer|char-alphabetic\\?|char-ci<=\\?|char-ci<\\?|char-ci=\\?|char-ci>=\\?|char-ci>\\?|char-downcase|char-lower-case\\?|char-numeric\\?|char-ready\\?|char-upcase|char-upper-case\\?|char-whitespace\\?|char<=\\?|char<\\?|char=\\?|char>=\\?|char>\\?|char\\?|close-input-port|close-output-port|complex\\?|cons|cos|current-error-port|current-input-port|current-output-port|denominator|display|dynamic-wind|eof-object\\?|eq\\?|equal\\?|eqv\\?|eval|even\\?|exact->inexact|exact\\?|exp|expt|floor|flush-output|for-each|force|gcd|imag-part|inexact->exact|inexact\\?|input-port\\?|integer->char|integer\\?|interaction-environment|lcm|length|list->string|list->vector|list-ref|list-tail|list\\?|load|log|magnitude|make-polar|make-rectangular|make-string|make-vector|map|max|member|memq|memv|min|modulo|negative\\?|newline|not|null-environment|null\\?|number->string|number\\?|numerator|odd\\?|output-port\\?|pair\\?|peek-char|positive\\?|procedure\\?|quotient|rational\\?|rationalize|read|read-char|real-part|real\\?|remainder|reverse|round|scheme-report-environment|set-car!|set-cdr!|sin|sqrt|string|string->list|string->number|string->symbol|string-append|string-ci<=\\?|string-ci<\\?|string-ci=\\?|string-ci>=\\?|string-ci>\\?|string-copy|string-fill!|string-length|string-ref|string-set!|string<=\\?|string<\\?|string=\\?|string>=\\?|string>\\?|string\\?|substring|symbol->string|symbol\\?|tan|transcript-off|transcript-on|truncate|values|vector|vector->list|vector-fill!|vector-length|vector-ref|vector-set!|vector\\?|write|write-char|zero\\?)$"
+ ))
diff --git a/runtime/queries/scss/highlights.scm b/runtime/queries/scss/highlights.scm
index de20e047..eb361f96 100644
--- a/runtime/queries/scss/highlights.scm
+++ b/runtime/queries/scss/highlights.scm
@@ -43,6 +43,8 @@
"@warn" @constant.builtin
"@while" @keyword.control.repeat
+(property_name) @variable.other.member
+
((property_name) @variable
(#match? @variable "^--"))
((plain_value) @variable
@@ -59,7 +61,6 @@
(class_name) @variable
(id_name) @variable
(namespace_name) @variable
-(property_name) @variable.other.member
(feature_name) @variable
(variable) @variable
(variable_name) @variable.other.member
diff --git a/runtime/queries/solidity/highlights.scm b/runtime/queries/solidity/highlights.scm
index 0701a5ab..0e49429d 100644
--- a/runtime/queries/solidity/highlights.scm
+++ b/runtime/queries/solidity/highlights.scm
@@ -1,3 +1,9 @@
+; identifiers
+; -----------
+(identifier) @variable
+((identifier) @variable.builtin (#any-of? @variable.builtin "this" "msg" "block" "tx"))
+(yul_identifier) @variable
+
; Pragma
(pragma_directive) @keyword.directive
(solidity_version_comparison_operator _ @keyword.directive)
@@ -231,10 +237,3 @@
"delete"
"new"
] @keyword.operator
-
-; identifiers
-; -----------
-((identifier) @variable.builtin (#any-of? @variable.builtin "this" "msg" "block" "tx"))
-(identifier) @variable
-(yul_identifier) @variable
-
diff --git a/runtime/queries/strace/highlights.scm b/runtime/queries/strace/highlights.scm
index 4f54cb3e..82ba7068 100644
--- a/runtime/queries/strace/highlights.scm
+++ b/runtime/queries/strace/highlights.scm
@@ -1,4 +1,4 @@
-(syscall) @function
+(syscall) @function.builtin
(integer) @constant.numeric
(pointer) @constant.numeric
(value) @label
diff --git a/runtime/queries/sway/highlights.scm b/runtime/queries/sway/highlights.scm
index 98f4d449..969ef776 100644
--- a/runtime/queries/sway/highlights.scm
+++ b/runtime/queries/sway/highlights.scm
@@ -1,14 +1,87 @@
; -------
-; Tree-Sitter doesn't allow overrides in regards to captures,
-; though it is possible to affect the child node of a captured
-; node. Thus, the approach here is to flip the order so that
-; overrides are unnecessary.
+; Basic identifiers
; -------
+; We do not style ? as an operator on purpose as it allows styling ? differently, as many highlighters do. @operator.special might have been a better scope, but @special is already documented so the change would break themes (including the intent of the default theme)
+"?" @special
+
+(type_identifier) @type
+(identifier) @variable
+(field_identifier) @variable.other.member
+
; -------
-; Types
+; Operators
; -------
+[
+ "*"
+ "'"
+ "->"
+ "=>"
+ "<="
+ "="
+ "=="
+ "!"
+ "!="
+ "%"
+ "%="
+ "&"
+ "&="
+ "&&"
+ "|"
+ "|="
+ "||"
+ "^"
+ "^="
+ "*"
+ "*="
+ "-"
+ "-="
+ "+"
+ "+="
+ "/"
+ "/="
+ ">"
+ "<"
+ ">="
+ ">>"
+ "<<"
+ ">>="
+ "<<="
+ "@"
+ ".."
+ "..="
+ "'"
+] @operator
+
+; -------
+; Paths
+; -------
+
+(use_declaration
+ argument: (identifier) @namespace)
+(use_wildcard
+ (identifier) @namespace)
+(dep_item
+ name: (identifier) @namespace)
+(scoped_use_list
+ path: (identifier)? @namespace)
+(use_list
+ (identifier) @namespace)
+(use_as_clause
+ path: (identifier)? @namespace
+ alias: (identifier) @namespace)
+
+; ---
+; Remaining Paths
+; ---
+
+(scoped_identifier
+ path: (identifier)? @namespace
+ name: (identifier) @namespace)
+(scoped_type_identifier
+ path: (identifier) @namespace)
+
; ---
; Primitives
; ---
@@ -179,6 +252,10 @@
; -------
; Guess Other Types
; -------
+; Other PascalCase identifiers are assumed to be structs.
+
+((identifier) @type
+ (#match? @type "^[A-Z]"))
((identifier) @constant
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
@@ -190,40 +267,28 @@
(call_expression
function: [
- ((identifier) @type.enum.variant
- (#match? @type.enum.variant "^[A-Z]"))
+ ((identifier) @constructor
+ (#match? @constructor "^[A-Z]"))
(scoped_identifier
- name: ((identifier) @type.enum.variant
- (#match? @type.enum.variant "^[A-Z]")))
+ name: ((identifier) @constructor
+ (#match? @constructor "^[A-Z]")))
])
; ---
-; Assume that types in match arms are enums and not
-; tuple structs. Same for `if let` expressions.
-; ---
-
-(match_pattern
- (scoped_identifier
- name: (identifier) @constructor))
-(tuple_struct_pattern
- type: [
- ((identifier) @constructor)
- (scoped_identifier
- name: (identifier) @constructor)
- ])
-(struct_pattern
- type: [
- ((type_identifier) @constructor)
- (scoped_type_identifier
- name: (type_identifier) @constructor)
- ])
-
-; ---
-; Other PascalCase identifiers are assumed to be structs.
+; PascalCase identifiers under a path which is also PascalCase
+; are assumed to be constructors if they have methods or fields.
; ---
-((identifier) @type
- (#match? @type "^[A-Z]"))
+(field_expression
+ value: (scoped_identifier
+ path: [
+ (identifier) @type
+ (scoped_identifier
+ name: (identifier) @type)
+ ]
+ name: (identifier) @constructor
+ (#match? @type "^[A-Z]")
+ (#match? @constructor "^[A-Z]")))
; -------
; Functions
@@ -251,86 +316,3 @@
(function_signature_item
name: (identifier) @function)
-
-; -------
-; Operators
-; -------
-
-[
- "*"
- "'"
- "->"
- "=>"
- "<="
- "="
- "=="
- "!"
- "!="
- "%"
- "%="
- "&"
- "&="
- "&&"
- "|"
- "|="
- "||"
- "^"
- "^="
- "*"
- "*="
- "-"
- "-="
- "+"
- "+="
- "/"
- "/="
- ">"
- "<"
- ">="
- ">>"
- "<<"
- ">>="
- "<<="
- "@"
- ".."
- "..="
- "'"
-] @operator
-
-; -------
-; Paths
-; -------
-
-(use_declaration
- argument: (identifier) @namespace)
-(use_wildcard
- (identifier) @namespace)
-(dep_item
- name: (identifier) @namespace)
-(scoped_use_list
- path: (identifier)? @namespace)
-(use_list
- (identifier) @namespace)
-(use_as_clause
- path: (identifier)? @namespace
- alias: (identifier) @namespace)
-
-; ---
-; Remaining Paths
-; ---
-
-(scoped_identifier
- path: (identifier)? @namespace
- name: (identifier) @namespace)
-(scoped_type_identifier
- path: (identifier) @namespace)
-
-; -------
-; Remaining Identifiers
-; -------
-
-"?" @special
-
-(type_identifier) @type
-(identifier) @variable
-(field_identifier) @variable.other.member
diff --git a/runtime/queries/swift/highlights.scm b/runtime/queries/swift/highlights.scm
index df05a643..ecafde40 100644
--- a/runtime/queries/swift/highlights.scm
+++ b/runtime/queries/swift/highlights.scm
@@ -6,7 +6,48 @@
["." ";" ":" "," ] @punctuation.delimiter
["(" ")" "[" "]" "{" "}" "<" ">"] @punctuation.bracket
+; Operators
+[
+ "!"
+ "?"
+ "+"
+ "-"
+ "\\"
+ "*"
+ "/"
+ "%"
+ "="
+ "+="
+ "-="
+ "*="
+ "/="
+ "<"
+ ">"
+ "<="
+ ">="
+ "++"
+ "--"
+ "&"
+ "~"
+ "%="
+ "!="
+ "!=="
+ "=="
+ "==="
+ "??"
+
+ "->"
+
+ "..<"
+ "..."
+ (custom_operator)
+] @operator
+
+"?" @type
+(type_annotation "!" @type)
+
; Identifiers
+(simple_identifier) @variable
(attribute) @variable
(type_identifier) @type
(self_expression) @variable.builtin
@@ -153,48 +194,6 @@
(boolean_literal) @constant.builtin.boolean
"nil" @constant.builtin
-"?" @type
-(type_annotation "!" @type)
-
-(simple_identifier) @variable
-
-; Operators
-[
- "!"
- "?"
- "+"
- "-"
- "\\"
- "*"
- "/"
- "%"
- "="
- "+="
- "-="
- "*="
- "/="
- "<"
- ">"
- "<="
- ">="
- "++"
- "--"
- "&"
- "~"
- "%="
- "!="
- "!=="
- "=="
- "==="
- "??"
-
- "->"
-
- "..<"
- "..."
- (custom_operator)
-] @operator
-
(value_parameter_pack ["each" @keyword])
(value_pack_expansion ["repeat" @keyword])
(type_parameter_pack ["each" @keyword])
diff --git a/runtime/queries/t32/highlights.scm b/runtime/queries/t32/highlights.scm
index 8a29cee2..bcfa3add 100644
--- a/runtime/queries/t32/highlights.scm
+++ b/runtime/queries/t32/highlights.scm
@@ -81,6 +81,10 @@
"."
] @punctuation.delimiter
+; HLL variables
+(identifier) @variable
+(hll_field_identifier) @variable.other.member
+
; Strings and others literal types
(access_class) @constant.builtin
@@ -219,9 +223,5 @@
command: (identifier) @keyword.control.loop)
-; HLL variables
-(identifier) @variable
-(hll_field_identifier) @variable.other.member
-
(comment) @comment
diff --git a/runtime/queries/tact/highlights.scm b/runtime/queries/tact/highlights.scm
index 53bf985b..51b1ea9e 100644
--- a/runtime/queries/tact/highlights.scm
+++ b/runtime/queries/tact/highlights.scm
@@ -9,40 +9,90 @@
"@interface"
] @attribute
-; comment.line
-; ------------
+; operator
+; --------
-((comment) @comment.line
- (#match? @comment.line "^//"))
+[
+ "-" "-="
+ "+" "+="
+ "*" "*="
+ "/" "/="
+ "%" "%="
+ "=" "=="
+ "!" "!=" "!!"
+ "<" "<=" "<<"
+ ">" ">=" ">>"
+ "&" "|"
+ "&&" "||"
+] @operator
-; comment.block
-; -------------
+; punctuation.bracket
+; -------------------
-(comment) @comment.block
+[
+ "(" ")"
+ "{" "}"
+] @punctuation.bracket
-; function.builtin
+; punctuation.delimiter
+; ---------------------
+
+[
+ ";"
+ ","
+ "."
+ ":"
+ "?"
+] @punctuation.delimiter
+
+; variable
+; --------
+
+(identifier) @variable
+
+; variable.builtin
; ----------------
-((identifier) @function.builtin
- (#any-of? @function.builtin
- "send" "sender" "require" "now"
- "myBalance" "myAddress" "newAddress"
- "contractAddress" "contractAddressExt"
- "emit" "cell" "ton"
- "beginString" "beginComment" "beginTailString" "beginStringFromBuilder" "beginCell" "emptyCell"
- "randomInt" "random"
- "checkSignature" "checkDataSignature" "sha256"
- "min" "max" "abs" "pow"
- "throw" "dump" "getConfigParam"
- "nativeThrowWhen" "nativeThrowUnless" "nativeReserve"
- "nativeRandomize" "nativeRandomizeLt" "nativePrepareRandom" "nativeRandom" "nativeRandomInterval")
- (#is-not? local))
+(self) @variable.builtin
-; function.method
-; ---------------
+; variable.parameter
+; ------------------
-(method_call_expression
- name: (identifier) @function.method)
+(parameter
+ name: (identifier) @variable.parameter)
+
+; variable.other.member
+; ---------------------
+
+(field
+ name: (identifier) @variable.other.member)
+
+(contract_body
+ (constant
+ name: (identifier) @variable.other.member))
+
+(trait_body
+ (constant
+ name: (identifier) @variable.other.member))
+
+(field_access_expression
+ name: (identifier) @variable.other.member)
+
+(lvalue (_) (_) @variable.other.member)
+
+(instance_argument
+ name: (identifier) @variable.other.member)
+
+; comment.block
+; -------------
+
+(comment) @comment.block
+
+; comment.line
+; ------------
+
+((comment) @comment.line
+ (#match? @comment.line "^//"))
; function
; --------
@@ -73,6 +123,30 @@
(function
name: (identifier) @function.method)
+; function.method
+; ---------------
+
+(method_call_expression
+ name: (identifier) @function.method)
+
+; function.builtin
+; ----------------
+
+((identifier) @function.builtin
+ (#any-of? @function.builtin
+ "send" "sender" "require" "now"
+ "myBalance" "myAddress" "newAddress"
+ "contractAddress" "contractAddressExt"
+ "emit" "cell" "ton"
+ "beginString" "beginComment" "beginTailString" "beginStringFromBuilder" "beginCell" "emptyCell"
+ "randomInt" "random"
+ "checkSignature" "checkDataSignature" "sha256"
+ "min" "max" "abs" "pow"
+ "throw" "dump" "getConfigParam"
+ "nativeThrowWhen" "nativeThrowUnless" "nativeReserve"
+ "nativeRandomize" "nativeRandomizeLt" "nativePrepareRandom" "nativeRandom" "nativeRandomInterval")
+ (#is-not? local))
+
; keyword.control.conditional
; ---------------------------
@@ -169,16 +243,21 @@
(constant
name: (identifier) @constant)
+; string
+; ------
+
+(string) @string
+
; string.special.path
; -------------------
(import_statement
library: (string) @string.special.path)
-; string
-; ------
+; type
+; ----
-(string) @string
+(type_identifier) @type
; type.builtin
; ------------
@@ -209,11 +288,6 @@
(#eq? @type.builtin "SendParameters")
(#is-not? local))
-; type
-; ----
-
-(type_identifier) @type
-
; constructor
; -----------
@@ -222,77 +296,3 @@
(initOf
name: (identifier) @constructor)
-
-; operator
-; --------
-
-[
- "-" "-="
- "+" "+="
- "*" "*="
- "/" "/="
- "%" "%="
- "=" "=="
- "!" "!=" "!!"
- "<" "<=" "<<"
- ">" ">=" ">>"
- "&" "|"
- "&&" "||"
-] @operator
-
-; punctuation.bracket
-; -------------------
-
-[
- "(" ")"
- "{" "}"
-] @punctuation.bracket
-
-; punctuation.delimiter
-; ---------------------
-
-[
- ";"
- ","
- "."
- ":"
- "?"
-] @punctuation.delimiter
-
-; variable.other.member
-; ---------------------
-
-(field
- name: (identifier) @variable.other.member)
-
-(contract_body
- (constant
- name: (identifier) @variable.other.member))
-
-(trait_body
- (constant
- name: (identifier) @variable.other.member))
-
-(field_access_expression
- name: (identifier) @variable.other.member)
-
-(lvalue (_) (_) @variable.other.member)
-
-(instance_argument
- name: (identifier) @variable.other.member)
-
-; variable.parameter
-; ------------------
-
-(parameter
- name: (identifier) @variable.parameter)
-
-; variable.builtin
-; ----------------
-
-(self) @variable.builtin
-
-; variable
-; --------
-
-(identifier) @variable
diff --git a/runtime/queries/tsq/highlights.scm b/runtime/queries/tsq/highlights.scm
index a7fd0b38..4ef463a6 100644
--- a/runtime/queries/tsq/highlights.scm
+++ b/runtime/queries/tsq/highlights.scm
@@ -36,12 +36,12 @@
(named_node
name: (identifier) @tag)
+(predicate name: (identifier) @error)
((predicate
"#" @function.builtin
name: (identifier) @function.builtin @_name
type: (predicate_type) @function.builtin)
(#any-of? @_name "eq" "not-eq" "match" "not-match" "any-of" "not-any-of" "is" "is-not" "not-same-line" "not-kind-eq" "set" "select-adjacent" "strip"))
-(predicate name: (identifier) @error)
(capture) @label
diff --git a/runtime/queries/tsx/highlights.scm b/runtime/queries/tsx/highlights.scm
index 721c56c7..83c7617f 100644
--- a/runtime/queries/tsx/highlights.scm
+++ b/runtime/queries/tsx/highlights.scm
@@ -1,3 +1,3 @@
; See runtime/queries/ecma/README.md for more info.
-; inherits: _jsx,_typescript,ecma
+; inherits: ecma,_typescript,_jsx
diff --git a/runtime/queries/twig/highlights.scm b/runtime/queries/twig/highlights.scm
index 1ef8d06b..6eca5572 100644
--- a/runtime/queries/twig/highlights.scm
+++ b/runtime/queries/twig/highlights.scm
@@ -41,11 +41,6 @@
"="
] @punctuation.delimiter
-(interpolated_string [
- "#{"
- "}"
-] @punctuation.delimiter)
-
[
"("
")"
@@ -58,3 +53,8 @@
"}"
] @punctuation.bracket)
+(interpolated_string [
+ "#{"
+ "}"
+] @punctuation.delimiter)
+
diff --git a/runtime/queries/typescript/highlights.scm b/runtime/queries/typescript/highlights.scm
index 5b8c8f24..dbe6665a 100644
--- a/runtime/queries/typescript/highlights.scm
+++ b/runtime/queries/typescript/highlights.scm
@@ -1,3 +1,3 @@
; See runtime/queries/ecma/README.md for more info.
-; inherits: _typescript,ecma
+; inherits: ecma,_typescript
diff --git a/runtime/queries/typespec/highlights.scm b/runtime/queries/typespec/highlights.scm
index 8b8aa4c3..0b58a3ef 100644
--- a/runtime/queries/typespec/highlights.scm
+++ b/runtime/queries/typespec/highlights.scm
@@ -59,6 +59,10 @@
"?" @punctuation.special
+; Identifiers
+
+(identifier_or_member_expression) @type
+
; Imports
(import_statement
@@ -171,7 +175,3 @@
] @constant.numeric.integer
(builtin_type) @type.builtin
-
-; Identifiers
-
-(identifier_or_member_expression) @type
diff --git a/runtime/queries/vala/highlights.scm b/runtime/queries/vala/highlights.scm
index 685cda13..3d804cf8 100644
--- a/runtime/queries/vala/highlights.scm
+++ b/runtime/queries/vala/highlights.scm
@@ -24,6 +24,7 @@
(unqualified_type (symbol . (identifier) @type))
(unqualified_type (symbol (symbol) @namespace (identifier) @type))
+(identifier) @variable
(attribute) @variable.other.member
(method_declaration (symbol (symbol) @type (identifier) @function))
(method_declaration (symbol (identifier) @function))
@@ -41,7 +42,6 @@
(parameter (identifier) @variable.parameter)
(property_declaration (symbol (identifier) @variable.other.member))
(field_declaration (identifier) @variable)
-(identifier) @variable
[
(this_access)
(base_access)
diff --git a/runtime/queries/vhs/highlights.scm b/runtime/queries/vhs/highlights.scm
index a7e1af30..5e53584b 100644
--- a/runtime/queries/vhs/highlights.scm
+++ b/runtime/queries/vhs/highlights.scm
@@ -40,6 +40,7 @@
(float) @constant.numeric.float
(integer) @constant.numeric.integer
(comment) @comment
-[(path) (string) (json)] @string.special.path
+[(string) (json)] @string.special.path
+(path) @string.special.path
(time) @string.special.symbol
(boolean) @constant.builtin.boolean
diff --git a/runtime/queries/wgsl/highlights.scm b/runtime/queries/wgsl/highlights.scm
index 2817ea3a..fe10c684 100644
--- a/runtime/queries/wgsl/highlights.scm
+++ b/runtime/queries/wgsl/highlights.scm
@@ -89,6 +89,8 @@
"~"
] @operator
+(identifier) @variable
+
(function_declaration
(identifier) @function)
@@ -112,6 +114,4 @@
(attribute
(identifier) @attribute)
-(identifier) @variable
-
(comment) @comment
diff --git a/runtime/queries/wren/highlights.scm b/runtime/queries/wren/highlights.scm
index c37bc3bc..3d934b36 100644
--- a/runtime/queries/wren/highlights.scm
+++ b/runtime/queries/wren/highlights.scm
@@ -1,3 +1,13 @@
+(comment) @comment
+(string) @string
+(raw_string) @string
+(number) @constant.numeric.integer
+(name) @variable
+(field) @variable
+(static_field) @variable
+(null) @constant.builtin
+(boolean) @constant.builtin.boolean
+
((name) @variable.builtin
(#match? @variable.builtin "^(Bool|Class|Fiber|Fn|List|Map|Null|Num|Object|Range|Sequence|String|System)$"))
@@ -9,15 +19,6 @@
((parameter) @variable.parameter)
-(comment) @comment
-(string) @string
-(raw_string) @string
-(number) @constant.numeric.integer
-(name) @variable
-(field) @variable
-(static_field) @variable
-(null) @constant.builtin
-(boolean) @constant.builtin.boolean
(if_statement
[
diff --git a/runtime/queries/yaml/highlights.scm b/runtime/queries/yaml/highlights.scm
index e4fed27a..6d58e445 100644
--- a/runtime/queries/yaml/highlights.scm
+++ b/runtime/queries/yaml/highlights.scm
@@ -1,13 +1,3 @@
-(block_mapping_pair
- key: (flow_node [(double_quote_scalar) (single_quote_scalar)] @variable.other.member))
-(block_mapping_pair
- key: (flow_node (plain_scalar (string_scalar) @variable.other.member)))
-
-(flow_mapping
- (_ key: (flow_node [(double_quote_scalar) (single_quote_scalar)] @variable.other.member)))
-(flow_mapping
- (_ key: (flow_node (plain_scalar (string_scalar) @variable.other.member))))
-
(boolean_scalar) @constant.builtin.boolean
(null_scalar) @constant.builtin
(double_quote_scalar) @string
@@ -24,6 +14,16 @@
(yaml_directive) @keyword
(ERROR) @error
+(block_mapping_pair
+ key: (flow_node [(double_quote_scalar) (single_quote_scalar)] @variable.other.member))
+(block_mapping_pair
+ key: (flow_node (plain_scalar (string_scalar) @variable.other.member)))
+
+(flow_mapping
+ (_ key: (flow_node [(double_quote_scalar) (single_quote_scalar)] @variable.other.member)))
+(flow_mapping
+ (_ key: (flow_node (plain_scalar (string_scalar) @variable.other.member))))
+
[
","
"-"
diff --git a/runtime/queries/yuck/highlights.scm b/runtime/queries/yuck/highlights.scm
index 70de4cbe..74d04fca 100644
--- a/runtime/queries/yuck/highlights.scm
+++ b/runtime/queries/yuck/highlights.scm
@@ -1,3 +1,6 @@
+(ident) @variable
+(index) @variable
+
; Errors
(ERROR) @error
@@ -64,6 +67,12 @@
(function_call
name: (ident) @function)
+; 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)
+
; Variables
(ident) @variable
@@ -94,14 +103,3 @@
(loop_widget . "for" @keyword.control.repeat . (symbol) @variable . "in" @keyword.operator . (symbol) @variable)
(loop_widget . "for" @keyword.control.repeat . (symbol) @variable . "in" @keyword.operator)
-
-; 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)
-
-; Other stuff that has not been caught by the previous queries yet
-
-(ident) @variable
-(index) @variable