mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-16 18:30:06 -04:00
feat(wing): add many missing highlights
...as well as some fold and injection queries.
This commit is contained in:
parent
bbf1f3e546
commit
e090c5b22d
4 changed files with 104 additions and 13 deletions
|
|
@ -12,4 +12,6 @@
|
||||||
(enum_definition)
|
(enum_definition)
|
||||||
(try_catch_statement)
|
(try_catch_statement)
|
||||||
(method_definition)
|
(method_definition)
|
||||||
|
(import_statement)+
|
||||||
|
(initializer)
|
||||||
] @fold
|
] @fold
|
||||||
|
|
|
||||||
|
|
@ -8,17 +8,34 @@
|
||||||
(custom_type) @type
|
(custom_type) @type
|
||||||
|
|
||||||
(class_field
|
(class_field
|
||||||
name: (identifier) @variable.member)
|
name: (identifier) @property)
|
||||||
|
|
||||||
|
(struct_field
|
||||||
|
name: (identifier) @property)
|
||||||
|
|
||||||
(class_definition
|
(class_definition
|
||||||
name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
|
|
||||||
|
(struct_definition
|
||||||
|
name: (identifier) @type)
|
||||||
|
|
||||||
|
(interface_definition
|
||||||
|
name: (identifier) @type)
|
||||||
|
|
||||||
(method_definition
|
(method_definition
|
||||||
name: (identifier) @function.method)
|
name: (identifier) @function.method)
|
||||||
|
|
||||||
|
(json_literal_member
|
||||||
|
(identifier) @property)
|
||||||
|
|
||||||
; Functions
|
; Functions
|
||||||
(keyword_argument_key) @variable.parameter
|
(keyword_argument_key) @variable.parameter
|
||||||
|
|
||||||
|
(parameter_definition
|
||||||
|
name: (identifier) @variable.parameter)
|
||||||
|
|
||||||
|
(variadic) @variable.parameter.builtin
|
||||||
|
|
||||||
(call
|
(call
|
||||||
caller: (reference
|
caller: (reference
|
||||||
(nested_identifier
|
(nested_identifier
|
||||||
|
|
@ -37,24 +54,30 @@
|
||||||
|
|
||||||
(bool) @boolean
|
(bool) @boolean
|
||||||
|
|
||||||
(builtin_type) @type.builtin
|
[
|
||||||
|
(builtin_type)
|
||||||
|
"MutSet"
|
||||||
|
"MutMap"
|
||||||
|
"MutArray"
|
||||||
|
"Json"
|
||||||
|
"Set"
|
||||||
|
"Map"
|
||||||
|
"Array"
|
||||||
|
"MutJson"
|
||||||
|
] @type.builtin
|
||||||
|
|
||||||
(json_container_type) @type.builtin
|
(json_container_type) @type.builtin
|
||||||
|
|
||||||
; Special
|
; Special
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
||||||
[
|
|
||||||
"("
|
|
||||||
")"
|
|
||||||
"{"
|
|
||||||
"}"
|
|
||||||
] @punctuation.bracket
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"-"
|
"-"
|
||||||
|
"-="
|
||||||
"+"
|
"+"
|
||||||
|
"+="
|
||||||
"*"
|
"*"
|
||||||
|
"**"
|
||||||
"/"
|
"/"
|
||||||
"%"
|
"%"
|
||||||
"<"
|
"<"
|
||||||
|
|
@ -68,23 +91,54 @@
|
||||||
"&&"
|
"&&"
|
||||||
"??"
|
"??"
|
||||||
"||"
|
"||"
|
||||||
|
"?"
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
(mutable_container_type
|
||||||
|
[
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
] @punctuation.bracket)
|
||||||
|
|
||||||
|
(immutable_container_type
|
||||||
|
[
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
] @punctuation.bracket)
|
||||||
|
|
||||||
[
|
[
|
||||||
";"
|
";"
|
||||||
"."
|
"."
|
||||||
","
|
","
|
||||||
|
":"
|
||||||
|
"=>"
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
[
|
[
|
||||||
"as"
|
"as"
|
||||||
"bring"
|
|
||||||
"let"
|
"let"
|
||||||
"new"
|
"new"
|
||||||
(inflight_specifier)
|
(inflight_specifier)
|
||||||
|
"impl"
|
||||||
|
"test"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
"class" @keyword.type
|
"bring" @keyword.import
|
||||||
|
|
||||||
|
[
|
||||||
|
"class"
|
||||||
|
"struct"
|
||||||
|
"interface"
|
||||||
|
] @keyword.type
|
||||||
|
|
||||||
[
|
[
|
||||||
"for"
|
"for"
|
||||||
|
|
@ -100,6 +154,26 @@
|
||||||
"pub"
|
"pub"
|
||||||
"protected"
|
"protected"
|
||||||
"internal"
|
"internal"
|
||||||
|
"extern"
|
||||||
|
(static)
|
||||||
] @keyword.modifier
|
] @keyword.modifier
|
||||||
|
|
||||||
"return" @keyword.return
|
"return" @keyword.return
|
||||||
|
|
||||||
|
(import_statement
|
||||||
|
module_name: (identifier) @module)
|
||||||
|
|
||||||
|
(import_statement
|
||||||
|
alias: (identifier) @module)
|
||||||
|
|
||||||
|
(call
|
||||||
|
(reference
|
||||||
|
(nested_identifier
|
||||||
|
object: (reference) @_ref
|
||||||
|
property: (member_identifier) @_ident))
|
||||||
|
(argument_list
|
||||||
|
(positional_argument
|
||||||
|
(string) @string.regexp))
|
||||||
|
(#eq? @_ref "regex")
|
||||||
|
(#eq? @_ident "compile")
|
||||||
|
(#offset! @string.regexp 0 1 0 -1))
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,15 @@
|
||||||
((comment) @injection.content
|
((comment) @injection.content
|
||||||
(#set! injection.language "comment"))
|
(#set! injection.language "comment"))
|
||||||
|
|
||||||
|
(call
|
||||||
|
(reference
|
||||||
|
(nested_identifier
|
||||||
|
object: (reference) @_ref
|
||||||
|
property: (member_identifier) @_ident))
|
||||||
|
(argument_list
|
||||||
|
(positional_argument
|
||||||
|
(string) @injection.content))
|
||||||
|
(#eq? @_ref "regex")
|
||||||
|
(#eq? @_ident "compile")
|
||||||
|
(#offset! @injection.content 0 1 0 -1)
|
||||||
|
(#set! injection.language "regex"))
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
bring cloud;
|
bring cloud;
|
||||||
// <- @keyword
|
// <- @keyword.import
|
||||||
|
// ^ @module
|
||||||
|
|
||||||
class Foo {
|
class Foo {
|
||||||
// <- @keyword.type
|
// <- @keyword.type
|
||||||
// ^ @type
|
// ^ @type
|
||||||
// ^ @punctuation.bracket
|
// ^ @punctuation.bracket
|
||||||
name: str;
|
name: str;
|
||||||
//^ @variable.member
|
//^ @property
|
||||||
// ^ @type.builtin
|
// ^ @type.builtin
|
||||||
// ^ @punctuation.delimiter
|
// ^ @punctuation.delimiter
|
||||||
new(name: str) {
|
new(name: str) {
|
||||||
|
|
@ -14,6 +15,7 @@ class Foo {
|
||||||
// ^ @variable
|
// ^ @variable
|
||||||
this.name = name;
|
this.name = name;
|
||||||
// ^ @punctuation.delimiter
|
// ^ @punctuation.delimiter
|
||||||
|
// ^ @variable.member
|
||||||
// ^ @operator
|
// ^ @operator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue