changeset 6780:f9d9d980e4c7

add support for tree-sitter custom template languages on vue (#13511) Co-authored-by: TheSylex <[email protected]>
author Aitor <69397882+TheSylex@users.noreply.github.com>
date Mon, 12 May 2025 15:23:59 +0200
parents f72904374319
children 07045662b7d8
files runtime/queries/vue/injections.scm
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/queries/vue/injections.scm	Sat May 10 20:48:46 2025 +0200
+++ b/runtime/queries/vue/injections.scm	Mon May 12 15:23:59 2025 +0200
@@ -40,5 +40,21 @@
    (raw_text) @injection.content)
  (#eq? @_attr_name "lang"))
 
+; <template>
+((template_element
+    (start_tag) @_no_lang
+    (text) @injection.content)
+  (#not-match? @_no_lang "lang=")
+  (#set! injection.language "html"))
+
+; <template lang="...">
+((template_element
+    (start_tag
+      (attribute
+      (attribute_name) @_attr_name
+      (quoted_attribute_value (attribute_value) @injection.language)))
+  (text) @injection.content)
+  (#eq? @_attr_name "lang"))
+
 ((comment) @injection.content
  (#set! injection.language "comment"))