Skip to content

Commit

Permalink
Add wren support (helix-editor#7765)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jummit authored and mtoohey31 committed Jun 2, 2024
1 parent c8f450a commit cbb7336
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 0 deletions.
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
| webc || | | |
| wgsl || | | `wgsl_analyzer` |
| wit || || |
| wren ||| | |
| xit || | | |
| xml || || |
| yaml || || `yaml-language-server` |
Expand Down
12 changes: 12 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = " "}
80 changes: 80 additions & 0 deletions runtime/queries/wren/highlights.scm
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 12 additions & 0 deletions runtime/queries/wren/textobjects.scm
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit cbb7336

Please sign in to comment.