1((comment) @injection.content
2 (#set! injection.language "comment"))
3
4(((comment) @_jsdoc_comment
5 (#match? @_jsdoc_comment "(?s)^/[*][*][^*].*[*]/$")) @injection.content
6 (#set! injection.language "jsdoc"))
7
8(((comment) @_reference
9 (#match? @_reference "^///\\s+<reference\\s+types=\"\\S+\"\\s*/>\\s*$")) @injection.content
10 (#set! injection.language "html"))
11
12((regex) @injection.content
13 (#set! injection.language "regex"))
14
15(call_expression
16 function: (identifier) @_name
17 (#eq? @_name "css")
18 arguments: (template_string
19 (string_fragment) @injection.content
20 (#set! injection.language "css")))
21
22(call_expression
23 function: (member_expression
24 object: (identifier) @_obj
25 (#eq? @_obj "styled")
26 property: (property_identifier))
27 arguments: (template_string
28 (string_fragment) @injection.content
29 (#set! injection.language "css")))
30
31(call_expression
32 function: (call_expression
33 function: (identifier) @_name
34 (#eq? @_name "styled"))
35 arguments: (template_string
36 (string_fragment) @injection.content
37 (#set! injection.language "css")))
38
39(call_expression
40 function: (identifier) @_name
41 (#eq? @_name "html")
42 arguments: (template_string) @injection.content
43 (#set! injection.language "html"))
44
45(call_expression
46 function: (identifier) @_name
47 (#eq? @_name "js")
48 arguments: (template_string
49 (string_fragment) @injection.content
50 (#set! injection.language "javascript")))
51
52(call_expression
53 function: (identifier) @_name
54 (#eq? @_name "json")
55 arguments: (template_string
56 (string_fragment) @injection.content
57 (#set! injection.language "json")))
58
59(call_expression
60 function: (identifier) @_name
61 (#eq? @_name "sql")
62 arguments: (template_string
63 (string_fragment) @injection.content
64 (#set! injection.language "sql")))
65
66(call_expression
67 function: (identifier) @_name
68 (#eq? @_name "ts")
69 arguments: (template_string
70 (string_fragment) @injection.content
71 (#set! injection.language "typescript")))
72
73(call_expression
74 function: (identifier) @_name
75 (#match? @_name "^ya?ml$")
76 arguments: (template_string
77 (string_fragment) @injection.content
78 (#set! injection.language "yaml")))
79
80(call_expression
81 function: (identifier) @_name
82 (#match? @_name "^g(raph)?ql$")
83 arguments: (template_string
84 (string_fragment) @injection.content
85 (#set! injection.language "graphql")))
86
87(call_expression
88 function: (identifier) @_name
89 (#match? @_name "^g(raph)?ql$")
90 arguments: (arguments
91 (template_string
92 (string_fragment) @injection.content
93 (#set! injection.language "graphql"))))
94
95(call_expression
96 function: (identifier) @_name
97 (#match? @_name "^iso$")
98 arguments: (arguments
99 (template_string
100 (string_fragment) @injection.content
101 (#set! injection.language "isograph"))))
102
103; Angular Component template injection
104(call_expression
105 function: [
106 (identifier) @_decorator
107 (#eq? @_decorator "Component")
108 (member_expression
109 property: (property_identifier) @_decorator
110 (#eq? @_decorator "Component"))
111 ]
112 arguments: (arguments
113 (object
114 (pair
115 key: (property_identifier) @_prop
116 (#eq? @_prop "template")
117 value: [
118 (string) @injection.content
119 (template_string) @injection.content
120 (template_string
121 (string_fragment) @injection.content)
122 ])))
123 (#set! injection.language "angular"))
124
125; Angular Component styles injection
126(call_expression
127 function: [
128 (identifier) @_decorator
129 (#eq? @_decorator "Component")
130 (member_expression
131 property: (property_identifier) @_decorator
132 (#eq? @_decorator "Component"))
133 ]
134 arguments: (arguments
135 (object
136 (pair
137 key: (property_identifier) @_prop
138 (#eq? @_prop "styles")
139 value: [
140 (string) @injection.content
141 (template_string) @injection.content
142 (template_string
143 (string_fragment) @injection.content)
144 (array
145 (string) @injection.content)
146 (array
147 (template_string) @injection.content)
148 (array
149 (template_string
150 (string_fragment)) @injection.content)
151 ])))
152 (#set! injection.language "css"))
153
154; Parse the contents of strings and tagged template
155; literals with leading ECMAScript comments:
156; '/* html */' or '/*html*/'
157(((comment) @_ecma_comment
158 [
159 (string
160 (string_fragment) @injection.content)
161 (template_string
162 (string_fragment) @injection.content)
163 ])
164 (#match? @_ecma_comment "^\\/\\*\\s*html\\s*\\*\\/")
165 (#set! injection.language "html"))
166
167; '/* sql */' or '/*sql*/'
168(((comment) @_ecma_comment
169 [
170 (string
171 (string_fragment) @injection.content)
172 (template_string
173 (string_fragment) @injection.content)
174 ])
175 (#match? @_ecma_comment "^\\/\\*\\s*sql\\s*\\*\\/")
176 (#set! injection.language "sql"))
177
178; '/* gql */' or '/*gql*/'
179; '/* graphql */' or '/*graphql*/'
180(((comment) @_ecma_comment
181 [
182 (string
183 (string_fragment) @injection.content)
184 (template_string
185 (string_fragment) @injection.content)
186 ])
187 (#match? @_ecma_comment "^\\/\\*\\s*(gql|graphql)\\s*\\*\\/")
188 (#set! injection.language "graphql"))
189
190; '/* css */' or '/*css*/'
191(((comment) @_ecma_comment
192 [
193 (string
194 (string_fragment) @injection.content)
195 (template_string
196 (string_fragment) @injection.content)
197 ])
198 (#match? @_ecma_comment "^\\/\\*\\s*(css)\\s*\\*\\/")
199 (#set! injection.language "css"))