Skip to content

Commit

Permalink
Change twig tree-sitter grammar (helix-editor#4176)
Browse files Browse the repository at this point in the history
  • Loading branch information
gbprod authored and pathwave committed Nov 4, 2022
1 parent a20bb89 commit e9b4962
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 14 deletions.
2 changes: 1 addition & 1 deletion languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ indent = { tab-width = 2, unit = " " }

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

[[language]]
name = "latex"
Expand Down
70 changes: 57 additions & 13 deletions runtime/queries/twig/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,16 +1,60 @@
(comment_directive) @comment
(comment) @comment

(filter_identifier) @function.method
(function_identifier) @function.method
(test) @function.builtin
(variable) @variable
(string) @string
(interpolated_string) @string
(operator) @operator
(number) @constant.numeric.integer
(boolean) @constant.builtin.boolean
(null) @constant.builtin
(keyword) @keyword
(attribute) @attribute
(tag) @tag
(conditional) @keyword.control.conditional
(repeat) @keyword.control.repeat
(method) @function.method
(parameter) @variable.parameter

[
"{%"
"{%-"
"{%~"
"%}"
"-%}"
"~%}"
"{{"
"{{-"
"{{~"
"}}"
"-}}"
"~}}"
"{{"
"}}"
"{{-"
"-}}"
"{{~"
"~}}"
"{%"
"%}"
"{%-"
"-%}"
"{%~"
"~%}"
] @keyword

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

(interpolated_string [
"#{"
"}"
] @punctuation.delimiter)

[
"("
")"
"["
"]"
"{"
] @punctuation.bracket

(hash [
"}"
] @punctuation.bracket)

0 comments on commit e9b4962

Please sign in to comment.