Debian Codegraph @

runtime/queries/ripple/highlights.scm

raw symbols SCIP
1 ; Keywords
2 (component_declaration "component" @keyword)
3 (fragment_declaration "fragment" @keyword)
4 (server_block "#server" @keyword)
5
6 ; Reserved identifiers
7 [
8 "track"
9 "untrack"
10 ] @function.builtin
11
12 ; Base catch-all for identifiers, as a base layer the specific rules below
13 ; (functions, calls, params, JSX) override. Kept first — imported from upstream
14 ; queries with this rule mid-file, where it left every component/call name
15 ; @variable.
16 (identifier) @variable
17
18 ; Member access (generic): before the method-call rule below so an invoked
19 ; `obj.method()` reclaims @function.method while a plain `obj.field` stays
20 ; a member.
21 (member_expression
22 property: (identifier) @variable.other.member)
23
24 ; Functions
25 (component_declaration
26 name: (identifier) @function)
27
28 (fragment_declaration
29 name: (identifier) @function)
30
31 (function_declaration
32 name: (identifier) @function)
33
34 (method_definition
35 name: (property_name) @function.method)
36
37 (call_expression
38 function: (identifier) @function)
39
40 (call_expression
41 function: (member_expression
42 property: (identifier) @function.method))
43
44 ; Parameters
45 (required_parameter
46 pattern: (identifier) @variable.parameter)
47
48 (rest_parameter
49 (identifier) @variable.parameter)
50
51 ; Reactive constructs
52 (unbox_expression "@" @operator.special)
53 (reactive_array "#[" @punctuation.bracket.special)
54 (reactive_object "#{" @punctuation.bracket.special)
55
56 ; JSX/Components
57 (jsx_opening_element
58 "<" @tag.delimiter
59 name: (jsx_element_name) @tag
60 ">" @tag.delimiter)
61
62 (jsx_closing_element
63 "</" @tag.delimiter
64 name: (jsx_element_name) @tag
65 ">" @tag.delimiter)
66
67 (jsx_self_closing_element
68 "<" @tag.delimiter
69 name: (jsx_non_namespaced_element_name) @tag
70 "/>" @tag.delimiter)
71
72 ; Override identifier coloring for JSX element names
73 ; These must come after the general (identifier) @variable pattern to have higher priority
74
75 ; Regular element names (plain identifiers)
76 (jsx_opening_element
77 name: (jsx_element_name (identifier) @tag))
78
79 (jsx_closing_element
80 name: (jsx_element_name (identifier) @tag))
81
82 (jsx_self_closing_element
83 name: (jsx_non_namespaced_element_name (identifier) @tag))
84
85 ; Dynamic element names (unbox expressions)
86 (jsx_opening_element
87 name: (jsx_element_name
88 (unbox_expression (identifier) @tag)))
89
90 (jsx_closing_element
91 name: (jsx_element_name
92 (unbox_expression (identifier) @tag)))
93
94 (jsx_self_closing_element
95 name: (jsx_non_namespaced_element_name
96 (unbox_expression (identifier) @tag)))
97
98 (jsx_attribute
99 name: [(identifier) (jsx_namespace_name)] @attribute)
100
101 (jsx_expression
102 "{" @punctuation.bracket
103 "}" @punctuation.bracket)
104
105 ; Style elements
106 (style_element
107 "<style" @tag
108 ">" @tag.delimiter
109 "</style>" @tag)
110
111 (style_element
112 (raw_text) @string.special)
113
114 ; Types
115 (type_identifier) @type
116 (predefined_type) @type.builtin
117 (type_parameter (identifier) @type.parameter)
118
119 ; Type annotations (commented out - _type_annotation is hidden)
120 ; The colon will be captured as punctuation.delimiter via other rules
121
122 ; Literals
123 (string) @string
124 (template_string) @string
125 (template_substitution
126 "${" @punctuation.special
127 "}" @punctuation.special)
128
129 (number) @constant.numeric
130 (true) @constant.builtin.boolean
131 (false) @constant.builtin.boolean
132 (null) @constant.builtin
133 (undefined) @constant.builtin
134
135 ; Regex
136 (regex) @string.regexp
137 (regex_pattern) @string.regexp
138 (regex_flags) @string.regexp
139
140 ; Comments
141 (comment) @comment
142
143 ; Operators
144 (unary_expression operator: _ @operator)
145 (binary_expression operator: _ @operator)
146 (ternary_expression ":" @operator)
147 (update_expression operator: _ @operator)
148
149 [
150 "="
151 "+="
152 "-="
153 "*="
154 "/="
155 "%="
156 "^="
157 "&="
158 "|="
159 ">>="
160 ">>>="
161 "<<="
162 "**="
163 "&&="
164 "||="
165 "??="
166 ] @operator
167
168 [
169 "+"
170 "-"
171 "*"
172 "/"
173 "%"
174 "**"
175 "++"
176 "--"
177 ] @operator
178
179 [
180 "&&"
181 "||"
182 "??"
183 "!"
184 "~"
185 ] @operator
186
187 [
188 "=="
189 "==="
190 "!="
191 "!=="
192 "<"
193 "<="
194 ">"
195 ">="
196 ] @operator
197
198 [
199 "<<"
200 ">>"
201 ">>>"
202 "&"
203 "|"
204 "^"
205 ] @operator
206
207 ; Control flow keywords
208 [
209 "if"
210 "else"
211 "switch"
212 "case"
213 "default"
214 "for"
215 "while"
216 "do"
217 "break"
218 "continue"
219 "return"
220 "throw"
221 "try"
222 "catch"
223 "finally"
224 ] @keyword.control
225
226 [
227 "await"
228 "async"
229 ] @keyword.control
230
231 [
232 "import"
233 "export"
234 "from"
235 "as"
236 ] @keyword.control.import
237
238 ; Other keywords
239 [
240 "function"
241 "class"
242 "extends"
243 "implements"
244 "new"
245 "typeof"
246 "instanceof"
247 "in"
248 "of"
249 "void"
250 "delete"
251 "yield"
252 "static"
253 "get"
254 "set"
255 "abstract"
256 "readonly"
257 "declare"
258 "override"
259 ] @keyword
260
261 [
262 "let"
263 "const"
264 "var"
265 ] @keyword.storage
266
267 ; Special identifiers
268 [
269 (this)
270 (super)
271 ] @variable.builtin
272
273 ; Reserved identifiers used as special built-ins
274 ((identifier) @variable.builtin
275 (#any-of? @variable.builtin "arguments" "await" "component" "fragment" "track" "untrack"))
276
277 ; Properties
278 (property_signature
279 name: (property_name) @variable.other.member)
280
281 (pair
282 key: (property_name) @variable.other.member)
283
284 (shorthand_property_identifier) @variable.other.member
285 (shorthand_property_identifier_pattern) @variable.other.member
286
287 ; Private properties
288 (private_property_identifier) @variable.other.member
289
290 ; Punctuation
291 ["(" ")" "[" "]" "{" "}"] @punctuation.bracket
292 ["." "," ";" ":" "..."] @punctuation.delimiter
293 ; Note: < and > are handled separately in JSX contexts as @tag.delimiter
294
295 ; Special: Arrow function
296 "=>" @operator
297
298 ; Hash bang
299 (hash_bang_line) @comment