Skip to content

Commit

Permalink
feat(lang): add Meson language support (helix-editor#2314)
Browse files Browse the repository at this point in the history
  • Loading branch information
valpackett authored and mtoohey31 committed Jun 15, 2022
1 parent d68fdab commit 2b84b57
Show file tree
Hide file tree
Showing 4 changed files with 92 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 @@ -53,6 +53,7 @@
| lua || || |
| make || | | |
| markdown || | | |
| meson || || |
| mint | | | | `mint` |
| nickel || || `nls` |
| nix || || `rnix-lsp` |
Expand Down
13 changes: 13 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1342,3 +1342,16 @@ indent = { tab-width = 4, unit = " " }
[[grammar]]
name = "odin"
source = { git = "https://github.com/MineBill/tree-sitter-odin", rev = "da885f4a387f169b9b69fe0968259ee257a8f69a" }

[[language]]
name = "meson"
scope = "source.meson"
injection-regex = "meson"
file-types = ["meson.build"]
roots = []
comment-token = "#"
indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "meson"
source = { git = "https://github.com/bearcove/tree-sitter-meson", rev = "feea83be9225842490066522ced2d13eb9cce0bd" }
62 changes: 62 additions & 0 deletions runtime/queries/meson/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
(string_literal) @string

(boolean_literal) @constant.builtin.boolean
(integer_literal) @constant.numeric.integer

(comment) @comment.line
(function_id) @function
(keyword_arg_key) @variable.other.member
(id_expression) @variable

[
"if"
"elif"
"else"
"endif"
] @keyword.control.conditional

[
"foreach"
"endforeach"
] @keyword.control.repeat

[
"break"
"continue"
] @keyword.control

[
"not"
"in"
"and"
"or"
] @keyword.operator

[
"!"
"+"
"-"
"*"
"/"
"%"
"=="
"!="
">"
"<"
">="
"<="
] @operator

[
":"
","
] @punctuation.delimiter

[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
16 changes: 16 additions & 0 deletions runtime/queries/meson/indents.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
(method_expression)
(function_expression)
(array_literal)
(dictionary_literal)
(selection_statement)
(iteration_statement)
] @indent

[
")"
"]"
"}"
"endif"
"endforeach"
] @outdent

0 comments on commit 2b84b57

Please sign in to comment.