1; <script>
2((script_element
3 (start_tag) @_no_lang
4 (raw_text) @content)
5 (#not-match? @_no_lang "lang=")
6 (#set! "language" "javascript"))
7
8; <script lang="js">
9((script_element
10 (start_tag
11 (attribute
12 (attribute_name) @_lang
13 (quoted_attribute_value
14 (attribute_value) @_js)))
15 (raw_text) @content)
16 (#eq? @_lang "lang")
17 (#eq? @_js "js")
18 (#set! "language" "javascript"))
19
20; <script lang="ts">
21((script_element
22 (start_tag
23 (attribute
24 (attribute_name) @_lang
25 (quoted_attribute_value
26 (attribute_value) @_ts)))
27 (raw_text) @content)
28 (#eq? @_lang "lang")
29 (#eq? @_ts "ts")
30 (#set! "language" "typescript"))
31
32; <script lang="tsx">
33; <script lang="jsx">
34; Zed built-in tsx, we mark it as tsx ^:)
35(script_element
36 (start_tag
37 (attribute
38 (attribute_name) @_attr
39 (quoted_attribute_value
40 (attribute_value) @language)))
41 (#eq? @_attr "lang")
42 (#any-of? @language "tsx" "jsx")
43 (raw_text) @content)
44
45
46; {{ }}
47((interpolation
48 (raw_text) @content)
49 (#set! "language" "typescript"))
50
51; v-
52(directive_attribute
53 (quoted_attribute_value
54 (attribute_value) @content
55 (#set! "language" "typescript")))
56
57; TODO: support less/sass/scss
58(style_element
59 (raw_text) @content
60 (#set! "language" "css"))