diff options
-rw-r--r-- | .gitmodules | 4 | ||||
-rw-r--r-- | book/src/generated/lang-support.md | 1 | ||||
m--------- | helix-syntax/languages/tree-sitter-twig | 0 | ||||
-rw-r--r-- | languages.toml | 9 | ||||
-rw-r--r-- | runtime/queries/twig/highlights.scm | 16 | ||||
-rw-r--r-- | runtime/queries/twig/injections.scm | 3 |
6 files changed, 33 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules index 247ac276..d35b0f33 100644 --- a/.gitmodules +++ b/.gitmodules @@ -218,3 +218,7 @@ path = helix-syntax/languages/tree-sitter-iex url = https://github.com/elixir-lang/tree-sitter-iex shallow = true +[submodule "helix-syntax/languages/tree-sitter-twig"] + path = helix-syntax/languages/tree-sitter-twig + url = https://github.com/eirabben/tree-sitter-twig.git + shallow = true diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 85371773..d10b56f1 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -54,6 +54,7 @@ | toml | ✓ | | | | | tsq | ✓ | | | | | tsx | ✓ | | | `typescript-language-server` | +| twig | ✓ | | | | | typescript | ✓ | | ✓ | `typescript-language-server` | | vue | ✓ | | | | | wgsl | ✓ | | | | diff --git a/helix-syntax/languages/tree-sitter-twig b/helix-syntax/languages/tree-sitter-twig new file mode 160000 +Subproject b7444181fb38e603e25ea8fcdac55f9492e49c2 diff --git a/languages.toml b/languages.toml index 02c64732..74c01da5 100644 --- a/languages.toml +++ b/languages.toml @@ -232,6 +232,15 @@ roots = [] indent = { tab-width = 4, unit = " " } [[language]] +name = "twig" +scope = "source.twig" +injection-regex = "twig" +file-types = ["twig"] +roots = [] + +indent = { tab-width = 2, unit = " " } + +[[language]] name = "latex" scope = "source.tex" injection-regex = "tex" diff --git a/runtime/queries/twig/highlights.scm b/runtime/queries/twig/highlights.scm new file mode 100644 index 00000000..2c95ab63 --- /dev/null +++ b/runtime/queries/twig/highlights.scm @@ -0,0 +1,16 @@ +(comment_directive) @comment + +[ + "{%" + "{%-" + "{%~" + "%}" + "-%}" + "~%}" + "{{" + "{{-" + "{{~" + "}}" + "-}}" + "~}}" +] @keyword diff --git a/runtime/queries/twig/injections.scm b/runtime/queries/twig/injections.scm new file mode 100644 index 00000000..f0822734 --- /dev/null +++ b/runtime/queries/twig/injections.scm @@ -0,0 +1,3 @@ +((content) @injection.content + (#set! injection.language "html") + (#set! injection.combined)) |