feat(highlights): capture wildcard patterns as @character.special (#7153)

This commit is contained in:
Omar Valdez 2024-09-19 23:15:01 -07:00 committed by GitHub
parent 2b2ac30232
commit 188b1a6d01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 45 additions and 21 deletions

View file

@ -217,7 +217,6 @@
"module"
"this"
"base"
(discard)
] @variable.builtin
(constructor_declaration
@ -430,6 +429,11 @@
".."
] @operator
(list_pattern
".." @character.special)
(discard) @character.special
[
";"
"."

View file

@ -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

View file

@ -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
[

View file

@ -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)

View file

@ -2,6 +2,8 @@
; Variables
(identifier) @variable
(underscore_pattern) @character.special
; Methods
(method_declaration
name: (identifier) @function.method)

View file

@ -27,11 +27,12 @@
[
"="
"~"
"_"
] @operator
(modifier) @operator
"_" @character.special
[
"<"
">"

View file

@ -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
;----------
[

View file

@ -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

View file

@ -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)

View file

@ -43,7 +43,7 @@
"#"
] @punctuation.special
"_" @constant
"_" @character.special
((parameters
(identifier) @number)

View file

@ -62,7 +62,7 @@
(operator)
] @operator
(wildcard_pattern) @constant.builtin
(wildcard_pattern) @character.special
[
"if"

View file

@ -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
[
"("

View file

@ -211,7 +211,8 @@
(null_literal) @constant.builtin
(wildcard) @variable.parameter
(wildcard
"_") @character.special
(namespace_wildcard
[