Skip to content

Commit 1b6c895

Browse files
gdamorethe-mikedavis
authored andcommitted
Improvements to Meson syntax. (helix-editor#4572)
Co-authored-by: Garrett D'Amore <[email protected]> Co-authored-by: Michael Davis <[email protected]>
1 parent 6112b73 commit 1b6c895

File tree

3 files changed

+51
-50
lines changed

3 files changed

+51
-50
lines changed

languages.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,7 @@ indent = { tab-width = 2, unit = " " }
15101510

15111511
[[grammar]]
15121512
name = "meson"
1513-
source = { git = "https://github.com/bearcove/tree-sitter-meson", rev = "feea83be9225842490066522ced2d13eb9cce0bd" }
1513+
source = { git = "https://github.com/staysail/tree-sitter-meson", rev = "32a83e8f200c347232fa795636cfe60dde22957a" }
15141514

15151515
[[language]]
15161516
name = "sshclientconfig"

runtime/queries/meson/highlights.scm

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,62 @@
1-
(string_literal) @string
1+
(comment) @comment
22

3-
(boolean_literal) @constant.builtin.boolean
4-
(integer_literal) @constant.numeric.integer
5-
6-
(comment) @comment.line
7-
(function_id) @function
8-
(keyword_arg_key) @variable.other.member
9-
(id_expression) @variable
3+
; these are listed first, because they override keyword queries
4+
(function_expression (identifier) @function)
105

116
[
12-
"if"
13-
"elif"
14-
"else"
15-
"endif"
16-
] @keyword.control.conditional
7+
(assignment_operator)
8+
(additive_operator)
9+
(multiplicative_operator)
10+
(equality_operator)
11+
">="
12+
"<="
13+
"<"
14+
">"
15+
"+"
16+
"-"
17+
] @operator
1718

1819
[
19-
"foreach"
20-
"endforeach"
21-
] @keyword.control.repeat
20+
(and)
21+
(or)
22+
(not)
23+
(in)
24+
] @keyword.operator
2225

2326
[
24-
"break"
25-
"continue"
26-
] @keyword.control
27+
"(" ")" "[" "]" "{" "}"
28+
] @punctuation.bracket
2729

2830
[
29-
"not"
30-
"in"
31-
"and"
32-
"or"
33-
] @keyword.operator
31+
(if)
32+
(elif)
33+
(else)
34+
(endif)
35+
] @keyword.control.conditional
3436

3537
[
36-
"!"
37-
"+"
38-
"-"
39-
"*"
40-
"/"
41-
"%"
42-
"=="
43-
"!="
44-
">"
45-
"<"
46-
">="
47-
"<="
48-
] @operator
38+
(foreach)
39+
(endforeach)
40+
(break)
41+
(continue)
42+
] @keyword.control.repeat
43+
44+
(boolean_literal) @constant.builtin.boolean
45+
(int_literal) @constant.numeric.integer
46+
47+
(keyword_argument keyword: (identifier) @variable.parameter)
48+
(escape_sequence) @constant.character.escape
49+
(bad_escape) @warning
4950

5051
[
51-
":"
52-
","
52+
"."
53+
","
54+
":"
5355
] @punctuation.delimiter
5456

5557
[
56-
"("
57-
")"
58-
"["
59-
"]"
60-
"{"
61-
"}"
62-
] @punctuation.bracket
58+
(string_literal)
59+
(fstring_literal)
60+
] @string
61+
62+
(identifier) @variable

runtime/queries/meson/indents.scm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
; Indentation queries for helix
12
[
2-
(method_expression)
33
(function_expression)
44
(array_literal)
55
(dictionary_literal)
66
(selection_statement)
77
(iteration_statement)
88
] @indent
99

10+
; question - what about else, elif
1011
[
1112
")"
1213
"]"
1314
"}"
14-
"endif"
15-
"endforeach"
15+
(endif)
16+
(endforeach)
1617
] @outdent

0 commit comments

Comments
 (0)