Skip to content

Commit 9f36468

Browse files
authored
Change twig tree-sitter grammar (#4176)
1 parent a079f2c commit 9f36468

File tree

2 files changed

+58
-14
lines changed

2 files changed

+58
-14
lines changed

languages.toml

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

538538
[[grammar]]
539539
name = "twig"
540-
source = { git = "https://github.com/eirabben/tree-sitter-twig", rev = "b7444181fb38e603e25ea8fcdac55f9492e49c27" }
540+
source = { git = "https://github.com/gbprod/tree-sitter-twig", rev = "807b293fec3fead64f54c64fdf6fb05516c032b9" }
541541

542542
[[language]]
543543
name = "latex"

runtime/queries/twig/highlights.scm

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,60 @@
1-
(comment_directive) @comment
1+
(comment) @comment
2+
3+
(filter_identifier) @function.method
4+
(function_identifier) @function.method
5+
(test) @function.builtin
6+
(variable) @variable
7+
(string) @string
8+
(interpolated_string) @string
9+
(operator) @operator
10+
(number) @constant.numeric.integer
11+
(boolean) @constant.builtin.boolean
12+
(null) @constant.builtin
13+
(keyword) @keyword
14+
(attribute) @attribute
15+
(tag) @tag
16+
(conditional) @keyword.control.conditional
17+
(repeat) @keyword.control.repeat
18+
(method) @function.method
19+
(parameter) @variable.parameter
220

321
[
4-
"{%"
5-
"{%-"
6-
"{%~"
7-
"%}"
8-
"-%}"
9-
"~%}"
10-
"{{"
11-
"{{-"
12-
"{{~"
13-
"}}"
14-
"-}}"
15-
"~}}"
22+
"{{"
23+
"}}"
24+
"{{-"
25+
"-}}"
26+
"{{~"
27+
"~}}"
28+
"{%"
29+
"%}"
30+
"{%-"
31+
"-%}"
32+
"{%~"
33+
"~%}"
1634
] @keyword
35+
36+
[
37+
","
38+
"."
39+
"?"
40+
":"
41+
"="
42+
] @punctuation.delimiter
43+
44+
(interpolated_string [
45+
"#{"
46+
"}"
47+
] @punctuation.delimiter)
48+
49+
[
50+
"("
51+
")"
52+
"["
53+
"]"
54+
"{"
55+
] @punctuation.bracket
56+
57+
(hash [
58+
"}"
59+
] @punctuation.bracket)
60+

0 commit comments

Comments
 (0)