on master help sign in
Add wren support (#7765)
commit9a4890f62bd907a37ee79e1a3690c75fc80e9724 authorJummit <jummit@web.de> dateFri 28 Jul 2023, 17:13 (3 years ago) parentd6856cf
4 files changed+105
book/src/generated/lang-support.md+1 languages.toml+12 runtime/queries/wren/highlights.scm+80 runtime/queries/wren/textobjects.scm+12
book/src/generated/lang-support.md+1
@@ -167,6 +167,7 @@
167167| webc | ✓ | | | |
168168| wgsl | ✓ | | | `wgsl_analyzer` |
169169| wit | ✓ | | ✓ | |
170+| wren | ✓ | ✓ | | |
170171| xit | ✓ | | | |
171172| xml | ✓ | | ✓ | |
172173| yaml | ✓ | | ✓ | `yaml-language-server` |
languages.toml+12
@@ -2698,3 +2698,15 @@ file-types = ["webc"]
26982698roots = []
26992699indent = { tab-width = 2, unit = " " }
27002700grammar = "html"
2701+
2702+[[grammar]]
2703+name = "wren"
2704+source = { git = "https://git.sr.ht/~jummit/tree-sitter-wren", rev = "7f576e8ccadac226f6a37cbefe95be3fee9f0a66"}
2705+
2706+[[language]]
2707+name = "wren"
2708+scope = "source.wren"
2709+injection-regex = "wren"
2710+file-types = ["wren"]
2711+roots = []
2712+indent = { tab-width = 2, unit = " "}
runtime/queries/wren/highlights.scmnew file+80
@@ -0,0 +1,80 @@
1+((identifier) @variable.builtin
2+ (#match? @variable.builtin "^(Bool|Class|Fiber|Fn|List|Map|Null|Num|Object|Range|Sequence|String|System)$"))
3+
4+(call_expression
5+ (identifier) @function)
6+
7+(method_definition
8+ (identifier) @function.method)
9+
10+((parameter) @variable.parameter)
11+
12+(comment) @comment
13+(string) @string
14+(raw_string) @string
15+(number) @constant.numeric.integer
16+(identifier) @variable
17+(null) @constant.builtin
18+(boolean) @constant.builtin.boolean
19+
20+(if_statement
21+[
22+ "if"
23+ "else"
24+] @keyword.control.conditional)
25+
26+(for_statement
27+[
28+ "for"
29+ "in"
30+] @keyword.control.repeat)
31+
32+(while_statement
33+[
34+ "while"
35+] @keyword.control.repeat)
36+
37+[
38+ (break_statement)
39+ (continue_statement)
40+ (return_statement)
41+] @keyword.control.return
42+
43+(class_definition
44+"is"
45+@keyword)
46+
47+[
48+ "import"
49+ "for"
50+ "as"
51+] @keyword.control.import
52+
53+[
54+ "is"
55+] @keyword
56+
57+(operator) @operator
58+
59+[
60+ "("
61+ ")"
62+ "["
63+ "]"
64+ "{"
65+ "}"
66+] @punctuation.bracket
67+
68+["," "."] @punctuation.delimiter
69+
70+[
71+ "class"
72+ "var"
73+] @keyword.storage.type
74+
75+[
76+ "static"
77+] @keyword.storage.modifier
78+
79+(constructor
80+ ["construct"] @constructor)
runtime/queries/wren/textobjects.scmnew file+12
@@ -0,0 +1,12 @@
1+(class_definition
2+ (class_body) @class.inside) @class.around
3+
4+(method_definition
5+ body: (_) @function.inside) @function.around
6+
7+(parameter_list
8+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
9+
10+(comment) @comment.inside
11+
12+(comment)+ @comment.around