mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-12 16:30:02 -04:00
Add new highlight queries
This commit is contained in:
parent
429036317a
commit
d4fbbc05af
1 changed files with 97 additions and 44 deletions
|
|
@ -12,7 +12,12 @@
|
||||||
(marker_annotation
|
(marker_annotation
|
||||||
name: (identifier) @annotation)
|
name: (identifier) @annotation)
|
||||||
|
|
||||||
; Operators
|
; Operators and Tokens
|
||||||
|
|
||||||
|
; FIXME: currently this errors
|
||||||
|
; (template_substitution
|
||||||
|
; "${" @punctuation.special
|
||||||
|
; "}" @punctuation.special) @embedded
|
||||||
|
|
||||||
[
|
[
|
||||||
"@"
|
"@"
|
||||||
|
|
@ -26,6 +31,7 @@
|
||||||
"%"
|
"%"
|
||||||
"<"
|
"<"
|
||||||
">"
|
">"
|
||||||
|
"="
|
||||||
">="
|
">="
|
||||||
"<="
|
"<="
|
||||||
"||"
|
"||"
|
||||||
|
|
@ -35,18 +41,22 @@
|
||||||
(additive_operator)
|
(additive_operator)
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
; Delimiters
|
; Delimiters
|
||||||
|
|
||||||
"." @punctuation.delimiter
|
[
|
||||||
"," @punctuation.delimiter
|
";"
|
||||||
";" @punctuation.delimiter
|
"."
|
||||||
|
","
|
||||||
"(" @punctuation.bracket
|
] @punctuation.delimiter
|
||||||
")" @punctuation.bracket
|
|
||||||
"{" @punctuation.bracket
|
|
||||||
"}" @punctuation.bracket
|
|
||||||
"[" @punctuation.bracket
|
|
||||||
"]" @punctuation.bracket
|
|
||||||
|
|
||||||
|
|
||||||
; Types
|
; Types
|
||||||
|
|
@ -61,8 +71,6 @@
|
||||||
scope: (identifier) @type)
|
scope: (identifier) @type)
|
||||||
(function_signature
|
(function_signature
|
||||||
name: (identifier) @method)
|
name: (identifier) @method)
|
||||||
; using method_signature does not work
|
|
||||||
; so specifically use getter and setter signatures
|
|
||||||
(getter_signature
|
(getter_signature
|
||||||
(identifier) @method)
|
(identifier) @method)
|
||||||
(setter_signature
|
(setter_signature
|
||||||
|
|
@ -83,22 +91,45 @@
|
||||||
|
|
||||||
; Variables
|
; Variables
|
||||||
|
|
||||||
|
; var keyword
|
||||||
|
(inferred_type) @keyword
|
||||||
|
|
||||||
|
(const_builtin) @constant.builtin
|
||||||
|
(final_builtin) @constant.builtin
|
||||||
|
|
||||||
((identifier) @type
|
((identifier) @type
|
||||||
(#match? @type "^[A-Z]"))
|
(#match? @type "^[A-Z]"))
|
||||||
|
|
||||||
(this) @constant.builtin
|
(identifier) @variable
|
||||||
|
|
||||||
;; Parameters
|
(this) @variable.builtin
|
||||||
|
|
||||||
|
(unconditional_assignable_selector (identifier) @identifier)
|
||||||
|
(assignable_selector (identifier) @identifier)
|
||||||
|
(assignment_expression
|
||||||
|
left: (assignable_expression) @identifier)
|
||||||
|
|
||||||
|
; Parameters
|
||||||
|
|
||||||
(formal_parameter
|
(formal_parameter
|
||||||
name: (identifier) @parameter)
|
name: (identifier) @parameter)
|
||||||
|
|
||||||
;; Literals
|
; Named arguments
|
||||||
|
|
||||||
(hex_integer_literal) @number
|
(named_argument (label (identifier) @label))
|
||||||
(decimal_integer_literal) @number
|
|
||||||
(decimal_floating_point_literal) @float
|
|
||||||
|
|
||||||
|
; Literals
|
||||||
|
|
||||||
|
[
|
||||||
|
(hex_integer_literal)
|
||||||
|
(decimal_integer_literal)
|
||||||
|
(decimal_floating_point_literal)
|
||||||
|
; TODO: inaccessbile nodes
|
||||||
|
; (octal_integer_literal)
|
||||||
|
; (hex_floating_point_literal)
|
||||||
|
] @number
|
||||||
|
|
||||||
|
(symbol_literal) @string.special.symbol
|
||||||
(string_literal) @string
|
(string_literal) @string
|
||||||
(true) @boolean
|
(true) @boolean
|
||||||
(false) @boolean
|
(false) @boolean
|
||||||
|
|
@ -111,35 +142,57 @@
|
||||||
|
|
||||||
["import" "library" "export"] @include
|
["import" "library" "export"] @include
|
||||||
|
|
||||||
|
; TODO: "rethrow" @keyword
|
||||||
|
|
||||||
|
; Reserved words (cannot be used as identifiers)
|
||||||
[
|
[
|
||||||
"abstract"
|
; "assert"
|
||||||
;"assert"
|
; "break"
|
||||||
;"break"
|
"class"
|
||||||
"on"
|
"enum"
|
||||||
"class"
|
"extends"
|
||||||
"default"
|
"in"
|
||||||
"enum"
|
"is"
|
||||||
"extends"
|
"new"
|
||||||
;"final"
|
"return"
|
||||||
"implements"
|
"super"
|
||||||
"as"
|
"var"
|
||||||
"mixin"
|
"with"
|
||||||
"external"
|
; "void"
|
||||||
"new"
|
] @keyword
|
||||||
"return"
|
|
||||||
"static"
|
[
|
||||||
"required"
|
"abstract"
|
||||||
"var"
|
"as"
|
||||||
;"const"
|
"async"
|
||||||
"async"
|
"await"
|
||||||
"await"
|
"covariant"
|
||||||
] @keyword
|
"deferred"
|
||||||
;TODO:
|
"dynamic"
|
||||||
; "rethrow" @keyword
|
"external"
|
||||||
|
"factory"
|
||||||
|
"Function"
|
||||||
|
"get"
|
||||||
|
"implements"
|
||||||
|
"interface"
|
||||||
|
"library"
|
||||||
|
"operator"
|
||||||
|
"mixin"
|
||||||
|
"part"
|
||||||
|
"set"
|
||||||
|
"static"
|
||||||
|
"typedef"
|
||||||
|
] @keyword
|
||||||
|
|
||||||
["if" "else" "switch" "default"] @conditional
|
["if" "else" "switch" "default"] @conditional
|
||||||
; TODO: case
|
|
||||||
|
|
||||||
["try" "throw" "catch" "finally"] @exception
|
["try" "throw" "catch" "finally"] @exception
|
||||||
|
|
||||||
["do" "while" "continue" "for"] @repeat
|
["do" "while" "continue" "for"] @repeat
|
||||||
|
|
||||||
|
((identifier) @variable.builtin
|
||||||
|
(#match? @variable.builtin "^(abstract|as|covariant|deferred|dynamic|export|external|factory|Function|get|implements|import|interface|library|operator|mixin|part|set|static|typedef)$")
|
||||||
|
(#is-not? local))
|
||||||
|
|
||||||
|
; Error
|
||||||
|
(ERROR) @error
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue