summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--book/src/generated/lang-support.md1
-rw-r--r--languages.toml12
-rw-r--r--runtime/queries/wren/highlights.scm80
-rw-r--r--runtime/queries/wren/textobjects.scm12
4 files changed, 105 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 8941f735..ee7caf99 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -167,6 +167,7 @@
| webc | ✓ | | | |
| wgsl | ✓ | | | `wgsl_analyzer` |
| wit | ✓ | | ✓ | |
+| wren | ✓ | ✓ | | |
| xit | ✓ | | | |
| xml | ✓ | | ✓ | |
| yaml | ✓ | | ✓ | `yaml-language-server` |
diff --git a/languages.toml b/languages.toml
index 7f774296..2f7e034b 100644
--- a/languages.toml
+++ b/languages.toml
@@ -2698,3 +2698,15 @@ file-types = ["webc"]
roots = []
indent = { tab-width = 2, unit = " " }
grammar = "html"
+
+[[grammar]]
+name = "wren"
+source = { git = "https://git.sr.ht/~jummit/tree-sitter-wren", rev = "7f576e8ccadac226f6a37cbefe95be3fee9f0a66"}
+
+[[language]]
+name = "wren"
+scope = "source.wren"
+injection-regex = "wren"
+file-types = ["wren"]
+roots = []
+indent = { tab-width = 2, unit = " "}
diff --git a/runtime/queries/wren/highlights.scm b/runtime/queries/wren/highlights.scm
new file mode 100644
index 00000000..5454ce25
--- /dev/null
+++ b/runtime/queries/wren/highlights.scm
@@ -0,0 +1,80 @@
+((identifier) @variable.builtin
+ (#match? @variable.builtin "^(Bool|Class|Fiber|Fn|List|Map|Null|Num|Object|Range|Sequence|String|System)$"))
+
+(call_expression
+ (identifier) @function)
+
+(method_definition
+ (identifier) @function.method)
+
+((parameter) @variable.parameter)
+
+(comment) @comment
+(string) @string
+(raw_string) @string
+(number) @constant.numeric.integer
+(identifier) @variable
+(null) @constant.builtin
+(boolean) @constant.builtin.boolean
+
+(if_statement
+[
+ "if"
+ "else"
+] @keyword.control.conditional)
+
+(for_statement
+[
+ "for"
+ "in"
+] @keyword.control.repeat)
+
+(while_statement
+[
+ "while"
+] @keyword.control.repeat)
+
+[
+ (break_statement)
+ (continue_statement)
+ (return_statement)
+] @keyword.control.return
+
+(class_definition
+"is"
+@keyword)
+
+[
+ "import"
+ "for"
+ "as"
+] @keyword.control.import
+
+[
+ "is"
+] @keyword
+
+(operator) @operator
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+
+["," "."] @punctuation.delimiter
+
+[
+ "class"
+ "var"
+] @keyword.storage.type
+
+[
+ "static"
+] @keyword.storage.modifier
+
+(constructor
+ ["construct"] @constructor)
diff --git a/runtime/queries/wren/textobjects.scm b/runtime/queries/wren/textobjects.scm
new file mode 100644
index 00000000..24898124
--- /dev/null
+++ b/runtime/queries/wren/textobjects.scm
@@ -0,0 +1,12 @@
+(class_definition
+ (class_body) @class.inside) @class.around
+
+(method_definition
+ body: (_) @function.inside) @function.around
+
+(parameter_list
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
+
+(comment) @comment.inside
+
+(comment)+ @comment.around