on 59bf166 help sign in
257 lines 3.7 kB history raw
1; Special identifiers
2;--------------------
4([
5 (identifier)
6 (shorthand_property_identifier)
7 (shorthand_property_identifier_pattern)
8 ] @constant
9 (#match? @constant "^[A-Z_][A-Z\\d_]+$"))
12((identifier) @constructor
13 (#match? @constructor "^[A-Z]"))
15((identifier) @variable.builtin
16 (#match? @variable.builtin "^(arguments|module|console|window|document)$")
17 (#is-not? local))
19((identifier) @function.builtin
20 (#eq? @function.builtin "require")
21 (#is-not? local))
23; Function and method definitions
24;--------------------------------
26(function
27 name: (identifier) @function)
28(function_declaration
29 name: (identifier) @function)
30(method_definition
31 name: (property_identifier) @function.method)
33(pair
34 key: (property_identifier) @function.method
35 value: [(function) (arrow_function)])
37(assignment_expression
38 left: (member_expression
39 property: (property_identifier) @function.method)
40 right: [(function) (arrow_function)])
42(variable_declarator
43 name: (identifier) @function
44 value: [(function) (arrow_function)])
46(assignment_expression
47 left: (identifier) @function
48 right: [(function) (arrow_function)])
50; Function and method parameters
51;-------------------------------
53; (p) => ...
54(formal_parameters
55 (identifier) @variable.parameter)
57; (...p) => ...
58(formal_parameters
59 (rest_pattern
60 (identifier) @variable.parameter))
62; ({ p }) => ...
63(formal_parameters
64 (object_pattern
65 (shorthand_property_identifier_pattern) @variable.parameter))
67; ({ a: p }) => ...
68(formal_parameters
69 (object_pattern
70 (pair_pattern
71 value: (identifier) @variable.parameter)))
73; ([ p ]) => ...
74(formal_parameters
75 (array_pattern
76 (identifier) @variable.parameter))
78; (p = 1) => ...
79(formal_parameters
80 (assignment_pattern
81 left: (identifier) @variable.parameter))
83; p => ...
84(arrow_function
85 parameter: (identifier) @variable.parameter)
87; Function and method calls
88;--------------------------
90(call_expression
91 function: (identifier) @function)
93(call_expression
94 function: (member_expression
95 property: (property_identifier) @function.method))
97; Variables
98;----------
100(identifier) @variable
102; Properties
103;-----------
105(property_identifier) @variable.other.member
106(shorthand_property_identifier) @variable.other.member
107(shorthand_property_identifier_pattern) @variable.other.member
109; Literals
110;---------
112(this) @variable.builtin
113(super) @variable.builtin
116 (true)
117 (false)
118 (null)
119 (undefined)
120] @constant.builtin
122(comment) @comment
125 (string)
126 (template_string)
127] @string
129(regex) @string.regexp
130(number) @constant.numeric.integer
132; Tokens
133;-------
135(template_substitution
136 "${" @punctuation.special
137 "}" @punctuation.special) @embedded
140 ";"
141 "?."
142 "."
143 ","
144] @punctuation.delimiter
147 "-"
148 "--"
149 "-="
150 "+"
151 "++"
152 "+="
153 "*"
154 "*="
155 "**"
156 "**="
157 "/"
158 "/="
159 "%"
160 "%="
161 "<"
162 "<="
163 "<<"
164 "<<="
165 "="
166 "=="
167 "==="
168 "!"
169 "!="
170 "!=="
171 "=>"
172 ">"
173 ">="
174 ">>"
175 ">>="
176 ">>>"
177 ">>>="
178 "~"
179 "^"
180 "&"
181 "|"
182 "^="
183 "&="
184 "|="
185 "&&"
186 "||"
187 "??"
188 "&&="
189 "||="
190 "??="
191 "..."
192] @operator
194(ternary_expression ["?" ":"] @operator)
197 "("
198 ")"
199 "["
200 "]"
201 "{"
202 "}"
203] @punctuation.bracket
206 "as"
207 "async"
208 "debugger"
209 "delete"
210 "extends"
211 "from"
212 "function"
213 "get"
214 "in"
215 "instanceof"
216 "new"
217 "of"
218 "set"
219 "static"
220 "target"
221 "try"
222 "typeof"
223 "void"
224 "with"
225] @keyword
228 "class"
229 "let"
230 "const"
231 "var"
232] @keyword.storage.type
235 "switch"
236 "case"
237 "default"
238 "if"
239 "else"
240 "yield"
241 "throw"
242 "finally"
243 "return"
244 "catch"
245 "continue"
246 "while"
247 "break"
248 "for"
249 "do"
250 "await"
251] @keyword.control
254 "import"
255 "export"
256] @keyword.control.import