highlights.scm

  1; Variables
  2
  3(identifier) @variable
  4
  5; Properties
  6
  7(property_identifier) @property
  8
  9; Function and method calls
 10
 11(call_expression
 12  function: (identifier) @function)
 13
 14(call_expression
 15  function: (member_expression
 16    property: (property_identifier) @function.method))
 17
 18; Function and method definitions
 19
 20(function
 21  name: (identifier) @function)
 22(function_declaration
 23  name: (identifier) @function)
 24(method_definition
 25  name: (property_identifier) @function.method)
 26
 27(pair
 28  key: (property_identifier) @function.method
 29  value: [(function) (arrow_function)])
 30
 31(assignment_expression
 32  left: (member_expression
 33    property: (property_identifier) @function.method)
 34  right: [(function) (arrow_function)])
 35
 36(variable_declarator
 37  name: (identifier) @function
 38  value: [(function) (arrow_function)])
 39
 40(assignment_expression
 41  left: (identifier) @function
 42  right: [(function) (arrow_function)])
 43
 44; Special identifiers
 45
 46((identifier) @constructor
 47 (#match? @constructor "^[A-Z]"))
 48
 49((identifier) @type
 50 (#match? @type "^[A-Z]"))
 51(type_identifier) @type
 52(predefined_type) @type.builtin
 53
 54([
 55  (identifier)
 56  (shorthand_property_identifier)
 57  (shorthand_property_identifier_pattern)
 58 ] @constant
 59 (#match? @constant "^_*[A-Z_][A-Z\\d_]*$"))
 60
 61; Literals
 62
 63(this) @variable.special
 64(super) @variable.special
 65
 66[
 67  (null)
 68  (undefined)
 69] @constant.builtin
 70
 71[
 72  (true)
 73  (false)
 74] @boolean
 75
 76(comment) @comment
 77
 78[
 79  (string)
 80  (template_string)
 81] @string
 82
 83(escape_sequence) @string.escape
 84
 85(regex) @string.regex
 86(number) @number
 87
 88; Tokens
 89
 90[
 91  ";"
 92  "?."
 93  "."
 94  ","
 95  ":"
 96] @punctuation.delimiter
 97
 98[
 99  "-"
100  "--"
101  "-="
102  "+"
103  "++"
104  "+="
105  "*"
106  "*="
107  "**"
108  "**="
109  "/"
110  "/="
111  "%"
112  "%="
113  "<"
114  "<="
115  "<<"
116  "<<="
117  "="
118  "=="
119  "==="
120  "!"
121  "!="
122  "!=="
123  "=>"
124  ">"
125  ">="
126  ">>"
127  ">>="
128  ">>>"
129  ">>>="
130  "~"
131  "^"
132  "&"
133  "|"
134  "^="
135  "&="
136  "|="
137  "&&"
138  "||"
139  "??"
140  "&&="
141  "||="
142  "??="
143] @operator
144
145[
146  "("
147  ")"
148  "["
149  "]"
150  "{"
151  "}"
152]  @punctuation.bracket
153
154[
155  "as"
156  "async"
157  "await"
158  "break"
159  "case"
160  "catch"
161  "class"
162  "const"
163  "continue"
164  "debugger"
165  "default"
166  "delete"
167  "do"
168  "else"
169  "export"
170  "extends"
171  "finally"
172  "for"
173  "from"
174  "function"
175  "get"
176  "if"
177  "import"
178  "in"
179  "instanceof"
180  "let"
181  "new"
182  "of"
183  "return"
184  "satisfies"
185  "set"
186  "static"
187  "switch"
188  "target"
189  "throw"
190  "try"
191  "typeof"
192  "var"
193  "void"
194  "while"
195  "with"
196  "yield"
197] @keyword
198
199(template_substitution
200  "${" @punctuation.special
201  "}" @punctuation.special) @embedded
202
203(type_arguments
204  "<" @punctuation.bracket
205  ">" @punctuation.bracket)
206
207; Keywords
208
209[ "abstract"
210  "declare"
211  "enum"
212  "export"
213  "implements"
214  "interface"
215  "keyof"
216  "namespace"
217  "private"
218  "protected"
219  "public"
220  "type"
221  "readonly"
222  "override"
223] @keyword