Improve wren support (#7819)

This commit is contained in:
Jummit 2023-08-04 15:25:36 +01:00 committed by GitHub
parent 5a51036bc1
commit f19793c2f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 65 additions and 6 deletions

View file

@ -167,7 +167,7 @@
| webc | ✓ | | | |
| wgsl | ✓ | | | `wgsl_analyzer` |
| wit | ✓ | | ✓ | |
| wren | ✓ | ✓ | | |
| wren | ✓ | ✓ | | |
| xit | ✓ | | | |
| xml | ✓ | | ✓ | |
| yaml | ✓ | | ✓ | `yaml-language-server` |

View file

@ -2704,7 +2704,7 @@ grammar = "html"
[[grammar]]
name = "wren"
source = { git = "https://git.sr.ht/~jummit/tree-sitter-wren", rev = "7f576e8ccadac226f6a37cbefe95be3fee9f0a66"}
source = { git = "https://git.sr.ht/~jummit/tree-sitter-wren", rev = "793d58266924e6efcc40e411663393e9d72bec87"}
[[language]]
name = "wren"

View file

@ -1,11 +1,11 @@
((identifier) @variable.builtin
((name) @variable.builtin
(#match? @variable.builtin "^(Bool|Class|Fiber|Fn|List|Map|Null|Num|Object|Range|Sequence|String|System)$"))
(call_expression
(identifier) @function)
(name) @function)
(method_definition
(identifier) @function.method)
(name) @function.method)
((parameter) @variable.parameter)
@ -13,7 +13,9 @@
(string) @string
(raw_string) @string
(number) @constant.numeric.integer
(identifier) @variable
(name) @variable
(field) @variable
(static_field) @variable
(null) @constant.builtin
(boolean) @constant.builtin.boolean

View file

@ -0,0 +1,29 @@
[
(list)
(map)
(call_body)
(parameter_list)
(call_expression)
(getter_definition)
(setter_definition)
(prefix_operator_definition)
(subscript_operator_definition)
(subscript_setter_definition)
(infix_operator_definition)
(method_definition)
(constructor)
(static_method_definition)
(static_getter_definition)
(attribute)
(conditional)
(class_body)
(if_statement)
(for_statement)
(while_statement)
] @indent
[
"}"
"]"
")"
] @outdent

View file

@ -0,0 +1,3 @@
((comment) @injection.content
(#set! injection.language "comment")
(#set! injection.include-children))

View file

@ -0,0 +1,21 @@
[
(method_definition)
] @local.scope
(name) @local.reference
(field) @local.reference
(static_field) @local.reference
(for_statement
loop_variable: (name) @local.definition)
(variable_definition
name: (name) @local.definition)
(assignment
left: (field) @local.definition)
(assignment
left: (static_field) @local.definition)
(parameter) @local.definition

View file

@ -1,6 +1,10 @@
(class_definition
(class_body) @class.inside) @class.around
(call_expression
(call_body
(_) @function.inside) @function.around)
(method_definition
body: (_) @function.inside) @function.around