diff options
| author | Omar Valdez <omarantoniovaldezf2@gmail.com> | 2024-09-19 23:15:01 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-20 08:15:01 +0200 |
| commit | 188b1a6d01fd9bcf04bf2bc932d611809b154acc (patch) | |
| tree | 2ef7f0fc668817cfbf63f476f5a22467b56f2377 | |
| parent | bot(lockfile): update editorconfig, fortran, nix, perl (diff) | |
| download | nvim-treesitter-188b1a6d01fd9bcf04bf2bc932d611809b154acc.tar nvim-treesitter-188b1a6d01fd9bcf04bf2bc932d611809b154acc.tar.gz nvim-treesitter-188b1a6d01fd9bcf04bf2bc932d611809b154acc.tar.bz2 nvim-treesitter-188b1a6d01fd9bcf04bf2bc932d611809b154acc.tar.lz nvim-treesitter-188b1a6d01fd9bcf04bf2bc932d611809b154acc.tar.xz nvim-treesitter-188b1a6d01fd9bcf04bf2bc932d611809b154acc.tar.zst nvim-treesitter-188b1a6d01fd9bcf04bf2bc932d611809b154acc.zip | |
feat(highlights): capture wildcard patterns as `@character.special` (#7153)
| -rw-r--r-- | queries/c_sharp/highlights.scm | 6 | ||||
| -rw-r--r-- | queries/elm/highlights.scm | 4 | ||||
| -rw-r--r-- | queries/gdscript/highlights.scm | 7 | ||||
| -rw-r--r-- | queries/haskell/highlights.scm | 5 | ||||
| -rw-r--r-- | queries/java/highlights.scm | 2 | ||||
| -rw-r--r-- | queries/menhir/highlights.scm | 3 | ||||
| -rw-r--r-- | queries/ocaml/highlights.scm | 6 | ||||
| -rw-r--r-- | queries/purescript/highlights.scm | 7 | ||||
| -rw-r--r-- | queries/python/highlights.scm | 2 | ||||
| -rw-r--r-- | queries/query/highlights.scm | 2 | ||||
| -rw-r--r-- | queries/roc/highlights.scm | 2 | ||||
| -rw-r--r-- | queries/rust/highlights.scm | 17 | ||||
| -rw-r--r-- | queries/scala/highlights.scm | 3 |
13 files changed, 45 insertions, 21 deletions
diff --git a/queries/c_sharp/highlights.scm b/queries/c_sharp/highlights.scm index 90d0d3407..f23d7ec65 100644 --- a/queries/c_sharp/highlights.scm +++ b/queries/c_sharp/highlights.scm @@ -217,7 +217,6 @@ "module" "this" "base" - (discard) ] @variable.builtin (constructor_declaration @@ -430,6 +429,11 @@ ".." ] @operator +(list_pattern + ".." @character.special) + +(discard) @character.special + [ ";" "." diff --git a/queries/elm/highlights.scm b/queries/elm/highlights.scm index fc18566c9..cfa09caf1 100644 --- a/queries/elm/highlights.scm +++ b/queries/elm/highlights.scm @@ -67,7 +67,7 @@ (lower_case_identifier) @variable) (anything_pattern - (underscore) @variable) + (underscore) @character.special) (record_base_identifier (lower_case_identifier) @variable) @@ -88,7 +88,7 @@ (function_declaration_left (anything_pattern - (underscore) @variable.parameter)) + (underscore) @character.special)) (function_declaration_left (lower_pattern diff --git a/queries/gdscript/highlights.scm b/queries/gdscript/highlights.scm index 9f122e473..bc62bc2f5 100644 --- a/queries/gdscript/highlights.scm +++ b/queries/gdscript/highlights.scm @@ -129,9 +129,10 @@ (#eq? @keyword.operator "new")) ; Match Pattern -(underscore) @constant ; The "_" pattern. - -(pattern_open_ending) @operator ; The ".." pattern. +[ + (underscore) + (pattern_open_ending) +] @character.special ; Alternations [ diff --git a/queries/haskell/highlights.scm b/queries/haskell/highlights.scm index 9373b6e1d..0880f020e 100644 --- a/queries/haskell/highlights.scm +++ b/queries/haskell/highlights.scm @@ -4,8 +4,6 @@ ; and don't override destructured parameters (variable) @variable -(pattern/wildcard) @variable - (decl/function patterns: (patterns (_) @variable.parameter)) @@ -78,7 +76,6 @@ (operator) (constructor_operator) (all_names) - (wildcard) "." ".." "=" @@ -92,6 +89,8 @@ "@" ] @operator +(wildcard) @character.special + (module (module_id) @module) diff --git a/queries/java/highlights.scm b/queries/java/highlights.scm index 316987178..d29d12632 100644 --- a/queries/java/highlights.scm +++ b/queries/java/highlights.scm @@ -2,6 +2,8 @@ ; Variables (identifier) @variable +(underscore_pattern) @character.special + ; Methods (method_declaration name: (identifier) @function.method) diff --git a/queries/menhir/highlights.scm b/queries/menhir/highlights.scm index 6a7ceb085..022fda82e 100644 --- a/queries/menhir/highlights.scm +++ b/queries/menhir/highlights.scm @@ -27,11 +27,12 @@ [ "=" "~" - "_" ] @operator (modifier) @operator +"_" @character.special + [ "<" ">" diff --git a/queries/ocaml/highlights.scm b/queries/ocaml/highlights.scm index 6c7851378..891ff7bd5 100644 --- a/queries/ocaml/highlights.scm +++ b/queries/ocaml/highlights.scm @@ -32,6 +32,9 @@ (value_pattern) @variable.parameter +((value_pattern) @character.special + (#eq? @character.special "_")) + ; Functions ;---------- (let_binding @@ -272,6 +275,9 @@ ".." ] @punctuation.delimiter +(range_pattern + ".." @character.special) + ; Operators ;---------- [ diff --git a/queries/purescript/highlights.scm b/queries/purescript/highlights.scm index 5f07e9b48..02426b0ab 100644 --- a/queries/purescript/highlights.scm +++ b/queries/purescript/highlights.scm @@ -118,11 +118,12 @@ "role" @keyword role: (type_role) @keyword.modifier) -(hole) @character.special - ; `_` wildcards in if-then-else and case-of expressions, ; as well as record updates and operator sections -(wildcard) @variable.parameter +[ + "_" + (hole) +] @character.special ; ---------------------------------------------------------------------------- ; Functions and variables diff --git a/queries/python/highlights.scm b/queries/python/highlights.scm index 232d40916..2363dc323 100644 --- a/queries/python/highlights.scm +++ b/queries/python/highlights.scm @@ -21,7 +21,7 @@ ; https://docs.python.org/3/library/constants.html "NotImplemented" "Ellipsis" "quit" "exit" "copyright" "credits" "license")) -"_" @constant.builtin ; match wildcard +"_" @character.special ; match wildcard ((attribute attribute: (identifier) @variable.member) diff --git a/queries/query/highlights.scm b/queries/query/highlights.scm index e459b4460..f839ec985 100644 --- a/queries/query/highlights.scm +++ b/queries/query/highlights.scm @@ -43,7 +43,7 @@ "#" ] @punctuation.special -"_" @constant +"_" @character.special ((parameters (identifier) @number) diff --git a/queries/roc/highlights.scm b/queries/roc/highlights.scm index 89b42a6a5..1f950cbc0 100644 --- a/queries/roc/highlights.scm +++ b/queries/roc/highlights.scm @@ -62,7 +62,7 @@ (operator) ] @operator -(wildcard_pattern) @constant.builtin +(wildcard_pattern) @character.special [ "if" diff --git a/queries/rust/highlights.scm b/queries/rust/highlights.scm index 2836a95c2..c202206ca 100644 --- a/queries/rust/highlights.scm +++ b/queries/rust/highlights.scm @@ -31,10 +31,9 @@ (mod_item name: (identifier) @module) -[ - (self) - "_" -] @variable.builtin +(self) @variable.builtin + +"_" @character.special (label [ @@ -376,6 +375,16 @@ (use_wildcard "*" @character.special) +(remaining_field_pattern + ".." @character.special) + +(range_pattern + [ + ".." + "..=" + "..." + ] @character.special) + ; Punctuation [ "(" diff --git a/queries/scala/highlights.scm b/queries/scala/highlights.scm index 3ff64309f..e53dcd06d 100644 --- a/queries/scala/highlights.scm +++ b/queries/scala/highlights.scm @@ -211,7 +211,8 @@ (null_literal) @constant.builtin -(wildcard) @variable.parameter +(wildcard + "_") @character.special (namespace_wildcard [ |
