aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorJummit2023-08-04 14:25:36 +0000
committerGitHub2023-08-04 14:25:36 +0000
commitf19793c2f86dea8e7af8570563e2dd5a8da9fefb (patch)
tree02a604c37fecc0859d17e065d69cbc558ffb25a3 /runtime
parent5a51036bc1e0b5b0bffa599dd2caf171d6924546 (diff)
Improve wren support (#7819)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/queries/wren/highlights.scm10
-rw-r--r--runtime/queries/wren/indents.scm29
-rw-r--r--runtime/queries/wren/injections.scm3
-rw-r--r--runtime/queries/wren/locals.scm21
-rw-r--r--runtime/queries/wren/textobjects.scm4
5 files changed, 63 insertions, 4 deletions
diff --git a/runtime/queries/wren/highlights.scm b/runtime/queries/wren/highlights.scm
index 5454ce25..c37bc3bc 100644
--- a/runtime/queries/wren/highlights.scm
+++ b/runtime/queries/wren/highlights.scm
@@ -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
diff --git a/runtime/queries/wren/indents.scm b/runtime/queries/wren/indents.scm
new file mode 100644
index 00000000..ff64a7e2
--- /dev/null
+++ b/runtime/queries/wren/indents.scm
@@ -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
diff --git a/runtime/queries/wren/injections.scm b/runtime/queries/wren/injections.scm
new file mode 100644
index 00000000..fca94d58
--- /dev/null
+++ b/runtime/queries/wren/injections.scm
@@ -0,0 +1,3 @@
+((comment) @injection.content
+ (#set! injection.language "comment")
+ (#set! injection.include-children))
diff --git a/runtime/queries/wren/locals.scm b/runtime/queries/wren/locals.scm
new file mode 100644
index 00000000..38f39d91
--- /dev/null
+++ b/runtime/queries/wren/locals.scm
@@ -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
diff --git a/runtime/queries/wren/textobjects.scm b/runtime/queries/wren/textobjects.scm
index 24898124..486b5b48 100644
--- a/runtime/queries/wren/textobjects.scm
+++ b/runtime/queries/wren/textobjects.scm
@@ -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