aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/templ
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-06-12 09:54:30 -0600
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commit692b051b09935653befdb8f7ba8afdb640adf17b (patch)
tree167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/templ
parentfeat(c-family): inherit injections (diff)
downloadnvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/templ')
-rw-r--r--runtime/queries/templ/folds.scm15
-rw-r--r--runtime/queries/templ/highlights.scm60
-rw-r--r--runtime/queries/templ/injections.scm13
3 files changed, 88 insertions, 0 deletions
diff --git a/runtime/queries/templ/folds.scm b/runtime/queries/templ/folds.scm
new file mode 100644
index 000000000..adbbb103f
--- /dev/null
+++ b/runtime/queries/templ/folds.scm
@@ -0,0 +1,15 @@
+[
+ (component_block)
+ (css_declaration)
+ (script_declaration)
+ (element)
+ (style_element)
+ (script_element)
+ (component_switch_statement)
+ (field_declaration_list)
+ (block)
+ (interface_type)
+ (comment)
+ (const_declaration)
+ (var_declaration)
+] @fold
diff --git a/runtime/queries/templ/highlights.scm b/runtime/queries/templ/highlights.scm
new file mode 100644
index 000000000..034c91d5b
--- /dev/null
+++ b/runtime/queries/templ/highlights.scm
@@ -0,0 +1,60 @@
+; inherits: go
+
+(component_declaration
+ name: (component_identifier) @function)
+
+[
+ (tag_start)
+ (tag_end)
+ (self_closing_tag)
+ (style_element)
+] @tag
+
+(doctype) @constant
+
+(attribute
+ name: (attribute_name) @tag.attribute)
+
+(attribute
+ value: (quoted_attribute_value) @string)
+
+[
+ (element_text)
+ (style_element_text)
+] @string.special
+
+(css_identifier) @function
+
+(css_property
+ name: (css_property_name) @property)
+
+(css_property
+ value: (css_property_value) @string)
+
+[
+ (expression)
+ (dynamic_class_attribute_value)
+] @function.method
+
+(component_import
+ name: (component_identifier) @function)
+
+(component_render) @function.call
+
+(element_comment) @comment @spell
+
+[
+ "<"
+ ">"
+ "</"
+ "/>"
+ "<!"
+] @tag.delimiter
+
+"@" @operator
+
+[
+ "templ"
+ "css"
+ "script"
+] @keyword
diff --git a/runtime/queries/templ/injections.scm b/runtime/queries/templ/injections.scm
new file mode 100644
index 000000000..b9cf5a06a
--- /dev/null
+++ b/runtime/queries/templ/injections.scm
@@ -0,0 +1,13 @@
+; inherits: go
+
+((element_comment) @injection.content
+ (#set! injection.language "comment"))
+
+((script_block_text) @injection.content
+ (#set! injection.language "javascript"))
+
+((script_element_text) @injection.content
+ (#set! injection.language "javascript"))
+
+((style_element_text) @injection.content
+ (#set! injection.language "css"))