mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat(wing): add parser (#5021)
Co-authored-by: Christian Clason <c.clason@uni-graz.at> Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
This commit is contained in:
parent
99a7e8d268
commit
f460cc8ee7
8 changed files with 147 additions and 0 deletions
|
|
@ -566,6 +566,9 @@
|
|||
"wgsl_bevy": {
|
||||
"revision": "7cd38d6895060b023353e04f7af099ec64add5d1"
|
||||
},
|
||||
"wing": {
|
||||
"revision": "bb54f98e55db82d67711abadefdbd3b933c9efc3"
|
||||
},
|
||||
"yaml": {
|
||||
"revision": "0e36bed171768908f331ff7dff9d956bae016efb"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1668,6 +1668,17 @@ list.wgsl_bevy = {
|
|||
maintainers = { "@theHamsta" },
|
||||
}
|
||||
|
||||
list.wing = {
|
||||
install_info = {
|
||||
url = "https://github.com/winglang/wing",
|
||||
files = { "src/parser.c", "src/scanner.c" },
|
||||
location = "libs/tree-sitter-wing",
|
||||
requires_generate_from_grammar = true,
|
||||
},
|
||||
maintainers = { "@gshpychka" },
|
||||
experimental = true,
|
||||
}
|
||||
|
||||
list.yaml = {
|
||||
install_info = {
|
||||
url = "https://github.com/ikatyang/tree-sitter-yaml",
|
||||
|
|
|
|||
18
queries/wing/folds.scm
Normal file
18
queries/wing/folds.scm
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[
|
||||
(class_definition)
|
||||
(class_implementation)
|
||||
(resource_definition)
|
||||
(resource_implementation)
|
||||
(interface_definition)
|
||||
(interface_implementation)
|
||||
(for_in_loop)
|
||||
(while_statement)
|
||||
(if_statement)
|
||||
(if_let_statement)
|
||||
(elif_block)
|
||||
(struct_definition)
|
||||
(enum_definition)
|
||||
(try_catch_statement)
|
||||
(method_definition)
|
||||
(inflight_method_definition)
|
||||
] @fold
|
||||
86
queries/wing/highlights.scm
Normal file
86
queries/wing/highlights.scm
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
(identifier) @variable
|
||||
(reference_identifier) @variable
|
||||
(member_identifier) @property
|
||||
|
||||
; Classes
|
||||
|
||||
(custom_type) @type
|
||||
(class_field
|
||||
name: (identifier) @field)
|
||||
(class_definition
|
||||
name: (identifier) @type)
|
||||
(method_definition
|
||||
name: (identifier) @method)
|
||||
(inflight_method_definition
|
||||
name: (identifier) @method)
|
||||
|
||||
; Functions
|
||||
|
||||
(keyword_argument_key) @parameter
|
||||
(call
|
||||
caller: (reference
|
||||
(nested_identifier
|
||||
property: (member_identifier) @method.call)))
|
||||
(call
|
||||
caller: (reference
|
||||
(reference_identifier) @method.call))
|
||||
|
||||
; Primitives
|
||||
|
||||
(number) @number
|
||||
(duration) @constant
|
||||
(string) @string
|
||||
(bool) @boolean
|
||||
(builtin_type) @type.builtin
|
||||
(json_container_type) @type.builtin
|
||||
|
||||
; Special
|
||||
|
||||
(comment) @comment
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"-"
|
||||
"+"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"<"
|
||||
"<="
|
||||
"="
|
||||
"=="
|
||||
"!"
|
||||
"!="
|
||||
">"
|
||||
">="
|
||||
"&&"
|
||||
"??"
|
||||
"||"
|
||||
] @operator
|
||||
|
||||
[
|
||||
";"
|
||||
"."
|
||||
","
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"as"
|
||||
"bring"
|
||||
"class"
|
||||
"else"
|
||||
"for"
|
||||
"if"
|
||||
"in"
|
||||
"init"
|
||||
"let"
|
||||
"new"
|
||||
"return"
|
||||
(inflight_specifier)
|
||||
] @keyword
|
||||
5
queries/wing/locals.scm
Normal file
5
queries/wing/locals.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
(block) @scope
|
||||
(variable_definition_statement
|
||||
name: (identifier) @definition)
|
||||
|
||||
; TODO: Missing "@local.reference" usage tuned for each relevant identifier location
|
||||
|
|
@ -11,6 +11,7 @@ vim.filetype.add {
|
|||
usd = "usd",
|
||||
usda = "usd",
|
||||
wgsl = "wgsl",
|
||||
w = "wing",
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
19
tests/query/highlights/wing/class.w
Normal file
19
tests/query/highlights/wing/class.w
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
bring cloud;
|
||||
// <- keyword
|
||||
|
||||
class Foo {
|
||||
// <- keyword
|
||||
// ^ variable
|
||||
// ^ punctuation.bracket
|
||||
name: str;
|
||||
//^ field
|
||||
// ^ type.builtin
|
||||
// ^ punctuation.delimiter
|
||||
init(name: str) {
|
||||
//^ keyword
|
||||
// ^ variable
|
||||
this.name = name;
|
||||
// ^ punctuation.delimiter
|
||||
// ^ operator
|
||||
}
|
||||
}
|
||||
4
tests/query/highlights/wing/nested_method.w
Normal file
4
tests/query/highlights/wing/nested_method.w
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
test1.test2.test3();
|
||||
// <- variable
|
||||
// ^ property
|
||||
// ^ method.call
|
||||
Loading…
Add table
Add a link
Reference in a new issue