aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/twig
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/queries/twig')
-rw-r--r--runtime/queries/twig/highlights.scm81
-rw-r--r--runtime/queries/twig/injections.scm6
2 files changed, 87 insertions, 0 deletions
diff --git a/runtime/queries/twig/highlights.scm b/runtime/queries/twig/highlights.scm
new file mode 100644
index 000000000..435fdc0f1
--- /dev/null
+++ b/runtime/queries/twig/highlights.scm
@@ -0,0 +1,81 @@
+(comment) @comment @spell
+
+(filter_identifier) @function.call
+
+(function_identifier) @function.call
+
+(test) @function.builtin
+
+(variable) @variable
+
+(string) @string
+
+(interpolated_string) @string
+
+(operator) @operator
+
+(number) @number
+
+(boolean) @boolean
+
+(null) @constant.builtin
+
+(keyword) @keyword
+
+(attribute) @attribute
+
+(tag) @tag
+
+(conditional) @keyword.conditional
+
+(repeat) @keyword.repeat
+
+(method) @function.method
+
+(parameter) @variable.parameter
+
+[
+ "{{"
+ "}}"
+ "{{-"
+ "-}}"
+ "{{~"
+ "~}}"
+ "{%"
+ "%}"
+ "{%-"
+ "-%}"
+ "{%~"
+ "~%}"
+] @tag.delimiter
+
+[
+ ","
+ "."
+] @punctuation.delimiter
+
+[
+ "?"
+ ":"
+ "="
+ "|"
+] @operator
+
+(interpolated_string
+ [
+ "#{"
+ "}"
+ ] @punctuation.special)
+
+[
+ "("
+ ")"
+ "["
+ "]"
+] @punctuation.bracket
+
+(hash
+ [
+ "{"
+ "}"
+ ] @punctuation.bracket)
diff --git a/runtime/queries/twig/injections.scm b/runtime/queries/twig/injections.scm
new file mode 100644
index 000000000..3fd93feb7
--- /dev/null
+++ b/runtime/queries/twig/injections.scm
@@ -0,0 +1,6 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
+
+((content) @injection.content
+ (#set! injection.language "html")
+ (#set! injection.combined))