Unnamed repository; edit this file 'description' to name the repository.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
; <script> content defaults to JavaScript
((element
  (start_tag (tag_name) @_tag)
  (raw_text) @injection.content)
  (#eq? @_tag "script")
  (#set! injection.language "javascript"))

; <style> content defaults to CSS
((element
  (start_tag (tag_name) @_tag)
  (raw_text) @injection.content)
  (#eq? @_tag "style")
  (#set! injection.language "css"))

; <script> or <style> with "lang" attribute
((element
  (start_tag
    (tag_name) @_tag
    (attribute
      (attribute_name) @_lang
      (quoted_attribute_value
        (attribute_value) @injection.language)))
  (raw_text) @injection.content)
  (#any-of? @_tag "style" "script")
  (#eq? @_lang "lang"))

; Inline style attribute
((attribute
  (attribute_name) @_style_name
  (quoted_attribute_value (attribute_value) @injection.content))
  (#eq? @_style_name "style")
  (#set! injection.language "css"))

; Typed expression content
((expression content: (js) @injection.content)
  (#set! injection.language "javascript"))
((expression content: (ts) @injection.content)
  (#set! injection.language "typescript"))

; Shorthand attributes ({foo})
((shorthand_attribute content: (js) @injection.content)
  (#set! injection.language "javascript"))
((shorthand_attribute content: (ts) @injection.content)
  (#set! injection.language "typescript"))

; Tag expressions ({@const}, {@render}, {@html}, {@debug}, {@attach}, {:else if})
((expression_value content: (js) @injection.content)
  (#set! injection.language "javascript"))
((expression_value content: (ts) @injection.content)
  (#set! injection.language "typescript"))

; Else-if clause
((else_if_clause expression: (expression_value content: (js) @injection.content))
  (#set! injection.language "javascript"))
((else_if_clause expression: (expression_value content: (ts) @injection.content))
  (#set! injection.language "typescript"))

; If block expressions
((if_block expression: (expression content: (js) @injection.content))
  (#set! injection.language "javascript"))
((if_block expression: (expression content: (ts) @injection.content))
  (#set! injection.language "typescript"))

; Each block expressions and bindings
((each_block expression: (expression content: (js) @injection.content))
  (#set! injection.language "javascript"))
((each_block expression: (expression content: (ts) @injection.content))
  (#set! injection.language "typescript"))
((each_block binding: (pattern content: (js) @injection.content))
  (#set! injection.language "javascript"))
((each_block binding: (pattern content: (ts) @injection.content))
  (#set! injection.language "typescript"))
((each_block index: (pattern content: (js) @injection.content))
  (#set! injection.language "javascript"))
((each_block index: (pattern content: (ts) @injection.content))
  (#set! injection.language "typescript"))
((each_block key: (expression content: (js) @injection.content))
  (#set! injection.language "javascript"))
((each_block key: (expression content: (ts) @injection.content))
  (#set! injection.language "typescript"))

; Await block expressions and bindings
((await_block expression: (expression content: (js) @injection.content))
  (#set! injection.language "javascript"))
((await_block expression: (expression content: (ts) @injection.content))
  (#set! injection.language "typescript"))
((await_block (pattern content: (js) @injection.content))
  (#set! injection.language "javascript"))
((await_block (pattern content: (ts) @injection.content))
  (#set! injection.language "typescript"))
((await_branch (pattern content: (js) @injection.content))
  (#set! injection.language "javascript"))
((await_branch (pattern content: (ts) @injection.content))
  (#set! injection.language "typescript"))
((orphan_branch (pattern content: (js) @injection.content))
  (#set! injection.language "javascript"))
((orphan_branch (pattern content: (ts) @injection.content))
  (#set! injection.language "typescript"))

; Key block expressions
((key_block expression: (expression content: (js) @injection.content))
  (#set! injection.language "javascript"))
((key_block expression: (expression content: (ts) @injection.content))
  (#set! injection.language "typescript"))

; Snippet parameters and type parameters
((snippet_parameters parameter: (pattern content: (js) @injection.content))
  (#set! injection.language "javascript"))
((snippet_parameters parameter: (pattern content: (ts) @injection.content))
  (#set! injection.language "typescript"))
((snippet_block type_parameters: (snippet_type_parameters) @injection.content)
  (#set! injection.language "typescript"))

; Comments
((comment) @injection.content
  (#set! injection.language "comment"))