mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat(highlights): capture wildcard patterns as @character.special (#7153)
This commit is contained in:
parent
2b2ac30232
commit
188b1a6d01
13 changed files with 45 additions and 21 deletions
|
|
@ -217,7 +217,6 @@
|
|||
"module"
|
||||
"this"
|
||||
"base"
|
||||
(discard)
|
||||
] @variable.builtin
|
||||
|
||||
(constructor_declaration
|
||||
|
|
@ -430,6 +429,11 @@
|
|||
".."
|
||||
] @operator
|
||||
|
||||
(list_pattern
|
||||
".." @character.special)
|
||||
|
||||
(discard) @character.special
|
||||
|
||||
[
|
||||
";"
|
||||
"."
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
[
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
; Variables
|
||||
(identifier) @variable
|
||||
|
||||
(underscore_pattern) @character.special
|
||||
|
||||
; Methods
|
||||
(method_declaration
|
||||
name: (identifier) @function.method)
|
||||
|
|
|
|||
|
|
@ -27,11 +27,12 @@
|
|||
[
|
||||
"="
|
||||
"~"
|
||||
"_"
|
||||
] @operator
|
||||
|
||||
(modifier) @operator
|
||||
|
||||
"_" @character.special
|
||||
|
||||
[
|
||||
"<"
|
||||
">"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
;----------
|
||||
[
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
"#"
|
||||
] @punctuation.special
|
||||
|
||||
"_" @constant
|
||||
"_" @character.special
|
||||
|
||||
((parameters
|
||||
(identifier) @number)
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
(operator)
|
||||
] @operator
|
||||
|
||||
(wildcard_pattern) @constant.builtin
|
||||
(wildcard_pattern) @character.special
|
||||
|
||||
[
|
||||
"if"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
[
|
||||
"("
|
||||
|
|
|
|||
|
|
@ -211,7 +211,8 @@
|
|||
|
||||
(null_literal) @constant.builtin
|
||||
|
||||
(wildcard) @variable.parameter
|
||||
(wildcard
|
||||
"_") @character.special
|
||||
|
||||
(namespace_wildcard
|
||||
[
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue