on deec290 help sign in
bat/assets/syntaxes/02_Extra/TypeScript.sublime-syntax
3368 lines 189 kB history raw
1%YAML 1.2
2---
3# http://www.sublimetext.com/docs/3/syntax.html
4name: TypeScript
5file_extensions:
6 - ts
7scope: source.ts
8contexts:
9 main:
10 - include: directives
11 - include: statements
12 - include: shebang
13 comment:
14 - match: /\*\*(?!/)
15 captures:
16 0: punctuation.definition.comment.ts
17 push:
18 - meta_scope: comment.block.documentation.ts
19 - match: \*/
20 captures:
21 0: punctuation.definition.comment.ts
22 pop: true
23 - include: docblock
24 - match: (/\*)(?:\s*((@)internal)(?=\s|(\*/)))?
25 captures:
26 1: punctuation.definition.comment.ts
27 2: storage.type.internaldeclaration.ts
28 3: punctuation.decorator.internaldeclaration.ts
29 push:
30 - meta_scope: comment.block.ts
31 - match: \*/
32 captures:
33 0: punctuation.definition.comment.ts
34 pop: true
35 - match: '(^[ \t]+)?((//)(?:\s*((@)internal)(?=\s|$))?)'
36 captures:
37 1: punctuation.whitespace.comment.leading.ts
38 2: comment.line.double-slash.ts
39 3: punctuation.definition.comment.ts
40 4: storage.type.internaldeclaration.ts
41 5: punctuation.decorator.internaldeclaration.ts
42 push:
43 - meta_content_scope: comment.line.double-slash.ts
44 - match: (?=$)
45 pop: true
46 access-modifier:
47 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(abstract|public|protected|private|readonly|static|declare)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
48 scope: storage.modifier.ts
49 after-operator-block-as-object-literal:
50 - match: '(?<!\+\+|--)(?<=[:=(,\[?+!>]|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^yield|[^\._$[:alnum:]]yield|^throw|[^\._$[:alnum:]]throw|^in|[^\._$[:alnum:]]in|^of|[^\._$[:alnum:]]of|^typeof|[^\._$[:alnum:]]typeof|&&|\|\||\*)\s*(\{)'
51 captures:
52 1: punctuation.definition.block.ts
53 push:
54 - meta_scope: meta.objectliteral.ts
55 - match: '\}'
56 captures:
57 0: punctuation.definition.block.ts
58 pop: true
59 - include: object-member
60 array-binding-pattern:
61 - match: '(?:(\.\.\.)\s*)?(\[)'
62 captures:
63 1: keyword.operator.rest.ts
64 2: punctuation.definition.binding-pattern.array.ts
65 push:
66 - match: '\]'
67 captures:
68 0: punctuation.definition.binding-pattern.array.ts
69 pop: true
70 - include: binding-element
71 - include: punctuation-comma
72 array-binding-pattern-const:
73 - match: '(?:(\.\.\.)\s*)?(\[)'
74 captures:
75 1: keyword.operator.rest.ts
76 2: punctuation.definition.binding-pattern.array.ts
77 push:
78 - match: '\]'
79 captures:
80 0: punctuation.definition.binding-pattern.array.ts
81 pop: true
82 - include: binding-element-const
83 - include: punctuation-comma
84 array-literal:
85 - match: '\s*(\[)'
86 captures:
87 1: meta.brace.square.ts
88 push:
89 - meta_scope: meta.array.literal.ts
90 - match: '\]'
91 captures:
92 0: meta.brace.square.ts
93 pop: true
94 - include: expression
95 - include: punctuation-comma
96 arrow-function:
97 - match: '(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(\basync)\s+)?([_$[:alpha:]][_$[:alnum:]]*)\s*(?==>)'
98 scope: meta.arrow.ts
99 captures:
100 1: storage.modifier.async.ts
101 2: variable.parameter.ts
102 - match: |-
103 (?x) (?:
104 (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(\basync)
105 )? ((?<![})!\]])\s*
106 (?=
107 # sure shot arrow functions even if => is on new line
108 (
109 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
110 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
111 (
112 ([)]\s*:) | # ():
113 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
114 )
115 ) |
117 # arrow function possible to detect only with => on same line
118 (
119 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
120 \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
121 (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
122 \s*=> # arrow operator
123 )
124 )
125 )
126 captures:
127 1: storage.modifier.async.ts
128 push:
129 - meta_scope: meta.arrow.ts
130 - match: '(?==>|\{|(^\s*(export|function|class|interface|let|var|const|import|enum|namespace|module|type|abstract|declare)\s+))'
131 pop: true
132 - include: comment
133 - include: type-parameters
134 - include: function-parameters
135 - include: arrow-return-type
136 - include: possibly-arrow-return-type
137 - match: "=>"
138 captures:
139 0: storage.type.function.arrow.ts
140 push:
141 - meta_scope: meta.arrow.ts
142 - match: '((?<=\}|\S)(?<!=>)|((?!\{)(?=\S)))(?!\/[\/\*])'
143 pop: true
144 - include: single-line-comment-consuming-line-ending
145 - include: decl-block
146 - include: expression
147 arrow-return-type:
148 - match: (?<=\))\s*(:)
149 captures:
150 1: keyword.operator.type.annotation.ts
151 push:
152 - meta_scope: meta.return.type.arrow.ts
153 - match: '(?==>|\{|(^\s*(export|function|class|interface|let|var|const|import|enum|namespace|module|type|abstract|declare)\s+))'
154 pop: true
155 - include: arrow-return-type-body
156 arrow-return-type-body:
157 - match: '(?<=[:])(?=\s*\{)'
158 push:
159 - match: '(?<=\})'
160 pop: true
161 - include: type-object
162 - include: type-predicate-operator
163 - include: type
164 async-modifier:
165 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(async)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
166 scope: storage.modifier.async.ts
167 binding-element:
168 - include: comment
169 - include: string
170 - include: numeric-literal
171 - include: regex
172 - include: object-binding-pattern
173 - include: array-binding-pattern
174 - include: destructuring-variable-rest
175 - include: variable-initializer
176 binding-element-const:
177 - include: comment
178 - include: string
179 - include: numeric-literal
180 - include: regex
181 - include: object-binding-pattern-const
182 - include: array-binding-pattern-const
183 - include: destructuring-variable-rest-const
184 - include: variable-initializer
185 boolean-literal:
186 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))true(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
187 scope: constant.language.boolean.true.ts
188 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))false(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
189 scope: constant.language.boolean.false.ts
190 brackets:
191 - match: "{"
192 push:
193 - match: '}|(?=\*/)'
194 pop: true
195 - include: brackets
196 - match: '\['
197 push:
198 - match: '\]|(?=\*/)'
199 pop: true
200 - include: brackets
201 cast:
202 - match: \s*(<)\s*(const)\s*(>)
203 scope: cast.expr.ts
204 captures:
205 1: meta.brace.angle.ts
206 2: storage.modifier.ts
207 3: meta.brace.angle.ts
208 - match: '(?:(?<!\+\+|--)(?<=^return|[^\._$[:alnum:]]return|^throw|[^\._$[:alnum:]]throw|^yield|[^\._$[:alnum:]]yield|^await|[^\._$[:alnum:]]await|^default|[^\._$[:alnum:]]default|[=(,:>*?\&\|\^]|[^_$[:alnum:]](?:\+\+|\-\-)|[^\+]\+|[^\-]\-))\s*(<)(?!<?\=)(?!\s*$)'
209 captures:
210 1: meta.brace.angle.ts
211 push:
212 - meta_scope: cast.expr.ts
213 - match: (\>)
214 captures:
215 1: meta.brace.angle.ts
216 pop: true
217 - include: type
218 - match: '(?:(?<=^))\s*(<)(?=[_$[:alpha:]][_$[:alnum:]]*\s*>)'
219 captures:
220 1: meta.brace.angle.ts
221 push:
222 - meta_scope: cast.expr.ts
223 - match: (\>)
224 captures:
225 1: meta.brace.angle.ts
226 pop: true
227 - include: type
228 class-declaration:
229 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(?:(abstract)\s+)?\b(class)\b(?=\s+|/[/*])'
230 captures:
231 1: keyword.control.export.ts
232 2: storage.modifier.ts
233 3: storage.modifier.ts
234 4: storage.type.class.ts
235 push:
236 - meta_scope: meta.class.ts
237 - match: '(?<=\})'
238 pop: true
239 - include: class-declaration-or-expression-patterns
240 class-declaration-or-expression-patterns:
241 - include: comment
242 - include: class-or-interface-heritage
243 - match: "[_$[:alpha:]][_$[:alnum:]]*"
244 captures:
245 0: entity.name.type.class.ts
246 - include: type-parameters
247 - include: class-or-interface-body
248 class-expression:
249 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(class)\b(?=\s+|[<{]|\/[\/*])'
250 captures:
251 1: storage.modifier.ts
252 2: storage.type.class.ts
253 push:
254 - meta_scope: meta.class.ts
255 - match: '(?<=\})'
256 pop: true
257 - include: class-declaration-or-expression-patterns
258 class-or-interface-body:
259 - match: '\{'
260 captures:
261 0: punctuation.definition.block.ts
262 push:
263 - match: '\}'
264 captures:
265 0: punctuation.definition.block.ts
266 pop: true
267 - include: comment
268 - include: decorator
269 - match: (?<=:)\s*
270 push:
271 - match: '(?=\s|[;),}\]:\-\+]|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
272 pop: true
273 - include: expression
274 - include: method-declaration
275 - include: indexer-declaration
276 - include: field-declaration
277 - include: string
278 - include: type-annotation
279 - include: variable-initializer
280 - include: access-modifier
281 - include: property-accessor
282 - include: async-modifier
283 - include: after-operator-block-as-object-literal
284 - include: decl-block
285 - include: expression
286 - include: punctuation-comma
287 - include: punctuation-semicolon
288 class-or-interface-heritage:
289 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(extends|implements)\b)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
290 captures:
291 1: storage.modifier.ts
292 push:
293 - match: '(?=\{)'
294 pop: true
295 - include: comment
296 - include: class-or-interface-heritage
297 - include: type-parameters
298 - include: expressionWithoutIdentifiers
299 - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))(?=\s*[_$[:alpha:]][_$[:alnum:]]*(\s*\??\.\s*[_$[:alpha:]][_$[:alnum:]]*)*\s*)'
300 captures:
301 1: entity.name.type.module.ts
302 2: punctuation.accessor.ts
303 3: punctuation.accessor.optional.ts
304 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
305 captures:
306 1: entity.other.inherited-class.ts
307 - include: expressionPunctuations
308 control-statement:
309 - include: switch-statement
310 - include: for-loop
311 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(catch|finally|throw|try)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
312 scope: keyword.control.trycatch.ts
313 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(break|continue|goto)\s+([_$[:alpha:]][_$[:alnum:]]*)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
314 captures:
315 1: keyword.control.loop.ts
316 2: entity.name.label.ts
317 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(break|continue|do|goto|while)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
318 scope: keyword.control.loop.ts
319 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(return)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
320 scope: keyword.control.flow.ts
321 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(case|default|switch)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
322 scope: keyword.control.switch.ts
323 - include: if-statement
324 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(else|if)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
325 scope: keyword.control.conditional.ts
326 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(with)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
327 scope: keyword.control.with.ts
328 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(package)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
329 scope: keyword.control.ts
330 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(debugger)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
331 scope: keyword.other.debugger.ts
332 decl-block:
333 - match: '\{'
334 captures:
335 0: punctuation.definition.block.ts
336 push:
337 - meta_scope: meta.block.ts
338 - match: '\}'
339 captures:
340 0: punctuation.definition.block.ts
341 pop: true
342 - include: statements
343 declaration:
344 - include: decorator
345 - include: var-expr
346 - include: function-declaration
347 - include: class-declaration
348 - include: interface-declaration
349 - include: enum-declaration
350 - include: namespace-declaration
351 - include: type-alias-declaration
352 - include: import-equals-declaration
353 - include: import-declaration
354 - include: export-declaration
355 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(declare|export)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
356 scope: storage.modifier.ts
357 decorator:
358 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))\@'
359 captures:
360 0: punctuation.decorator.ts
361 push:
362 - meta_scope: meta.decorator.ts
363 - match: (?=\s)
364 pop: true
365 - include: expression
366 destructuring-const:
367 - match: '(?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\{)'
368 push:
369 - meta_scope: meta.object-binding-pattern-variable.ts
370 - match: '(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
371 pop: true
372 - include: object-binding-pattern-const
373 - include: type-annotation
374 - include: comment
375 - match: '(?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\[)'
376 push:
377 - meta_scope: meta.array-binding-pattern-variable.ts
378 - match: '(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
379 pop: true
380 - include: array-binding-pattern-const
381 - include: type-annotation
382 - include: comment
383 destructuring-parameter:
384 - match: '(?<!=|:)\s*(?:(\.\.\.)\s*)?(\{)'
385 captures:
386 1: keyword.operator.rest.ts
387 2: punctuation.definition.binding-pattern.object.ts
388 push:
389 - meta_scope: meta.parameter.object-binding-pattern.ts
390 - match: '\}'
391 captures:
392 0: punctuation.definition.binding-pattern.object.ts
393 pop: true
394 - include: parameter-object-binding-element
395 - match: '(?<!=|:)\s*(?:(\.\.\.)\s*)?(\[)'
396 captures:
397 1: keyword.operator.rest.ts
398 2: punctuation.definition.binding-pattern.array.ts
399 push:
400 - meta_scope: meta.paramter.array-binding-pattern.ts
401 - match: '\]'
402 captures:
403 0: punctuation.definition.binding-pattern.array.ts
404 pop: true
405 - include: parameter-binding-element
406 - include: punctuation-comma
407 destructuring-parameter-rest:
408 - match: '(?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*)'
409 captures:
410 1: keyword.operator.rest.ts
411 2: variable.parameter.ts
412 destructuring-variable:
413 - match: '(?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\{)'
414 push:
415 - meta_scope: meta.object-binding-pattern-variable.ts
416 - match: '(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
417 pop: true
418 - include: object-binding-pattern
419 - include: type-annotation
420 - include: comment
421 - match: '(?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\[)'
422 push:
423 - meta_scope: meta.array-binding-pattern-variable.ts
424 - match: '(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
425 pop: true
426 - include: array-binding-pattern
427 - include: type-annotation
428 - include: comment
429 destructuring-variable-rest:
430 - match: '(?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*)'
431 captures:
432 1: keyword.operator.rest.ts
433 2: meta.definition.variable.ts variable.other.readwrite.ts
434 destructuring-variable-rest-const:
435 - match: '(?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*)'
436 captures:
437 1: keyword.operator.rest.ts
438 2: meta.definition.variable.ts variable.other.constant.ts
439 directives:
440 - match: '^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*((\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)))+\s*/>\s*$)'
441 captures:
442 1: punctuation.definition.comment.ts
443 push:
444 - meta_scope: comment.line.triple-slash.directive.ts
445 - match: (?=$)
446 pop: true
447 - match: (<)(reference|amd-dependency|amd-module)
448 captures:
449 1: punctuation.definition.tag.directive.ts
450 2: entity.name.tag.directive.ts
451 push:
452 - meta_scope: meta.tag.ts
453 - match: />
454 captures:
455 0: punctuation.definition.tag.directive.ts
456 pop: true
457 - match: path|types|no-default-lib|lib|name
458 scope: entity.other.attribute-name.directive.ts
459 - match: "="
460 scope: keyword.operator.assignment.ts
461 - include: string
462 docblock:
463 - match: |-
464 (?x)
465 ((@)(?:access|api))
466 \s+
467 (private|protected|public)
468 \b
469 captures:
470 1: storage.type.class.jsdoc
471 2: punctuation.definition.block.tag.jsdoc
472 3: constant.language.access-type.jsdoc
473 - match: |-
474 (?x)
475 ((@)author)
476 \s+
477 (
478 [^@\s<>*/]
479 (?:[^@<>*/]|\*[^/])*
480 )
481 (?:
482 \s*
483 (<)
484 ([^>\s]+)
485 (>)
486 )?
487 captures:
488 1: storage.type.class.jsdoc
489 2: punctuation.definition.block.tag.jsdoc
490 3: entity.name.type.instance.jsdoc
491 4: punctuation.definition.bracket.angle.begin.jsdoc
492 5: constant.other.email.link.underline.jsdoc
493 6: punctuation.definition.bracket.angle.end.jsdoc
494 - match: |-
495 (?x)
496 ((@)borrows) \s+
497 ((?:[^@\s*/]|\*[^/])+) # <that namepath>
498 \s+ (as) \s+ # as
499 ((?:[^@\s*/]|\*[^/])+) # <this namepath>
500 captures:
501 1: storage.type.class.jsdoc
502 2: punctuation.definition.block.tag.jsdoc
503 3: entity.name.type.instance.jsdoc
504 4: keyword.operator.control.jsdoc
505 5: entity.name.type.instance.jsdoc
506 - match: ((@)example)\s+
507 captures:
508 1: storage.type.class.jsdoc
509 2: punctuation.definition.block.tag.jsdoc
510 push:
511 - meta_scope: meta.example.jsdoc
512 - match: (?=@|\*/)
513 pop: true
514 - match: ^\s\*\s+
515 - match: \G(<)caption(>)
516 captures:
517 0: entity.name.tag.inline.jsdoc
518 1: punctuation.definition.bracket.angle.begin.jsdoc
519 2: punctuation.definition.bracket.angle.end.jsdoc
520 push:
521 - meta_content_scope: constant.other.description.jsdoc
522 - match: (</)caption(>)|(?=\*/)
523 captures:
524 0: entity.name.tag.inline.jsdoc
525 1: punctuation.definition.bracket.angle.begin.jsdoc
526 2: punctuation.definition.bracket.angle.end.jsdoc
527 pop: true
528 - match: '[^\s@*](?:[^*]|\*[^/])*'
529 captures:
530 0: source.embedded.ts
531 - match: (?x) ((@)kind) \s+ (class|constant|event|external|file|function|member|mixin|module|namespace|typedef) \b
532 captures:
533 1: storage.type.class.jsdoc
534 2: punctuation.definition.block.tag.jsdoc
535 3: constant.language.symbol-type.jsdoc
536 - match: |-
537 (?x)
538 ((@)see)
539 \s+
540 (?:
541 # URL
542 (
543 (?=https?://)
544 (?:[^\s*]|\*[^/])+
545 )
546 |
547 # JSDoc namepath
548 (
549 (?!
550 # Avoid matching bare URIs (also acceptable as links)
551 https?://
552 |
553 # Avoid matching {@inline tags}; we match those below
554 (?:\[[^\[\]]*\])? # Possible description [preceding]{@tag}
555 {@(?:link|linkcode|linkplain|tutorial)\b
556 )
557 # Matched namepath
558 (?:[^@\s*/]|\*[^/])+
559 )
560 )
561 captures:
562 1: storage.type.class.jsdoc
563 2: punctuation.definition.block.tag.jsdoc
564 3: variable.other.link.underline.jsdoc
565 4: entity.name.type.instance.jsdoc
566 - match: |-
567 (?x)
568 ((@)template)
569 \s+
570 # One or more valid identifiers
571 (
572 [A-Za-z_$] # First character: non-numeric word character
573 [\w$.\[\]]* # Rest of identifier
574 (?: # Possible list of additional identifiers
575 \s* , \s*
576 [A-Za-z_$]
577 [\w$.\[\]]*
578 )*
579 )
580 captures:
581 1: storage.type.class.jsdoc
582 2: punctuation.definition.block.tag.jsdoc
583 3: variable.other.jsdoc
584 - match: |-
585 (?x)
586 (
587 (@)
588 (?:arg|argument|const|constant|member|namespace|param|var)
589 )
590 \s+
591 (
592 [A-Za-z_$]
593 [\w$.\[\]]*
594 )
595 captures:
596 1: storage.type.class.jsdoc
597 2: punctuation.definition.block.tag.jsdoc
598 3: variable.other.jsdoc
599 - match: '((@)typedef)\s+(?={)'
600 captures:
601 1: storage.type.class.jsdoc
602 2: punctuation.definition.block.tag.jsdoc
603 push:
604 - match: '(?=\s|\*/|[^{}\[\]A-Za-z_$])'
605 pop: true
606 - include: jsdoctype
607 - match: '(?:[^@\s*/]|\*[^/])+'
608 scope: entity.name.type.instance.jsdoc
609 - match: '((@)(?:arg|argument|const|constant|member|namespace|param|prop|property|var))\s+(?={)'
610 captures:
611 1: storage.type.class.jsdoc
612 2: punctuation.definition.block.tag.jsdoc
613 push:
614 - match: '(?=\s|\*/|[^{}\[\]A-Za-z_$])'
615 pop: true
616 - include: jsdoctype
617 - match: '([A-Za-z_$][\w$.\[\]]*)'
618 scope: variable.other.jsdoc
619 - match: |-
620 (?x)
621 (\[)\s*
622 [\w$]+
623 (?:
624 (?:\[\])? # Foo[ ].bar properties within an array
625 \. # Foo.Bar namespaced parameter
626 [\w$]+
627 )*
628 (?:
629 \s*
630 (=) # [foo=bar] Default parameter value
631 \s*
632 (
633 # The inner regexes are to stop the match early at */ and to not stop at escaped quotes
634 (?>
635 "(?:(?:\*(?!/))|(?:\\(?!"))|[^*\\])*?" | # [foo="bar"] Double-quoted
636 '(?:(?:\*(?!/))|(?:\\(?!'))|[^*\\])*?' | # [foo='bar'] Single-quoted
637 \[ (?:(?:\*(?!/))|[^*])*? \] | # [foo=[1,2]] Array literal
638 (?:(?:\*(?!/))|\s(?!\s*\])|\[.*?(?:\]|(?=\*/))|[^*\s\[\]])* # Everything else
639 )*
640 )
641 )?
642 \s*(?:(\])((?:[^*\s]|\*[^\s/])+)?|(?=\*/))
643 scope: variable.other.jsdoc
644 captures:
645 1: punctuation.definition.optional-value.begin.bracket.square.jsdoc
646 2: keyword.operator.assignment.jsdoc
647 3: source.embedded.ts
648 4: punctuation.definition.optional-value.end.bracket.square.jsdoc
649 5: invalid.illegal.syntax.jsdoc
650 - match: |-
651 (?x)
652 (
653 (@)
654 (?:define|enum|exception|export|extends|lends|implements|modifies
655 |namespace|private|protected|returns?|suppress|this|throws|type
656 |yields?)
657 )
658 \s+(?={)
659 captures:
660 1: storage.type.class.jsdoc
661 2: punctuation.definition.block.tag.jsdoc
662 push:
663 - match: '(?=\s|\*/|[^{}\[\]A-Za-z_$])'
664 pop: true
665 - include: jsdoctype
666 - match: |-
667 (?x)
668 (
669 (@)
670 (?:alias|augments|callback|constructs|emits|event|fires|exports?
671 |extends|external|function|func|host|lends|listens|interface|memberof!?
672 |method|module|mixes|mixin|name|requires|see|this|typedef|uses)
673 )
674 \s+
675 (
676 (?:
677 [^{}@\s*] | \*[^/]
678 )+
679 )
680 captures:
681 1: storage.type.class.jsdoc
682 2: punctuation.definition.block.tag.jsdoc
683 3: entity.name.type.instance.jsdoc
684 - match: '((@)(?:default(?:value)?|license|version))\s+(([''''"]))'
685 captures:
686 1: storage.type.class.jsdoc
687 2: punctuation.definition.block.tag.jsdoc
688 3: variable.other.jsdoc
689 4: punctuation.definition.string.begin.jsdoc
690 push:
691 - meta_content_scope: variable.other.jsdoc
692 - match: (\3)|(?=$|\*/)
693 captures:
694 0: variable.other.jsdoc
695 1: punctuation.definition.string.end.jsdoc
696 pop: true
697 - match: '((@)(?:default(?:value)?|license|tutorial|variation|version))\s+([^\s*]+)'
698 captures:
699 1: storage.type.class.jsdoc
700 2: punctuation.definition.block.tag.jsdoc
701 3: variable.other.jsdoc
702 - match: '(?x) (@) (?:abstract|access|alias|api|arg|argument|async|attribute|augments|author|beta|borrows|bubbles |callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright |default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exception |exports?|extends|extension(?:_?for)?|external|externs|file|fileoverview|final|fires|for|func |function|generator|global|hideconstructor|host|ignore|implements|implicitCast|inherit[Dd]oc |inner|instance|interface|internal|kind|lends|license|listens|main|member|memberof!?|method |mixes|mixins?|modifies|module|name|namespace|noalias|nocollapse|nocompile|nosideeffects |override|overview|package|param|polymer(?:Behavior)?|preserve|private|prop|property|protected |public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule|summary |suppress|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation |version|virtual|writeOnce|yields?) \b'
703 scope: storage.type.class.jsdoc
704 captures:
705 1: punctuation.definition.block.tag.jsdoc
706 - include: inline-tags
707 - match: '((@)(?:[_$[:alpha:]][_$[:alnum:]]*))(?=\s+)'
708 captures:
709 1: storage.type.class.jsdoc
710 2: punctuation.definition.block.tag.jsdoc
711 enum-declaration:
712 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?(?:\b(const)\s+)?\b(enum)\s+([_$[:alpha:]][_$[:alnum:]]*)'
713 captures:
714 1: keyword.control.export.ts
715 2: storage.modifier.ts
716 3: storage.modifier.ts
717 4: storage.type.enum.ts
718 5: entity.name.type.enum.ts
719 push:
720 - meta_scope: meta.enum.declaration.ts
721 - match: '(?<=\})'
722 pop: true
723 - include: comment
724 - match: '\{'
725 captures:
726 0: punctuation.definition.block.ts
727 push:
728 - match: '\}'
729 captures:
730 0: punctuation.definition.block.ts
731 pop: true
732 - include: comment
733 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
734 captures:
735 0: variable.other.enummember.ts
736 push:
737 - match: '(?=,|\}|$)'
738 pop: true
739 - include: comment
740 - include: variable-initializer
741 - match: '(?=((\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\])))'
742 push:
743 - match: '(?=,|\}|$)'
744 pop: true
745 - include: string
746 - include: array-literal
747 - include: comment
748 - include: variable-initializer
749 - include: punctuation-comma
750 export-declaration:
751 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(export)\s+(as)\s+(namespace)\s+([_$[:alpha:]][_$[:alnum:]]*)'
752 captures:
753 1: keyword.control.export.ts
754 2: keyword.control.as.ts
755 3: storage.type.namespace.ts
756 4: entity.name.type.module.ts
757 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(export)(?:\s+(type))?(?:(?:\s*(=))|(?:\s+(default)(?=\s+)))'
758 captures:
759 1: keyword.control.export.ts
760 2: keyword.control.type.ts
761 3: keyword.operator.assignment.ts
762 4: keyword.control.default.ts
763 push:
764 - meta_scope: meta.export.default.ts
765 - match: (?=$|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))
766 pop: true
767 - include: interface-declaration
768 - include: expression
769 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(export)(?:\s+(type))?\b(?!(\$)|(\s*:))((?=\s*[\{*])|((?=\s*[_$[:alpha:]][_$[:alnum:]]*(\s|,))(?!\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b)))'
770 captures:
771 1: keyword.control.export.ts
772 2: keyword.control.type.ts
773 push:
774 - meta_scope: meta.export.ts
775 - match: (?=$|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))
776 pop: true
777 - include: import-export-declaration
778 expression:
779 - include: expressionWithoutIdentifiers
780 - include: identifiers
781 - include: expressionPunctuations
782 expression-inside-possibly-arrow-parens:
783 - include: expressionWithoutIdentifiers
784 - include: comment
785 - include: string
786 - include: decorator
787 - include: destructuring-parameter
788 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|protected|private|readonly)\s+(?=(public|protected|private|readonly)\s+)'
789 captures:
790 1: storage.modifier.ts
791 - match: |-
792 (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*
793 # function assignment |
794 (=\s*(
795 ((async\s+)?(
796 (function\s*[(<*]) |
797 (function\s+) |
798 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
799 )) |
800 ((async\s*)?(
801 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
802 # sure shot arrow functions even if => is on new line
803 (
804 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
805 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
806 (
807 ([)]\s*:) | # ():
808 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
809 )
810 ) |
812 # arrow function possible to detect only with => on same line
813 (
814 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
815 \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
816 (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
817 \s*=> # arrow operator
818 )
819 ))
820 )) |
821 # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
822 (:\s*(
823 (<) |
824 ([(]\s*(
825 ([)]) |
826 (\.\.\.) |
827 ([_$[:alnum:]]+\s*(
828 ([:,?=])|
829 ([)]\s*=>)
830 ))
831 ))
832 )) |
833 (:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
834 (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
835 (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
836 ((async\s+)?(
837 (function\s*[(<*]) |
838 (function\s+) |
839 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
840 )) |
841 ((async\s*)?(
842 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
843 # sure shot arrow functions even if => is on new line
844 (
845 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
846 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
847 (
848 ([)]\s*:) | # ():
849 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
850 )
851 ) |
853 # arrow function possible to detect only with => on same line
854 (
855 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
856 \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
857 (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
858 \s*=> # arrow operator
859 )
860 ))
861 )))
862 captures:
863 1: storage.modifier.ts
864 2: keyword.operator.rest.ts
865 3: entity.name.function.ts variable.language.this.ts
866 4: entity.name.function.ts
867 5: keyword.operator.optional.ts
868 - match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*[:,]|$)'
869 captures:
870 1: storage.modifier.ts
871 2: keyword.operator.rest.ts
872 3: variable.parameter.ts variable.language.this.ts
873 4: variable.parameter.ts
874 5: keyword.operator.optional.ts
875 - include: type-annotation
876 - include: variable-initializer
877 - match: ","
878 scope: punctuation.separator.parameter.ts
879 - include: identifiers
880 - include: expressionPunctuations
881 expression-operators:
882 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(await)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
883 scope: keyword.control.flow.ts
884 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(yield)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))(?=\s*\/\*([^\*]|(\*[^\/]))*\*\/\s*\*)'
885 captures:
886 1: keyword.control.flow.ts
887 push:
888 - match: \*
889 captures:
890 0: keyword.generator.asterisk.ts
891 pop: true
892 - include: comment
893 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(yield)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))(?:\s*(\*))?'
894 captures:
895 1: keyword.control.flow.ts
896 2: keyword.generator.asterisk.ts
897 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))delete(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
898 scope: keyword.operator.expression.delete.ts
899 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))in(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))(?!\()'
900 scope: keyword.operator.expression.in.ts
901 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))of(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))(?!\()'
902 scope: keyword.operator.expression.of.ts
903 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))instanceof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
904 scope: keyword.operator.expression.instanceof.ts
905 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
906 scope: keyword.operator.new.ts
907 - include: typeof-operator
908 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))void(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
909 scope: keyword.operator.expression.void.ts
910 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+(const)(?=\s*($|[;,:})\]]))'
911 captures:
912 1: keyword.control.as.ts
913 2: storage.modifier.ts
914 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+'
915 captures:
916 1: keyword.control.as.ts
917 push:
918 - match: '(?=^|[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+)|(\s+\<))'
919 pop: true
920 - include: type
921 - match: \.\.\.
922 scope: keyword.operator.spread.ts
923 - match: \*=|(?<!\()/=|%=|\+=|\-=
924 scope: keyword.operator.assignment.compound.ts
925 - match: \&=|\^=|<<=|>>=|>>>=|\|=
926 scope: keyword.operator.assignment.compound.bitwise.ts
927 - match: "<<|>>>|>>"
928 scope: keyword.operator.bitwise.shift.ts
929 - match: "===|!==|==|!="
930 scope: keyword.operator.comparison.ts
931 - match: <=|>=|<>|<|>
932 scope: keyword.operator.relational.ts
933 - match: '(?<=[_$[:alnum:]])(\!)\s*(/)(?![/*])'
934 captures:
935 1: keyword.operator.logical.ts
936 2: keyword.operator.arithmetic.ts
937 - match: \!|&&|\|\||\?\?
938 scope: keyword.operator.logical.ts
939 - match: \&|~|\^|\|
940 scope: keyword.operator.bitwise.ts
941 - match: \=
942 scope: keyword.operator.assignment.ts
943 - match: "--"
944 scope: keyword.operator.decrement.ts
945 - match: \+\+
946 scope: keyword.operator.increment.ts
947 - match: '%|\*|/|-|\+'
948 scope: keyword.operator.arithmetic.ts
949 - match: '(?<=[_$[:alnum:])\]])\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)+(/)(?![/*]))'
950 push:
951 - match: '(/)(?!\*([^\*]|(\*[^\/]))*\*\/)'
952 captures:
953 1: keyword.operator.arithmetic.ts
954 pop: true
955 - include: comment
956 - match: '(?<=[_$[:alnum:])\]])\s*(/)(?![/*])'
957 captures:
958 1: keyword.operator.arithmetic.ts
959 expressionPunctuations:
960 - include: punctuation-comma
961 - include: punctuation-accessor
962 expressionWithoutIdentifiers:
963 - include: string
964 - include: regex
965 - include: comment
966 - include: function-expression
967 - include: class-expression
968 - include: arrow-function
969 - include: paren-expression-possibly-arrow
970 - include: cast
971 - include: ternary-expression
972 - include: new-expr
973 - include: instanceof-expr
974 - include: object-literal
975 - include: expression-operators
976 - include: function-call
977 - include: literal
978 - include: support-objects
979 - include: paren-expression
980 field-declaration:
981 - match: |-
982 (?x)(?<!\()(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(readonly)\s+)?(?=\s*((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
983 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
984 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
985 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
986 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
987 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
988 (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
989 (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
990 (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
991 )(?!\$))|(\#?[_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(?:(?:(\?)|(\!))\s*)?(=|:|;|,|\}|$))
992 captures:
993 1: storage.modifier.ts
994 push:
995 - meta_scope: meta.field.declaration.ts
996 - match: |-
997 (?x)(?=\}|;|,|$|(^(?!\s*((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
998 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
999 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1000 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1001 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1002 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1003 (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1004 (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1005 (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1006 )(?!\$))|(\#?[_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(?:(?:(\?)|(\!))\s*)?(=|:|;|,|$))))|(?<=\})
1007 pop: true
1008 - include: variable-initializer
1009 - include: type-annotation
1010 - include: string
1011 - include: array-literal
1012 - include: numeric-literal
1013 - include: comment
1014 - match: |-
1015 (?x)(\#?[_$[:alpha:]][_$[:alnum:]]*)(?:(\?)|(\!))?(?=\s*\s*
1016 # function assignment |
1017 (=\s*(
1018 ((async\s+)?(
1019 (function\s*[(<*]) |
1020 (function\s+) |
1021 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
1022 )) |
1023 ((async\s*)?(
1024 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
1025 # sure shot arrow functions even if => is on new line
1027 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
1028 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
1030 ([)]\s*:) | # ():
1031 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
1033 ) |
1035 # arrow function possible to detect only with => on same line
1037 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
1038 \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
1039 (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
1040 \s*=> # arrow operator
1042 ))
1043 )) |
1044 # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
1045 (:\s*(
1046 (<) |
1047 ([(]\s*(
1048 ([)]) |
1049 (\.\.\.) |
1050 ([_$[:alnum:]]+\s*(
1051 ([:,?=])|
1052 ([)]\s*=>)
1053 ))
1054 ))
1055 )) |
1056 (:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
1057 (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
1058 (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
1059 ((async\s+)?(
1060 (function\s*[(<*]) |
1061 (function\s+) |
1062 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
1063 )) |
1064 ((async\s*)?(
1065 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
1066 # sure shot arrow functions even if => is on new line
1068 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
1069 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
1071 ([)]\s*:) | # ():
1072 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
1074 ) |
1076 # arrow function possible to detect only with => on same line
1078 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
1079 \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
1080 (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
1081 \s*=> # arrow operator
1083 ))
1084 )))
1085 captures:
1086 1: meta.definition.property.ts entity.name.function.ts
1087 2: keyword.operator.optional.ts
1088 3: keyword.operator.definiteassignment.ts
1089 - match: '\#?[_$[:alpha:]][_$[:alnum:]]*'
1090 scope: meta.definition.property.ts variable.object.property.ts
1091 - match: \?
1092 scope: keyword.operator.optional.ts
1093 - match: \!
1094 scope: keyword.operator.definiteassignment.ts
1095 for-loop:
1096 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))for(?=((\s+|(\s*\/\*([^\*]|(\*[^\/]))*\*\/\s*))await)?\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)?(\())'
1097 captures:
1098 0: keyword.control.loop.ts
1099 push:
1100 - match: (?<=\))
1101 pop: true
1102 - include: comment
1103 - match: await
1104 scope: keyword.control.loop.ts
1105 - match: \(
1106 captures:
1107 0: meta.brace.round.ts
1108 push:
1109 - match: \)
1110 captures:
1111 0: meta.brace.round.ts
1112 pop: true
1113 - include: var-expr
1114 - include: expression
1115 - include: punctuation-semicolon
1116 function-body:
1117 - include: comment
1118 - include: type-parameters
1119 - include: function-parameters
1120 - include: return-type
1121 - include: decl-block
1122 - match: \*
1123 scope: keyword.generator.asterisk.ts
1124 function-call:
1125 - match: '(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\())'
1126 push:
1127 - match: '(?<=\))(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\())'
1128 pop: true
1129 - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))'
1130 push:
1131 - meta_scope: meta.function-call.ts
1132 - match: '(?=\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\())'
1133 pop: true
1134 - include: function-call-target
1135 - include: comment
1136 - include: function-call-optionals
1137 - include: type-arguments
1138 - include: paren-expression
1139 - match: '(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))(<\s*[\{\[\(]\s*$))'
1140 push:
1141 - match: '(?<=\>)(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))(<\s*[\{\[\(]\s*$))'
1142 pop: true
1143 - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))'
1144 push:
1145 - meta_scope: meta.function-call.ts
1146 - match: '(?=(<\s*[\{\[\(]\s*$))'
1147 pop: true
1148 - include: function-call-target
1149 - include: comment
1150 - include: function-call-optionals
1151 - include: type-arguments
1152 function-call-optionals:
1153 - match: \?\.
1154 scope: meta.function-call.ts punctuation.accessor.optional.ts
1155 - match: \!
1156 scope: meta.function-call.ts keyword.operator.definiteassignment.ts
1157 function-call-target:
1158 - include: support-function-call-identifiers
1159 - match: '(\#?[_$[:alpha:]][_$[:alnum:]]*)'
1160 scope: entity.name.function.ts
1161 function-declaration:
1162 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?(?:(async)\s+)?(function\b)(?:\s*(\*))?(?:(?:\s+|(?<=\*))([_$[:alpha:]][_$[:alnum:]]*))?\s*'
1163 captures:
1164 1: keyword.control.export.ts
1165 2: storage.modifier.ts
1166 3: storage.modifier.async.ts
1167 4: storage.type.function.ts
1168 5: keyword.generator.asterisk.ts
1169 6: meta.definition.function.ts entity.name.function.ts
1170 push:
1171 - meta_scope: meta.function.ts
1172 - match: '(?=;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))|(?<=\})'
1173 pop: true
1174 - include: function-name
1175 - include: function-body
1176 function-expression:
1177 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(async)\s+)?(function\b)(?:\s*(\*))?(?:(?:\s+|(?<=\*))([_$[:alpha:]][_$[:alnum:]]*))?\s*'
1178 captures:
1179 1: storage.modifier.async.ts
1180 2: storage.type.function.ts
1181 3: keyword.generator.asterisk.ts
1182 4: meta.definition.function.ts entity.name.function.ts
1183 push:
1184 - meta_scope: meta.function.expression.ts
1185 - match: '(?=;)|(?<=\})'
1186 pop: true
1187 - include: function-name
1188 - include: single-line-comment-consuming-line-ending
1189 - include: function-body
1190 function-name:
1191 - match: "[_$[:alpha:]][_$[:alnum:]]*"
1192 scope: meta.definition.function.ts entity.name.function.ts
1193 function-parameters:
1194 - match: \(
1195 captures:
1196 0: punctuation.definition.parameters.begin.ts
1197 push:
1198 - meta_scope: meta.parameters.ts
1199 - match: \)
1200 captures:
1201 0: punctuation.definition.parameters.end.ts
1202 pop: true
1203 - include: function-parameters-body
1204 function-parameters-body:
1205 - include: comment
1206 - include: string
1207 - include: decorator
1208 - include: destructuring-parameter
1209 - include: parameter-name
1210 - include: parameter-type-annotation
1211 - include: variable-initializer
1212 - match: ","
1213 scope: punctuation.separator.parameter.ts
1214 identifiers:
1215 - include: object-identifiers
1216 - match: |-
1217 (?x)(?:(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*)?([_$[:alpha:]][_$[:alnum:]]*)(?=\s*=\s*(
1218 ((async\s+)?(
1219 (function\s*[(<*]) |
1220 (function\s+) |
1221 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
1222 )) |
1223 ((async\s*)?(
1224 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
1225 # sure shot arrow functions even if => is on new line
1227 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
1228 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
1230 ([)]\s*:) | # ():
1231 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
1233 ) |
1235 # arrow function possible to detect only with => on same line
1237 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
1238 \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
1239 (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
1240 \s*=> # arrow operator
1242 ))
1243 ))
1244 captures:
1245 1: punctuation.accessor.ts
1246 2: punctuation.accessor.optional.ts
1247 3: entity.name.function.ts
1248 - match: '(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(\#?[[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])'
1249 captures:
1250 1: punctuation.accessor.ts
1251 2: punctuation.accessor.optional.ts
1252 3: variable.other.constant.property.ts
1253 - match: '(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(\#?[_$[:alpha:]][_$[:alnum:]]*)'
1254 captures:
1255 1: punctuation.accessor.ts
1256 2: punctuation.accessor.optional.ts
1257 3: variable.other.property.ts
1258 - match: "([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])"
1259 scope: variable.other.constant.ts
1260 - match: "[_$[:alpha:]][_$[:alnum:]]*"
1261 scope: variable.other.readwrite.ts
1262 if-statement:
1263 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?=\bif\s*(\(([^\(\)]|(\([^\(\)]*\)))*\))\s*(?!\{))'
1264 push:
1265 - match: '(?=;|$|\})'
1266 pop: true
1267 - include: comment
1268 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(if)\s*(\()'
1269 captures:
1270 1: keyword.control.conditional.ts
1271 2: meta.brace.round.ts
1272 push:
1273 - match: \)
1274 captures:
1275 0: meta.brace.round.ts
1276 pop: true
1277 - include: expression
1278 - match: '(?<=\))\s*\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/([gimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
1279 captures:
1280 0: punctuation.definition.string.begin.ts
1281 push:
1282 - meta_scope: string.regexp.ts
1283 - match: "(/)([gimsuy]*)"
1284 captures:
1285 1: punctuation.definition.string.end.ts
1286 2: keyword.other.ts
1287 pop: true
1288 - include: regexp
1289 - include: statements
1290 import-declaration:
1291 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(import)(?:\s+(type)(?!\s+from))?(?!\s*[:\(])(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
1292 captures:
1293 1: keyword.control.export.ts
1294 2: storage.modifier.ts
1295 3: keyword.control.import.ts
1296 4: keyword.control.type.ts
1297 push:
1298 - meta_scope: meta.import.ts
1299 - match: '(?<!^import|[^\._$[:alnum:]]import)(?=;|$|^)'
1300 pop: true
1301 - include: single-line-comment-consuming-line-ending
1302 - include: comment
1303 - include: string
1304 - match: '(?<=^import|[^\._$[:alnum:]]import)(?!\s*["''])'
1305 push:
1306 - match: \bfrom\b
1307 captures:
1308 0: keyword.control.from.ts
1309 pop: true
1310 - include: import-export-declaration
1311 - include: import-export-declaration
1312 import-equals-declaration:
1313 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(import)(?:\s+(type))?\s+([_$[:alpha:]][_$[:alnum:]]*)\s*(=)\s*(require)\s*(\()'
1314 captures:
1315 1: keyword.control.export.ts
1316 2: storage.modifier.ts
1317 3: keyword.control.import.ts
1318 4: keyword.control.type.ts
1319 5: variable.other.readwrite.alias.ts
1320 6: keyword.operator.assignment.ts
1321 7: keyword.control.require.ts
1322 8: meta.brace.round.ts
1323 push:
1324 - meta_scope: meta.import-equals.external.ts
1325 - match: \)
1326 captures:
1327 0: meta.brace.round.ts
1328 pop: true
1329 - include: comment
1330 - include: string
1331 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(import)(?:\s+(type))?\s+([_$[:alpha:]][_$[:alnum:]]*)\s*(=)\s*(?!require\b)'
1332 captures:
1333 1: keyword.control.export.ts
1334 2: storage.modifier.ts
1335 3: keyword.control.import.ts
1336 4: keyword.control.type.ts
1337 5: variable.other.readwrite.alias.ts
1338 6: keyword.operator.assignment.ts
1339 push:
1340 - meta_scope: meta.import-equals.internal.ts
1341 - match: (?=;|$|^)
1342 pop: true
1343 - include: single-line-comment-consuming-line-ending
1344 - include: comment
1345 - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))'
1346 captures:
1347 1: entity.name.type.module.ts
1348 2: punctuation.accessor.ts
1349 3: punctuation.accessor.optional.ts
1350 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
1351 scope: variable.other.readwrite.ts
1352 import-export-block:
1353 - match: '\{'
1354 captures:
1355 0: punctuation.definition.block.ts
1356 push:
1357 - meta_scope: meta.block.ts
1358 - match: '\}'
1359 captures:
1360 0: punctuation.definition.block.ts
1361 pop: true
1362 - include: import-export-clause
1363 import-export-clause:
1364 - include: comment
1365 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bdefault)|(\*)|(\b[_$[:alpha:]][_$[:alnum:]]*))\s+(as)\s+(?:(default(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|([_$[:alpha:]][_$[:alnum:]]*))'
1366 captures:
1367 1: keyword.control.default.ts
1368 2: constant.language.import-export-all.ts
1369 3: variable.other.readwrite.ts
1370 4: keyword.control.as.ts
1371 5: keyword.control.default.ts
1372 6: variable.other.readwrite.alias.ts
1373 - include: punctuation-comma
1374 - match: \*
1375 scope: constant.language.import-export-all.ts
1376 - match: \b(default)\b
1377 scope: keyword.control.default.ts
1378 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
1379 scope: variable.other.readwrite.alias.ts
1380 import-export-declaration:
1381 - include: comment
1382 - include: string
1383 - include: import-export-block
1384 - match: \bfrom\b
1385 scope: keyword.control.from.ts
1386 - include: import-export-clause
1387 indexer-declaration:
1388 - match: '(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(readonly)\s*)?\s*(\[)\s*([_$[:alpha:]][_$[:alnum:]]*)\s*(?=:)'
1389 captures:
1390 1: storage.modifier.ts
1391 2: meta.brace.square.ts
1392 3: variable.parameter.ts
1393 push:
1394 - meta_scope: meta.indexer.declaration.ts
1395 - match: '(\])\s*(\?\s*)?|$'
1396 captures:
1397 1: meta.brace.square.ts
1398 2: keyword.operator.optional.ts
1399 pop: true
1400 - include: type-annotation
1401 indexer-mapped-type-declaration:
1402 - match: '(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))([+-])?(readonly)\s*)?\s*(\[)\s*([_$[:alpha:]][_$[:alnum:]]*)\s+(in)\s+'
1403 captures:
1404 1: keyword.operator.type.modifier.ts
1405 2: storage.modifier.ts
1406 3: meta.brace.square.ts
1407 4: entity.name.type.ts
1408 5: keyword.operator.expression.in.ts
1409 push:
1410 - meta_scope: meta.indexer.mappedtype.declaration.ts
1411 - match: '(\])([+-])?\s*(\?\s*)?|$'
1412 captures:
1413 1: meta.brace.square.ts
1414 2: keyword.operator.type.modifier.ts
1415 3: keyword.operator.optional.ts
1416 pop: true
1417 - include: type
1418 inline-tags:
1419 - match: '(\[)[^\]]+(\])(?={@(?:link|linkcode|linkplain|tutorial))'
1420 scope: constant.other.description.jsdoc
1421 captures:
1422 1: punctuation.definition.bracket.square.begin.jsdoc
1423 2: punctuation.definition.bracket.square.end.jsdoc
1424 - match: '({)((@)(?:link(?:code|plain)?|tutorial))\s*'
1425 captures:
1426 1: punctuation.definition.bracket.curly.begin.jsdoc
1427 2: storage.type.class.jsdoc
1428 3: punctuation.definition.inline.tag.jsdoc
1429 push:
1430 - meta_scope: entity.name.type.instance.jsdoc
1431 - match: '}|(?=\*/)'
1432 captures:
1433 0: punctuation.definition.bracket.curly.end.jsdoc
1434 pop: true
1435 - match: '\G((?=https?://)(?:[^|}\s*]|\*[/])+)(\|)?'
1436 captures:
1437 1: variable.other.link.underline.jsdoc
1438 2: punctuation.separator.pipe.jsdoc
1439 - match: '\G((?:[^{}@\s|*]|\*[^/])+)(\|)?'
1440 captures:
1441 1: variable.other.description.jsdoc
1442 2: punctuation.separator.pipe.jsdoc
1443 instanceof-expr:
1444 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(instanceof)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
1445 captures:
1446 1: keyword.operator.expression.instanceof.ts
1447 push:
1448 - match: '(?<=\))|(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|(([\&\~\^\|]\s*)?[_$[:alpha:]][_$[:alnum:]]*\s+instanceof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
1449 pop: true
1450 - include: type
1451 interface-declaration:
1452 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(?:(abstract)\s+)?\b(interface)\b(?=\s+|/[/*])'
1453 captures:
1454 1: keyword.control.export.ts
1455 2: storage.modifier.ts
1456 3: storage.modifier.ts
1457 4: storage.type.interface.ts
1458 push:
1459 - meta_scope: meta.interface.ts
1460 - match: '(?<=\})'
1461 pop: true
1462 - include: comment
1463 - include: class-or-interface-heritage
1464 - match: "[_$[:alpha:]][_$[:alnum:]]*"
1465 captures:
1466 0: entity.name.type.interface.ts
1467 - include: type-parameters
1468 - include: class-or-interface-body
1469 jsdoctype:
1470 - match: '\G{(?:[^}*]|\*[^/}])+$'
1471 scope: invalid.illegal.type.jsdoc
1472 - match: '\G({)'
1473 captures:
1474 0: entity.name.type.instance.jsdoc
1475 1: punctuation.definition.bracket.curly.begin.jsdoc
1476 push:
1477 - meta_content_scope: entity.name.type.instance.jsdoc
1478 - match: '((}))\s*|(?=\*/)'
1479 captures:
1480 1: entity.name.type.instance.jsdoc
1481 2: punctuation.definition.bracket.curly.end.jsdoc
1482 pop: true
1483 - include: brackets
1484 label:
1485 - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(:)(?=\s*\{)'
1486 captures:
1487 1: entity.name.label.ts
1488 2: punctuation.separator.label.ts
1489 push:
1490 - match: '(?<=\})'
1491 pop: true
1492 - include: decl-block
1493 - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(:)'
1494 captures:
1495 1: entity.name.label.ts
1496 2: punctuation.separator.label.ts
1497 literal:
1498 - include: numeric-literal
1499 - include: boolean-literal
1500 - include: null-literal
1501 - include: undefined-literal
1502 - include: numericConstant-literal
1503 - include: array-literal
1504 - include: this-literal
1505 - include: super-literal
1506 method-declaration:
1507 - match: '(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?\s*\b(constructor)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
1508 captures:
1509 1: storage.modifier.ts
1510 2: storage.modifier.ts
1511 3: storage.modifier.async.ts
1512 4: storage.type.ts
1513 push:
1514 - meta_scope: meta.method.declaration.ts
1515 - match: '(?=\}|;|,|$)|(?<=\})'
1516 pop: true
1517 - include: method-declaration-name
1518 - include: function-body
1519 - match: '(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:(?:\s*\b(new)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|(?:(\*)\s*)?)(?=\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])'
1520 captures:
1521 1: storage.modifier.ts
1522 2: storage.modifier.ts
1523 3: storage.modifier.async.ts
1524 4: keyword.operator.new.ts
1525 5: keyword.generator.asterisk.ts
1526 push:
1527 - meta_scope: meta.method.declaration.ts
1528 - match: '(?=\}|;|,|$)|(?<=\})'
1529 pop: true
1530 - include: method-declaration-name
1531 - include: function-body
1532 - match: |-
1533 (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=\s*(((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
1534 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
1535 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1536 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1537 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1538 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1539 (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1540 (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1541 (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1542 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
1543 captures:
1544 1: storage.modifier.ts
1545 2: storage.modifier.ts
1546 3: storage.modifier.async.ts
1547 4: storage.type.property.ts
1548 5: keyword.generator.asterisk.ts
1549 push:
1550 - meta_scope: meta.method.declaration.ts
1551 - match: '(?=\}|;|,|$)|(?<=\})'
1552 pop: true
1553 - include: method-declaration-name
1554 - include: function-body
1555 method-declaration-name:
1556 - match: |-
1557 (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
1558 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
1559 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1560 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1561 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1562 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1563 (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1564 (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1565 (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1566 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??)\s*[\(\<])
1567 push:
1568 - match: (?=\(|\<)
1569 pop: true
1570 - include: string
1571 - include: array-literal
1572 - include: numeric-literal
1573 - match: "[_$[:alpha:]][_$[:alnum:]]*"
1574 scope: meta.definition.method.ts entity.name.function.ts
1575 - match: \?
1576 scope: keyword.operator.optional.ts
1577 namespace-declaration:
1578 - match: '(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(namespace|module)\s+(?=[_$[:alpha:]"''`]))'
1579 captures:
1580 1: keyword.control.export.ts
1581 2: storage.modifier.ts
1582 3: storage.type.namespace.ts
1583 push:
1584 - meta_scope: meta.namespace.declaration.ts
1585 - match: '(?<=\})|(?=;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
1586 pop: true
1587 - include: comment
1588 - include: string
1589 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
1590 scope: entity.name.type.module.ts
1591 - include: punctuation-accessor
1592 - include: decl-block
1593 new-expr:
1594 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
1595 captures:
1596 1: keyword.operator.new.ts
1597 push:
1598 - meta_scope: new.expr.ts
1599 - match: '(?<=\))|(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
1600 pop: true
1601 - include: paren-expression
1602 - include: class-declaration
1603 - include: type
1604 null-literal:
1605 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))null(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
1606 scope: constant.language.null.ts
1607 numeric-literal:
1608 - match: '\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$)'
1609 scope: constant.numeric.hex.ts
1610 captures:
1611 1: storage.type.numeric.bigint.ts
1612 - match: '\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$)'
1613 scope: constant.numeric.binary.ts
1614 captures:
1615 1: storage.type.numeric.bigint.ts
1616 - match: '\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$)'
1617 scope: constant.numeric.octal.ts
1618 captures:
1619 1: storage.type.numeric.bigint.ts
1620 - match: |-
1621 (?x)
1622 (?<!\$)(?:
1623 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
1624 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1625 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1626 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1627 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1628 (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1629 (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1630 (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1631 )(?!\$)
1632 captures:
1633 0: constant.numeric.decimal.ts
1634 1: meta.delimiter.decimal.period.ts
1635 2: storage.type.numeric.bigint.ts
1636 3: meta.delimiter.decimal.period.ts
1637 4: storage.type.numeric.bigint.ts
1638 5: meta.delimiter.decimal.period.ts
1639 6: storage.type.numeric.bigint.ts
1640 7: storage.type.numeric.bigint.ts
1641 8: meta.delimiter.decimal.period.ts
1642 9: storage.type.numeric.bigint.ts
1643 10: meta.delimiter.decimal.period.ts
1644 11: storage.type.numeric.bigint.ts
1645 12: meta.delimiter.decimal.period.ts
1646 13: storage.type.numeric.bigint.ts
1647 14: storage.type.numeric.bigint.ts
1648 numericConstant-literal:
1649 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))NaN(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
1650 scope: constant.language.nan.ts
1651 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Infinity(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
1652 scope: constant.language.infinity.ts
1653 object-binding-element:
1654 - include: comment
1655 - match: |-
1656 (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
1657 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
1658 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1659 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1660 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1661 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1662 (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1663 (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1664 (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1665 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
1666 push:
1667 - match: '(?=,|\})'
1668 pop: true
1669 - include: object-binding-element-propertyName
1670 - include: binding-element
1671 - include: object-binding-pattern
1672 - include: destructuring-variable-rest
1673 - include: variable-initializer
1674 - include: punctuation-comma
1675 object-binding-element-const:
1676 - include: comment
1677 - match: |-
1678 (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
1679 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
1680 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1681 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1682 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1683 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1684 (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1685 (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1686 (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1687 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
1688 push:
1689 - match: '(?=,|\})'
1690 pop: true
1691 - include: object-binding-element-propertyName
1692 - include: binding-element-const
1693 - include: object-binding-pattern-const
1694 - include: destructuring-variable-rest-const
1695 - include: variable-initializer
1696 - include: punctuation-comma
1697 object-binding-element-propertyName:
1698 - match: |-
1699 (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
1700 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
1701 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1702 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1703 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1704 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1705 (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1706 (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1707 (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1708 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
1709 push:
1710 - match: (:)
1711 captures:
1712 0: punctuation.destructuring.ts
1713 pop: true
1714 - include: string
1715 - include: array-literal
1716 - include: numeric-literal
1717 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
1718 scope: variable.object.property.ts
1719 object-binding-pattern:
1720 - match: '(?:(\.\.\.)\s*)?(\{)'
1721 captures:
1722 1: keyword.operator.rest.ts
1723 2: punctuation.definition.binding-pattern.object.ts
1724 push:
1725 - match: '\}'
1726 captures:
1727 0: punctuation.definition.binding-pattern.object.ts
1728 pop: true
1729 - include: object-binding-element
1730 object-binding-pattern-const:
1731 - match: '(?:(\.\.\.)\s*)?(\{)'
1732 captures:
1733 1: keyword.operator.rest.ts
1734 2: punctuation.definition.binding-pattern.object.ts
1735 push:
1736 - match: '\}'
1737 captures:
1738 0: punctuation.definition.binding-pattern.object.ts
1739 pop: true
1740 - include: object-binding-element-const
1741 object-identifiers:
1742 - match: '([_$[:alpha:]][_$[:alnum:]]*)(?=\s*\??\.\s*prototype\b(?!\$))'
1743 scope: support.class.ts
1744 - match: |-
1745 (?x)(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(?:
1746 (\#?[[:upper:]][_$[:digit:][:upper:]]*) |
1747 (\#?[_$[:alpha:]][_$[:alnum:]]*)
1748 )(?=\s*\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*)
1749 captures:
1750 1: punctuation.accessor.ts
1751 2: punctuation.accessor.optional.ts
1752 3: variable.other.constant.object.property.ts
1753 4: variable.other.object.property.ts
1754 - match: |-
1755 (?x)(?:
1756 ([[:upper:]][_$[:digit:][:upper:]]*) |
1757 ([_$[:alpha:]][_$[:alnum:]]*)
1758 )(?=\s*\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*)
1759 captures:
1760 1: variable.other.constant.object.ts
1761 2: variable.other.object.ts
1762 object-literal:
1763 - match: '\{'
1764 captures:
1765 0: punctuation.definition.block.ts
1766 push:
1767 - meta_scope: meta.objectliteral.ts
1768 - match: '\}'
1769 captures:
1770 0: punctuation.definition.block.ts
1771 pop: true
1772 - include: object-member
1773 object-literal-method-declaration:
1774 - match: |-
1775 (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=\s*(((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
1776 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
1777 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1778 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1779 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1780 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1781 (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1782 (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1783 (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1784 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
1785 captures:
1786 1: storage.modifier.async.ts
1787 2: storage.type.property.ts
1788 3: keyword.generator.asterisk.ts
1789 push:
1790 - meta_scope: meta.method.declaration.ts
1791 - match: '(?=\}|;|,)|(?<=\})'
1792 pop: true
1793 - include: method-declaration-name
1794 - include: function-body
1795 - match: |-
1796 (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=\s*(((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
1797 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
1798 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1799 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1800 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1801 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1802 (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1803 (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1804 (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1805 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
1806 captures:
1807 1: storage.modifier.async.ts
1808 2: storage.type.property.ts
1809 3: keyword.generator.asterisk.ts
1810 push:
1811 - match: (?=\(|\<)
1812 pop: true
1813 - include: method-declaration-name
1814 object-member:
1815 - include: comment
1816 - include: object-literal-method-declaration
1817 - match: '(?=\[)'
1818 push:
1819 - meta_scope: meta.object.member.ts meta.object-literal.key.ts
1820 - match: '(?=:)|((?<=[\]])(?=\s*[\(\<]))'
1821 pop: true
1822 - include: comment
1823 - include: array-literal
1824 - match: '(?=[\''\"\`])'
1825 push:
1826 - meta_scope: meta.object.member.ts meta.object-literal.key.ts
1827 - match: '(?=:)|((?<=[\''\"\`])(?=((\s*[\(\<,}])|(\s+(as)\s+))))'
1828 pop: true
1829 - include: comment
1830 - include: string
1831 - match: |-
1832 (?x)(?=(\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
1833 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
1834 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1835 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1836 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1837 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1838 (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1839 (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1840 (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1841 )(?!\$)))
1842 push:
1843 - meta_scope: meta.object.member.ts meta.object-literal.key.ts
1844 - match: '(?=:)|(?=\s*([\(\<,}])|(\s+as\s+))'
1845 pop: true
1846 - include: comment
1847 - include: numeric-literal
1848 - match: '(?<=[\]\''\"\`])(?=\s*[\(\<])'
1849 push:
1850 - meta_scope: meta.method.declaration.ts
1851 - match: '(?=\}|;|,)|(?<=\})'
1852 pop: true
1853 - include: function-body
1854 - match: '(?![_$[:alpha:]])([[:digit:]]+)\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*:)'
1855 scope: meta.object.member.ts
1856 captures:
1857 0: meta.object-literal.key.ts
1858 1: constant.numeric.decimal.ts
1859 - match: |-
1860 (?x)(?:([_$[:alpha:]][_$[:alnum:]]*)\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*:(\s*\/\*([^\*]|(\*[^\/]))*\*\/)*\s*(
1861 ((async\s+)?(
1862 (function\s*[(<*]) |
1863 (function\s+) |
1864 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
1865 )) |
1866 ((async\s*)?(
1867 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
1868 # sure shot arrow functions even if => is on new line
1870 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
1871 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
1873 ([)]\s*:) | # ():
1874 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
1876 ) |
1878 # arrow function possible to detect only with => on same line
1880 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
1881 \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
1882 (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
1883 \s*=> # arrow operator
1885 ))
1886 )))
1887 scope: meta.object.member.ts
1888 captures:
1889 0: meta.object-literal.key.ts
1890 1: entity.name.function.ts
1891 - match: '(?:[_$[:alpha:]][_$[:alnum:]]*)\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*:)'
1892 scope: meta.object.member.ts
1893 captures:
1894 0: meta.object-literal.key.ts
1895 - match: \.\.\.
1896 captures:
1897 0: keyword.operator.spread.ts
1898 push:
1899 - meta_scope: meta.object.member.ts
1900 - match: '(?=,|\})'
1901 pop: true
1902 - include: expression
1903 - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?=,|\}|$|\/\/|\/\*)'
1904 scope: meta.object.member.ts
1905 captures:
1906 1: variable.other.readwrite.ts
1907 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+(const)(?=\s*([,}]|$))'
1908 scope: meta.object.member.ts
1909 captures:
1910 1: keyword.control.as.ts
1911 2: storage.modifier.ts
1912 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+'
1913 captures:
1914 1: keyword.control.as.ts
1915 push:
1916 - meta_scope: meta.object.member.ts
1917 - match: '(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|^|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+))'
1918 pop: true
1919 - include: type
1920 - match: '(?=[_$[:alpha:]][_$[:alnum:]]*\s*=)'
1921 push:
1922 - meta_scope: meta.object.member.ts
1923 - match: '(?=,|\}|$|\/\/|\/\*)'
1924 pop: true
1925 - include: expression
1926 - match: ":"
1927 captures:
1928 0: meta.object-literal.key.ts punctuation.separator.key-value.ts
1929 push:
1930 - meta_scope: meta.object.member.ts
1931 - match: '(?=,|\})'
1932 pop: true
1933 - match: '(?<=:)\s*(async)?(?=\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
1934 captures:
1935 1: storage.modifier.async.ts
1936 push:
1937 - match: (?<=\))
1938 pop: true
1939 - include: type-parameters
1940 - match: \(
1941 captures:
1942 0: meta.brace.round.ts
1943 push:
1944 - match: \)
1945 captures:
1946 0: meta.brace.round.ts
1947 pop: true
1948 - include: expression-inside-possibly-arrow-parens
1949 - match: '(?<=:)\s*(async)?\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
1950 captures:
1951 1: storage.modifier.async.ts
1952 2: meta.brace.round.ts
1953 push:
1954 - match: \)
1955 captures:
1956 0: meta.brace.round.ts
1957 pop: true
1958 - include: expression-inside-possibly-arrow-parens
1959 - match: (?<=:)\s*(async)?\s*(?=\<\s*$)
1960 captures:
1961 1: storage.modifier.async.ts
1962 push:
1963 - match: (?<=\>)
1964 pop: true
1965 - include: type-parameters
1966 - match: '(?<=\>)\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
1967 captures:
1968 1: meta.brace.round.ts
1969 push:
1970 - match: \)
1971 captures:
1972 0: meta.brace.round.ts
1973 pop: true
1974 - include: expression-inside-possibly-arrow-parens
1975 - include: possibly-arrow-return-type
1976 - include: expression
1977 - include: punctuation-comma
1978 parameter-array-binding-pattern:
1979 - match: '(?:(\.\.\.)\s*)?(\[)'
1980 captures:
1981 1: keyword.operator.rest.ts
1982 2: punctuation.definition.binding-pattern.array.ts
1983 push:
1984 - match: '\]'
1985 captures:
1986 0: punctuation.definition.binding-pattern.array.ts
1987 pop: true
1988 - include: parameter-binding-element
1989 - include: punctuation-comma
1990 parameter-binding-element:
1991 - include: comment
1992 - include: string
1993 - include: numeric-literal
1994 - include: regex
1995 - include: parameter-object-binding-pattern
1996 - include: parameter-array-binding-pattern
1997 - include: destructuring-parameter-rest
1998 - include: variable-initializer
1999 parameter-name:
2000 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|protected|private|readonly)\s+(?=(public|protected|private|readonly)\s+)'
2001 captures:
2002 1: storage.modifier.ts
2003 - match: |-
2004 (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*
2005 # function assignment |
2006 (=\s*(
2007 ((async\s+)?(
2008 (function\s*[(<*]) |
2009 (function\s+) |
2010 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
2011 )) |
2012 ((async\s*)?(
2013 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
2014 # sure shot arrow functions even if => is on new line
2016 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
2017 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
2019 ([)]\s*:) | # ():
2020 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
2022 ) |
2024 # arrow function possible to detect only with => on same line
2026 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
2027 \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
2028 (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
2029 \s*=> # arrow operator
2031 ))
2032 )) |
2033 # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
2034 (:\s*(
2035 (<) |
2036 ([(]\s*(
2037 ([)]) |
2038 (\.\.\.) |
2039 ([_$[:alnum:]]+\s*(
2040 ([:,?=])|
2041 ([)]\s*=>)
2042 ))
2043 ))
2044 )) |
2045 (:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
2046 (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
2047 (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
2048 ((async\s+)?(
2049 (function\s*[(<*]) |
2050 (function\s+) |
2051 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
2052 )) |
2053 ((async\s*)?(
2054 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
2055 # sure shot arrow functions even if => is on new line
2057 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
2058 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
2060 ([)]\s*:) | # ():
2061 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
2063 ) |
2065 # arrow function possible to detect only with => on same line
2067 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
2068 \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
2069 (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
2070 \s*=> # arrow operator
2072 ))
2073 )))
2074 captures:
2075 1: storage.modifier.ts
2076 2: keyword.operator.rest.ts
2077 3: entity.name.function.ts variable.language.this.ts
2078 4: entity.name.function.ts
2079 5: keyword.operator.optional.ts
2080 - match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)'
2081 captures:
2082 1: storage.modifier.ts
2083 2: keyword.operator.rest.ts
2084 3: variable.parameter.ts variable.language.this.ts
2085 4: variable.parameter.ts
2086 5: keyword.operator.optional.ts
2087 parameter-object-binding-element:
2088 - include: comment
2089 - match: |-
2090 (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
2091 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
2092 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
2093 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
2094 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
2095 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
2096 (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
2097 (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
2098 (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
2099 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
2100 push:
2101 - match: '(?=,|\})'
2102 pop: true
2103 - include: object-binding-element-propertyName
2104 - include: parameter-binding-element
2105 - include: parameter-object-binding-pattern
2106 - include: destructuring-parameter-rest
2107 - include: variable-initializer
2108 - include: punctuation-comma
2109 parameter-object-binding-pattern:
2110 - match: '(?:(\.\.\.)\s*)?(\{)'
2111 captures:
2112 1: keyword.operator.rest.ts
2113 2: punctuation.definition.binding-pattern.object.ts
2114 push:
2115 - match: '\}'
2116 captures:
2117 0: punctuation.definition.binding-pattern.object.ts
2118 pop: true
2119 - include: parameter-object-binding-element
2120 parameter-type-annotation:
2121 - match: (:)
2122 captures:
2123 1: keyword.operator.type.annotation.ts
2124 push:
2125 - meta_scope: meta.type.annotation.ts
2126 - match: "(?=[,)])|(?==[^>])"
2127 pop: true
2128 - include: type
2129 paren-expression:
2130 - match: \(
2131 captures:
2132 0: meta.brace.round.ts
2133 push:
2134 - match: \)
2135 captures:
2136 0: meta.brace.round.ts
2137 pop: true
2138 - include: expression
2139 paren-expression-possibly-arrow:
2140 - match: '(?<=[(=,])\s*(async)?(?=\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
2141 captures:
2142 1: storage.modifier.async.ts
2143 push:
2144 - match: (?<=\))
2145 pop: true
2146 - include: paren-expression-possibly-arrow-with-typeparameters
2147 - match: '(?<=[(=,]|=>|^return|[^\._$[:alnum:]]return)\s*(async)?(?=\s*((((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\()|(<))\s*$)'
2148 captures:
2149 1: storage.modifier.async.ts
2150 push:
2151 - match: (?<=\))
2152 pop: true
2153 - include: paren-expression-possibly-arrow-with-typeparameters
2154 - include: possibly-arrow-return-type
2155 paren-expression-possibly-arrow-with-typeparameters:
2156 - include: type-parameters
2157 - match: \(
2158 captures:
2159 0: meta.brace.round.ts
2160 push:
2161 - match: \)
2162 captures:
2163 0: meta.brace.round.ts
2164 pop: true
2165 - include: expression-inside-possibly-arrow-parens
2166 possibly-arrow-return-type:
2167 - match: '(?<=\)|^)\s*(:)(?=\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*=>)'
2168 captures:
2169 1: meta.arrow.ts meta.return.type.arrow.ts keyword.operator.type.annotation.ts
2170 push:
2171 - meta_content_scope: meta.arrow.ts meta.return.type.arrow.ts
2172 - match: '(?==>|\{|(^\s*(export|function|class|interface|let|var|const|import|enum|namespace|module|type|abstract|declare)\s+))'
2173 pop: true
2174 - include: arrow-return-type-body
2175 property-accessor:
2176 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(get|set)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2177 scope: storage.type.property.ts
2178 punctuation-accessor:
2179 - match: '(?:(\.)|(\?\.(?!\s*[[:digit:]])))'
2180 captures:
2181 1: punctuation.accessor.ts
2182 2: punctuation.accessor.optional.ts
2183 punctuation-comma:
2184 - match: ","
2185 scope: punctuation.separator.comma.ts
2186 punctuation-semicolon:
2187 - match: ;
2188 scope: punctuation.terminator.statement.ts
2189 qstring-double:
2190 - match: '"'
2191 captures:
2192 0: punctuation.definition.string.begin.ts
2193 push:
2194 - meta_scope: string.quoted.double.ts
2195 - match: '(")|((?:[^\\\n])$)'
2196 captures:
2197 1: punctuation.definition.string.end.ts
2198 2: invalid.illegal.newline.ts
2199 pop: true
2200 - include: string-character-escape
2201 qstring-single:
2202 - match: "'"
2203 captures:
2204 0: punctuation.definition.string.begin.ts
2205 push:
2206 - meta_scope: string.quoted.single.ts
2207 - match: '(\'')|((?:[^\\\n])$)'
2208 captures:
2209 1: punctuation.definition.string.end.ts
2210 2: invalid.illegal.newline.ts
2211 pop: true
2212 - include: string-character-escape
2213 regex:
2214 - match: '(?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/([gimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
2215 captures:
2216 1: punctuation.definition.string.begin.ts
2217 push:
2218 - meta_scope: string.regexp.ts
2219 - match: "(/)([gimsuy]*)"
2220 captures:
2221 1: punctuation.definition.string.end.ts
2222 2: keyword.other.ts
2223 pop: true
2224 - include: regexp
2225 - match: '((?<![_$[:alnum:])\]]|\+\+|--|}|\*\/)|((?<=^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case))\s*)\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/([gimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
2226 captures:
2227 0: punctuation.definition.string.begin.ts
2228 push:
2229 - meta_scope: string.regexp.ts
2230 - match: "(/)([gimsuy]*)"
2231 captures:
2232 1: punctuation.definition.string.end.ts
2233 2: keyword.other.ts
2234 pop: true
2235 - include: regexp
2236 regex-character-class:
2237 - match: '\\[wWsSdDtrnvf]|\.'
2238 scope: constant.other.character-class.regexp
2239 - match: '\\([0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4})'
2240 scope: constant.character.numeric.regexp
2241 - match: '\\c[A-Z]'
2242 scope: constant.character.control.regexp
2243 - match: \\.
2244 scope: constant.character.escape.backslash.regexp
2245 regexp:
2246 - match: '\\[bB]|\^|\$'
2247 scope: keyword.control.anchor.regexp
2248 - match: '\\[1-9]\d*|\\k<([a-zA-Z_$][\w$]*)>'
2249 captures:
2250 0: keyword.other.back-reference.regexp
2251 1: variable.other.regexp
2252 - match: '[?+*]|\{(\d+,\d+|\d+,|,\d+|\d+)\}\??'
2253 scope: keyword.operator.quantifier.regexp
2254 - match: \|
2255 scope: keyword.operator.or.regexp
2256 - match: (\()((\?=)|(\?!)|(\?<=)|(\?<!))
2257 captures:
2258 1: punctuation.definition.group.regexp
2259 2: punctuation.definition.group.assertion.regexp
2260 3: meta.assertion.look-ahead.regexp
2261 4: meta.assertion.negative-look-ahead.regexp
2262 5: meta.assertion.look-behind.regexp
2263 6: meta.assertion.negative-look-behind.regexp
2264 push:
2265 - meta_scope: meta.group.assertion.regexp
2266 - match: (\))
2267 captures:
2268 1: punctuation.definition.group.regexp
2269 pop: true
2270 - include: regexp
2271 - match: '\((?:(\?:)|(?:\?<([a-zA-Z_$][\w$]*)>))?'
2272 captures:
2273 0: punctuation.definition.group.regexp
2274 1: punctuation.definition.group.no-capture.regexp
2275 2: variable.other.regexp
2276 push:
2277 - meta_scope: meta.group.regexp
2278 - match: \)
2279 captures:
2280 0: punctuation.definition.group.regexp
2281 pop: true
2282 - include: regexp
2283 - match: '(\[)(\^)?'
2284 captures:
2285 1: punctuation.definition.character-class.regexp
2286 2: keyword.operator.negation.regexp
2287 push:
2288 - meta_scope: constant.other.character-class.set.regexp
2289 - match: '(\])'
2290 captures:
2291 1: punctuation.definition.character-class.regexp
2292 pop: true
2293 - match: '(?:.|(\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\c[A-Z])|(\\.))\-(?:[^\]\\]|(\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\c[A-Z])|(\\.))'
2294 scope: constant.other.character-class.range.regexp
2295 captures:
2296 1: constant.character.numeric.regexp
2297 2: constant.character.control.regexp
2298 3: constant.character.escape.backslash.regexp
2299 4: constant.character.numeric.regexp
2300 5: constant.character.control.regexp
2301 6: constant.character.escape.backslash.regexp
2302 - include: regex-character-class
2303 - include: regex-character-class
2304 return-type:
2305 - match: (?<=\))\s*(:)(?=\s*\S)
2306 captures:
2307 1: keyword.operator.type.annotation.ts
2308 push:
2309 - meta_scope: meta.return.type.ts
2310 - match: "(?<![:|&])(?=$|^|[{};,]|//)"
2311 pop: true
2312 - include: return-type-core
2313 - match: (?<=\))\s*(:)
2314 captures:
2315 1: keyword.operator.type.annotation.ts
2316 push:
2317 - meta_scope: meta.return.type.ts
2318 - match: '(?<![:|&])((?=[{};,]|//|^\s*$)|((?<=\S)(?=\s*$)))'
2319 pop: true
2320 - include: return-type-core
2321 return-type-core:
2322 - include: comment
2323 - match: '(?<=[:|&])(?=\s*\{)'
2324 push:
2325 - match: '(?<=\})'
2326 pop: true
2327 - include: type-object
2328 - include: type-predicate-operator
2329 - include: type
2330 shebang:
2331 - match: \A(#!).*(?=$)
2332 scope: comment.line.shebang.ts
2333 captures:
2334 1: punctuation.definition.comment.ts
2335 single-line-comment-consuming-line-ending:
2336 - match: '(^[ \t]+)?((//)(?:\s*((@)internal)(?=\s|$))?)'
2337 captures:
2338 1: punctuation.whitespace.comment.leading.ts
2339 2: comment.line.double-slash.ts
2340 3: punctuation.definition.comment.ts
2341 4: storage.type.internaldeclaration.ts
2342 5: punctuation.decorator.internaldeclaration.ts
2343 push:
2344 - meta_content_scope: comment.line.double-slash.ts
2345 - match: (?=^)
2346 pop: true
2347 statements:
2348 - include: declaration
2349 - include: control-statement
2350 - include: after-operator-block-as-object-literal
2351 - include: decl-block
2352 - include: label
2353 - include: expression
2354 - include: punctuation-semicolon
2355 - include: string
2356 - include: comment
2357 string:
2358 - include: qstring-single
2359 - include: qstring-double
2360 - include: template
2361 string-character-escape:
2362 - match: '\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\{[0-9A-Fa-f]+\}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$)'
2363 scope: constant.character.escape.ts
2364 super-literal:
2365 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))super\b(?!\$)'
2366 scope: variable.language.super.ts
2367 support-function-call-identifiers:
2368 - include: literal
2369 - include: support-objects
2370 - include: object-identifiers
2371 - include: punctuation-accessor
2372 - match: '(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))import(?=\s*[\(]\s*[\"\''\`]))'
2373 scope: keyword.operator.expression.import.ts
2374 support-objects:
2375 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(arguments)\b(?!\$)'
2376 scope: variable.language.arguments.ts
2377 - match: |-
2378 (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Array|ArrayBuffer|Atomics|BigInt|BigInt64Array|BigUint64Array|Boolean|DataView|Date|Float32Array
2379 |Float64Array|Function|Generator|GeneratorFunction|Int8Array|Int16Array|Int32Array|Intl|Map|Number|Object|Proxy
2380 |Reflect|RegExp|Set|SharedArrayBuffer|SIMD|String|Symbol|TypedArray
2381 |Uint8Array|Uint16Array|Uint32Array|Uint8ClampedArray|WeakMap|WeakSet)\b(?!\$)
2382 scope: support.class.builtin.ts
2383 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))((Eval|Internal|Range|Reference|Syntax|Type|URI)?Error)\b(?!\$)'
2384 scope: support.class.error.ts
2385 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Promise)\b(?!\$)'
2386 scope: support.class.promise.ts
2387 - match: |-
2388 (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(clear(Interval|Timeout)|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|escape|eval|
2389 isFinite|isNaN|parseFloat|parseInt|require|set(Interval|Timeout)|super|unescape|uneval)(?=\s*\()
2390 scope: support.function.ts
2391 - match: |-
2392 (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Math)(?:\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(?:
2393 (abs|acos|acosh|asin|asinh|atan|atan2|atanh|cbrt|ceil|clz32|cos|cosh|exp|
2394 expm1|floor|fround|hypot|imul|log|log10|log1p|log2|max|min|pow|random|
2395 round|sign|sin|sinh|sqrt|tan|tanh|trunc)
2397 (E|LN10|LN2|LOG10E|LOG2E|PI|SQRT1_2|SQRT2)))?\b(?!\$)
2398 captures:
2399 1: support.constant.math.ts
2400 2: punctuation.accessor.ts
2401 3: punctuation.accessor.optional.ts
2402 4: support.function.math.ts
2403 5: support.constant.property.math.ts
2404 - match: |-
2405 (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(console)(?:\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(
2406 assert|clear|count|debug|dir|error|group|groupCollapsed|groupEnd|info|log
2407 |profile|profileEnd|table|time|timeEnd|timeStamp|trace|warn))?\b(?!\$)
2408 captures:
2409 1: support.class.console.ts
2410 2: punctuation.accessor.ts
2411 3: punctuation.accessor.optional.ts
2412 4: support.function.console.ts
2413 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(JSON)(?:\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(parse|stringify))?\b(?!\$)'
2414 captures:
2415 1: support.constant.json.ts
2416 2: punctuation.accessor.ts
2417 3: punctuation.accessor.optional.ts
2418 4: support.function.json.ts
2419 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(import)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(meta)\b(?!\$)'
2420 captures:
2421 1: keyword.control.import.ts
2422 2: punctuation.accessor.ts
2423 3: punctuation.accessor.optional.ts
2424 4: support.variable.property.importmeta.ts
2425 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(target)\b(?!\$)'
2426 captures:
2427 1: keyword.operator.new.ts
2428 2: punctuation.accessor.ts
2429 3: punctuation.accessor.optional.ts
2430 4: support.variable.property.target.ts
2431 - match: |-
2432 (?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* (?:
2433 (?:(constructor|length|prototype|__proto__)\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\())
2435 (?:(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)\b(?!\$)))
2436 captures:
2437 1: punctuation.accessor.ts
2438 2: punctuation.accessor.optional.ts
2439 3: support.variable.property.ts
2440 4: support.constant.ts
2441 - match: |-
2442 (?x) (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.)) \b (?:
2443 (document|event|navigator|performance|screen|window)
2445 (AnalyserNode|ArrayBufferView|Attr|AudioBuffer|AudioBufferSourceNode|AudioContext|AudioDestinationNode|AudioListener
2446 |AudioNode|AudioParam|BatteryManager|BeforeUnloadEvent|BiquadFilterNode|Blob|BufferSource|ByteString|CSS|CSSConditionRule
2447 |CSSCounterStyleRule|CSSGroupingRule|CSSMatrix|CSSMediaRule|CSSPageRule|CSSPrimitiveValue|CSSRule|CSSRuleList|CSSStyleDeclaration
2448 |CSSStyleRule|CSSStyleSheet|CSSSupportsRule|CSSValue|CSSValueList|CanvasGradient|CanvasImageSource|CanvasPattern
2449 |CanvasRenderingContext2D|ChannelMergerNode|ChannelSplitterNode|CharacterData|ChromeWorker|CloseEvent|Comment|CompositionEvent
2450 |Console|ConvolverNode|Coordinates|Credential|CredentialsContainer|Crypto|CryptoKey|CustomEvent|DOMError|DOMException
2451 |DOMHighResTimeStamp|DOMImplementation|DOMString|DOMStringList|DOMStringMap|DOMTimeStamp|DOMTokenList|DataTransfer
2452 |DataTransferItem|DataTransferItemList|DedicatedWorkerGlobalScope|DelayNode|DeviceProximityEvent|DirectoryEntry
2453 |DirectoryEntrySync|DirectoryReader|DirectoryReaderSync|Document|DocumentFragment|DocumentTouch|DocumentType|DragEvent
2454 |DynamicsCompressorNode|Element|Entry|EntrySync|ErrorEvent|Event|EventListener|EventSource|EventTarget|FederatedCredential
2455 |FetchEvent|File|FileEntry|FileEntrySync|FileException|FileList|FileReader|FileReaderSync|FileSystem|FileSystemSync
2456 |FontFace|FormData|GainNode|Gamepad|GamepadButton|GamepadEvent|Geolocation|GlobalEventHandlers|HTMLAnchorElement
2457 |HTMLAreaElement|HTMLAudioElement|HTMLBRElement|HTMLBaseElement|HTMLBodyElement|HTMLButtonElement|HTMLCanvasElement
2458 |HTMLCollection|HTMLContentElement|HTMLDListElement|HTMLDataElement|HTMLDataListElement|HTMLDialogElement|HTMLDivElement
2459 |HTMLDocument|HTMLElement|HTMLEmbedElement|HTMLFieldSetElement|HTMLFontElement|HTMLFormControlsCollection|HTMLFormElement
2460 |HTMLHRElement|HTMLHeadElement|HTMLHeadingElement|HTMLHtmlElement|HTMLIFrameElement|HTMLImageElement|HTMLInputElement
2461 |HTMLKeygenElement|HTMLLIElement|HTMLLabelElement|HTMLLegendElement|HTMLLinkElement|HTMLMapElement|HTMLMediaElement
2462 |HTMLMetaElement|HTMLMeterElement|HTMLModElement|HTMLOListElement|HTMLObjectElement|HTMLOptGroupElement|HTMLOptionElement
2463 |HTMLOptionsCollection|HTMLOutputElement|HTMLParagraphElement|HTMLParamElement|HTMLPreElement|HTMLProgressElement
2464 |HTMLQuoteElement|HTMLScriptElement|HTMLSelectElement|HTMLShadowElement|HTMLSourceElement|HTMLSpanElement|HTMLStyleElement
2465 |HTMLTableCaptionElement|HTMLTableCellElement|HTMLTableColElement|HTMLTableDataCellElement|HTMLTableElement|HTMLTableHeaderCellElement
2466 |HTMLTableRowElement|HTMLTableSectionElement|HTMLTextAreaElement|HTMLTimeElement|HTMLTitleElement|HTMLTrackElement
2467 |HTMLUListElement|HTMLUnknownElement|HTMLVideoElement|HashChangeEvent|History|IDBCursor|IDBCursorWithValue|IDBDatabase
2468 |IDBEnvironment|IDBFactory|IDBIndex|IDBKeyRange|IDBMutableFile|IDBObjectStore|IDBOpenDBRequest|IDBRequest|IDBTransaction
2469 |IDBVersionChangeEvent|IIRFilterNode|IdentityManager|ImageBitmap|ImageBitmapFactories|ImageData|Index|InputDeviceCapabilities
2470 |InputEvent|InstallEvent|InstallTrigger|KeyboardEvent|LinkStyle|LocalFileSystem|LocalFileSystemSync|Location|MIDIAccess
2471 |MIDIConnectionEvent|MIDIInput|MIDIInputMap|MIDIOutputMap|MediaElementAudioSourceNode|MediaError|MediaKeyMessageEvent
2472 |MediaKeySession|MediaKeyStatusMap|MediaKeySystemAccess|MediaKeySystemConfiguration|MediaKeys|MediaRecorder|MediaStream
2473 |MediaStreamAudioDestinationNode|MediaStreamAudioSourceNode|MessageChannel|MessageEvent|MessagePort|MouseEvent
2474 |MutationObserver|MutationRecord|NamedNodeMap|Navigator|NavigatorConcurrentHardware|NavigatorGeolocation|NavigatorID
2475 |NavigatorLanguage|NavigatorOnLine|Node|NodeFilter|NodeIterator|NodeList|NonDocumentTypeChildNode|Notification
2476 |OfflineAudioCompletionEvent|OfflineAudioContext|OscillatorNode|PageTransitionEvent|PannerNode|ParentNode|PasswordCredential
2477 |Path2D|PaymentAddress|PaymentRequest|PaymentResponse|Performance|PerformanceEntry|PerformanceFrameTiming|PerformanceMark
2478 |PerformanceMeasure|PerformanceNavigation|PerformanceNavigationTiming|PerformanceObserver|PerformanceObserverEntryList
2479 |PerformanceResourceTiming|PerformanceTiming|PeriodicSyncEvent|PeriodicWave|Plugin|Point|PointerEvent|PopStateEvent
2480 |PortCollection|Position|PositionError|PositionOptions|PresentationConnectionClosedEvent|PresentationConnectionList
2481 |PresentationReceiver|ProcessingInstruction|ProgressEvent|PromiseRejectionEvent|PushEvent|PushRegistrationManager
2482 |RTCCertificate|RTCConfiguration|RTCPeerConnection|RTCSessionDescriptionCallback|RTCStatsReport|RadioNodeList|RandomSource
2483 |Range|ReadableByteStream|RenderingContext|SVGAElement|SVGAngle|SVGAnimateColorElement|SVGAnimateElement|SVGAnimateMotionElement
2484 |SVGAnimateTransformElement|SVGAnimatedAngle|SVGAnimatedBoolean|SVGAnimatedEnumeration|SVGAnimatedInteger|SVGAnimatedLength
2485 |SVGAnimatedLengthList|SVGAnimatedNumber|SVGAnimatedNumberList|SVGAnimatedPoints|SVGAnimatedPreserveAspectRatio
2486 |SVGAnimatedRect|SVGAnimatedString|SVGAnimatedTransformList|SVGAnimationElement|SVGCircleElement|SVGClipPathElement
2487 |SVGCursorElement|SVGDefsElement|SVGDescElement|SVGElement|SVGEllipseElement|SVGEvent|SVGFilterElement|SVGFontElement
2488 |SVGFontFaceElement|SVGFontFaceFormatElement|SVGFontFaceNameElement|SVGFontFaceSrcElement|SVGFontFaceUriElement
2489 |SVGForeignObjectElement|SVGGElement|SVGGlyphElement|SVGGradientElement|SVGHKernElement|SVGImageElement|SVGLength
2490 |SVGLengthList|SVGLineElement|SVGLinearGradientElement|SVGMPathElement|SVGMaskElement|SVGMatrix|SVGMissingGlyphElement
2491 |SVGNumber|SVGNumberList|SVGPathElement|SVGPatternElement|SVGPoint|SVGPolygonElement|SVGPolylineElement|SVGPreserveAspectRatio
2492 |SVGRadialGradientElement|SVGRect|SVGRectElement|SVGSVGElement|SVGScriptElement|SVGSetElement|SVGStopElement|SVGStringList
2493 |SVGStylable|SVGStyleElement|SVGSwitchElement|SVGSymbolElement|SVGTRefElement|SVGTSpanElement|SVGTests|SVGTextElement
2494 |SVGTextPositioningElement|SVGTitleElement|SVGTransform|SVGTransformList|SVGTransformable|SVGUseElement|SVGVKernElement
2495 |SVGViewElement|ServiceWorker|ServiceWorkerContainer|ServiceWorkerGlobalScope|ServiceWorkerRegistration|ServiceWorkerState
2496 |ShadowRoot|SharedWorker|SharedWorkerGlobalScope|SourceBufferList|StereoPannerNode|Storage|StorageEvent|StyleSheet
2497 |StyleSheetList|SubtleCrypto|SyncEvent|Text|TextMetrics|TimeEvent|TimeRanges|Touch|TouchEvent|TouchList|Transferable
2498 |TreeWalker|UIEvent|USVString|VRDisplayCapabilities|ValidityState|WaveShaperNode|WebGL|WebGLActiveInfo|WebGLBuffer
2499 |WebGLContextEvent|WebGLFramebuffer|WebGLProgram|WebGLRenderbuffer|WebGLRenderingContext|WebGLShader|WebGLShaderPrecisionFormat
2500 |WebGLTexture|WebGLTimerQueryEXT|WebGLTransformFeedback|WebGLUniformLocation|WebGLVertexArrayObject|WebGLVertexArrayObjectOES
2501 |WebSocket|WebSockets|WebVTT|WheelEvent|Window|WindowBase64|WindowEventHandlers|WindowTimers|Worker|WorkerGlobalScope
2502 |WorkerLocation|WorkerNavigator|XMLHttpRequest|XMLHttpRequestEventTarget|XMLSerializer|XPathExpression|XPathResult
2503 |XSLTProcessor))\b(?!\$)
2504 captures:
2505 1: support.variable.dom.ts
2506 2: support.class.dom.ts
2507 - match: |-
2508 (?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* (?:
2509 (ATTRIBUTE_NODE|CDATA_SECTION_NODE|COMMENT_NODE|DOCUMENT_FRAGMENT_NODE|DOCUMENT_NODE|DOCUMENT_TYPE_NODE
2510 |DOMSTRING_SIZE_ERR|ELEMENT_NODE|ENTITY_NODE|ENTITY_REFERENCE_NODE|HIERARCHY_REQUEST_ERR|INDEX_SIZE_ERR
2511 |INUSE_ATTRIBUTE_ERR|INVALID_CHARACTER_ERR|NO_DATA_ALLOWED_ERR|NO_MODIFICATION_ALLOWED_ERR|NOT_FOUND_ERR
2512 |NOT_SUPPORTED_ERR|NOTATION_NODE|PROCESSING_INSTRUCTION_NODE|TEXT_NODE|WRONG_DOCUMENT_ERR)
2514 (_content|[xyz]|abbr|above|accept|acceptCharset|accessKey|action|align|[av]Link(?:color)?|all|alt|anchors|appCodeName
2515 |appCore|applets|appMinorVersion|appName|appVersion|archive|areas|arguments|attributes|availHeight|availLeft|availTop
2516 |availWidth|axis|background|backgroundColor|backgroundImage|below|bgColor|body|border|borderBottomWidth|borderColor
2517 |borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|borderWidth|bottom|bufferDepth|callee|caller|caption
2518 |cellPadding|cells|cellSpacing|ch|characterSet|charset|checked|childNodes|chOff|cite|classes|className|clear
2519 |clientInformation|clip|clipBoardData|closed|code|codeBase|codeType|color|colorDepth|cols|colSpan|compact|complete
2520 |components|content|controllers|cookie|cookieEnabled|cords|cpuClass|crypto|current|data|dateTime|declare|defaultCharset
2521 |defaultChecked|defaultSelected|defaultStatus|defaultValue|defaultView|defer|description|dialogArguments|dialogHeight
2522 |dialogLeft|dialogTop|dialogWidth|dir|directories|disabled|display|docmain|doctype|documentElement|elements|embeds
2523 |enabledPlugin|encoding|enctype|entities|event|expando|external|face|fgColor|filename|firstChild|fontFamily|fontSize
2524 |fontWeight|form|formName|forms|frame|frameBorder|frameElement|frames|hasFocus|hash|headers|height|history|host
2525 |hostname|href|hreflang|hspace|htmlFor|httpEquiv|id|ids|ignoreCase|images|implementation|index|innerHeight|innerWidth
2526 |input|isMap|label|lang|language|lastChild|lastIndex|lastMatch|lastModified|lastParen|layer[sXY]|left|leftContext
2527 |lineHeight|link|linkColor|links|listStyleType|localName|location|locationbar|longDesc|lowsrc|lowSrc|marginBottom
2528 |marginHeight|marginLeft|marginRight|marginTop|marginWidth|maxLength|media|menubar|method|mimeTypes|multiline|multiple
2529 |name|nameProp|namespaces|namespaceURI|next|nextSibling|nodeName|nodeType|nodeValue|noHref|noResize|noShade|notationName
2530 |notations|noWrap|object|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|options|oscpu|outerHeight
2531 |outerWidth|ownerDocument|paddingBottom|paddingLeft|paddingRight|paddingTop|page[XY]|page[XY]Offset|parent|parentLayer
2532 |parentNode|parentWindow|pathname|personalbar|pixelDepth|pkcs11|platform|plugins|port|prefix|previous|previousDibling
2533 |product|productSub|profile|profileend|prompt|prompter|protocol|publicId|readOnly|readyState|referrer|rel|responseText
2534 |responseXML|rev|right|rightContext|rowIndex|rows|rowSpan|rules|scheme|scope|screen[XY]|screenLeft|screenTop|scripts
2535 |scrollbars|scrolling|sectionRowIndex|security|securityPolicy|selected|selectedIndex|selection|self|shape|siblingAbove
2536 |siblingBelow|size|source|specified|standby|start|status|statusbar|statusText|style|styleSheets|suffixes|summary
2537 |systemId|systemLanguage|tagName|tags|target|tBodies|text|textAlign|textDecoration|textIndent|textTransform|tFoot|tHead
2538 |title|toolbar|top|type|undefined|uniqueID|updateInterval|URL|URLUnencoded|useMap|userAgent|userLanguage|userProfile
2539 |vAlign|value|valueType|vendor|vendorSub|version|visibility|vspace|whiteSpace|width|X[MS]LDocument|zIndex))\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\()
2540 captures:
2541 1: punctuation.accessor.ts
2542 2: punctuation.accessor.optional.ts
2543 3: support.constant.dom.ts
2544 4: support.variable.property.dom.ts
2545 - match: |-
2546 (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Buffer|EventEmitter|Server|Pipe|Socket|REPLServer|ReadStream|WriteStream|Stream
2547 |Inflate|Deflate|InflateRaw|DeflateRaw|GZip|GUnzip|Unzip|Zip)\b(?!\$)
2548 scope: support.class.node.ts
2549 - match: |-
2550 (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(process)(?:(?:(\.)|(\?\.(?!\s*[[:digit:]])))(?:
2551 (arch|argv|config|connected|env|execArgv|execPath|exitCode|mainModule|pid|platform|release|stderr|stdin|stdout|title|version|versions)
2553 (abort|chdir|cwd|disconnect|exit|[sg]ete?[gu]id|send|[sg]etgroups|initgroups|kill|memoryUsage|nextTick|umask|uptime|hrtime)
2554 ))?\b(?!\$)
2555 captures:
2556 1: support.variable.object.process.ts
2557 2: punctuation.accessor.ts
2558 3: punctuation.accessor.optional.ts
2559 4: support.variable.property.process.ts
2560 5: support.function.process.ts
2561 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(exports)|(module)(?:(?:(\.)|(\?\.(?!\s*[[:digit:]])))(exports|id|filename|loaded|parent|children))?)\b(?!\$)'
2562 captures:
2563 1: support.type.object.module.ts
2564 2: support.type.object.module.ts
2565 3: punctuation.accessor.ts
2566 4: punctuation.accessor.optional.ts
2567 5: support.type.object.module.ts
2568 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(global|GLOBAL|root|__dirname|__filename)\b(?!\$)'
2569 scope: support.variable.object.node.ts
2570 - match: |-
2571 (?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s*
2572 (?:
2573 (on(?:Rowsinserted|Rowsdelete|Rowenter|Rowexit|Resize|Resizestart|Resizeend|Reset|
2574 Readystatechange|Mouseout|Mouseover|Mousedown|Mouseup|Mousemove|
2575 Before(?:cut|deactivate|unload|update|paste|print|editfocus|activate)|
2576 Blur|Scrolltop|Submit|Select|Selectstart|Selectionchange|Hover|Help|
2577 Change|Contextmenu|Controlselect|Cut|Cellchange|Clock|Close|Deactivate|
2578 Datasetchanged|Datasetcomplete|Dataavailable|Drop|Drag|Dragstart|Dragover|
2579 Dragdrop|Dragenter|Dragend|Dragleave|Dblclick|Unload|Paste|Propertychange|Error|
2580 Errorupdate|Keydown|Keyup|Keypress|Focus|Load|Activate|Afterupdate|Afterprint|Abort)
2581 ) |
2582 (shift|showModelessDialog|showModalDialog|showHelp|scroll|scrollX|scrollByPages|
2583 scrollByLines|scrollY|scrollTo|stop|strike|sizeToContent|sidebar|signText|sort|
2584 sup|sub|substr|substring|splice|split|send|set(?:Milliseconds|Seconds|Minutes|Hours|
2585 Month|Year|FullYear|Date|UTC(?:Milliseconds|Seconds|Minutes|Hours|Month|FullYear|Date)|
2586 Time|Hotkeys|Cursor|ZOptions|Active|Resizable|RequestHeader)|search|slice|
2587 savePreferences|small|home|handleEvent|navigate|char|charCodeAt|charAt|concat|
2588 contextual|confirm|compile|clear|captureEvents|call|createStyleSheet|createPopup|
2589 createEventObject|to(?:GMTString|UTCString|String|Source|UpperCase|LowerCase|LocaleString)|
2590 test|taint|taintEnabled|indexOf|italics|disableExternalCapture|dump|detachEvent|unshift|
2591 untaint|unwatch|updateCommands|join|javaEnabled|pop|push|plugins.refresh|paddings|parse|
2592 print|prompt|preference|enableExternalCapture|exec|execScript|valueOf|UTC|find|file|
2593 fileModifiedDate|fileSize|fileCreatedDate|fileUpdatedDate|fixed|fontsize|fontcolor|
2594 forward|fromCharCode|watch|link|load|lastIndexOf|anchor|attachEvent|atob|apply|alert|
2595 abort|routeEvents|resize|resizeBy|resizeTo|recalc|returnValue|replace|reverse|reload|
2596 releaseCapture|releaseEvents|go|get(?:Milliseconds|Seconds|Minutes|Hours|Month|Day|Year|FullYear|
2597 Time|Date|TimezoneOffset|UTC(?:Milliseconds|Seconds|Minutes|Hours|Day|Month|FullYear|Date)|
2598 Attention|Selection|ResponseHeader|AllResponseHeaders)|moveBy|moveBelow|moveTo|
2599 moveToAbsolute|moveAbove|mergeAttributes|match|margins|btoa|big|bold|borderWidths|blink|back
2600 ) |
2601 (acceptNode|add|addEventListener|addTextTrack|adoptNode|after|animate|append|
2602 appendChild|appendData|before|blur|canPlayType|captureStream|
2603 caretPositionFromPoint|caretRangeFromPoint|checkValidity|clear|click|
2604 cloneContents|cloneNode|cloneRange|close|closest|collapse|
2605 compareBoundaryPoints|compareDocumentPosition|comparePoint|contains|
2606 convertPointFromNode|convertQuadFromNode|convertRectFromNode|createAttribute|
2607 createAttributeNS|createCaption|createCDATASection|createComment|
2608 createContextualFragment|createDocument|createDocumentFragment|
2609 createDocumentType|createElement|createElementNS|createEntityReference|
2610 createEvent|createExpression|createHTMLDocument|createNodeIterator|
2611 createNSResolver|createProcessingInstruction|createRange|createShadowRoot|
2612 createTBody|createTextNode|createTFoot|createTHead|createTreeWalker|delete|
2613 deleteCaption|deleteCell|deleteContents|deleteData|deleteRow|deleteTFoot|
2614 deleteTHead|detach|disconnect|dispatchEvent|elementFromPoint|elementsFromPoint|
2615 enableStyleSheetsForSet|entries|evaluate|execCommand|exitFullscreen|
2616 exitPointerLock|expand|extractContents|fastSeek|firstChild|focus|forEach|get|
2617 getAll|getAnimations|getAttribute|getAttributeNames|getAttributeNode|
2618 getAttributeNodeNS|getAttributeNS|getBoundingClientRect|getBoxQuads|
2619 getClientRects|getContext|getDestinationInsertionPoints|getElementById|
2620 getElementsByClassName|getElementsByName|getElementsByTagName|
2621 getElementsByTagNameNS|getItem|getNamedItem|getSelection|getStartDate|
2622 getVideoPlaybackQuality|has|hasAttribute|hasAttributeNS|hasAttributes|
2623 hasChildNodes|hasFeature|hasFocus|importNode|initEvent|insertAdjacentElement|
2624 insertAdjacentHTML|insertAdjacentText|insertBefore|insertCell|insertData|
2625 insertNode|insertRow|intersectsNode|isDefaultNamespace|isEqualNode|
2626 isPointInRange|isSameNode|item|key|keys|lastChild|load|lookupNamespaceURI|
2627 lookupPrefix|matches|move|moveAttribute|moveAttributeNode|moveChild|
2628 moveNamedItem|namedItem|nextNode|nextSibling|normalize|observe|open|
2629 parentNode|pause|play|postMessage|prepend|preventDefault|previousNode|
2630 previousSibling|probablySupportsContext|queryCommandEnabled|
2631 queryCommandIndeterm|queryCommandState|queryCommandSupported|queryCommandValue|
2632 querySelector|querySelectorAll|registerContentHandler|registerElement|
2633 registerProtocolHandler|releaseCapture|releaseEvents|remove|removeAttribute|
2634 removeAttributeNode|removeAttributeNS|removeChild|removeEventListener|
2635 removeItem|replace|replaceChild|replaceData|replaceWith|reportValidity|
2636 requestFullscreen|requestPointerLock|reset|scroll|scrollBy|scrollIntoView|
2637 scrollTo|seekToNextFrame|select|selectNode|selectNodeContents|set|setAttribute|
2638 setAttributeNode|setAttributeNodeNS|setAttributeNS|setCapture|
2639 setCustomValidity|setEnd|setEndAfter|setEndBefore|setItem|setNamedItem|
2640 setRangeText|setSelectionRange|setSinkId|setStart|setStartAfter|setStartBefore|
2641 slice|splitText|stepDown|stepUp|stopImmediatePropagation|stopPropagation|
2642 submit|substringData|supports|surroundContents|takeRecords|terminate|toBlob|
2643 toDataURL|toggle|toString|values|write|writeln
2644 ) |
2645 (all|catch|finally|race|reject|resolve|then
2647 )(?=\s*\()
2648 captures:
2649 1: punctuation.accessor.ts
2650 2: punctuation.accessor.optional.ts
2651 3: support.function.event-handler.ts
2652 4: support.function.ts
2653 5: support.function.dom.ts
2654 6: support.function.promise.ts
2655 switch-statement:
2656 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?=\bswitch\s*\()'
2657 push:
2658 - meta_scope: switch-statement.expr.ts
2659 - match: '\}'
2660 captures:
2661 0: punctuation.definition.block.ts
2662 pop: true
2663 - include: comment
2664 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(switch)\s*(\()'
2665 captures:
2666 1: keyword.control.switch.ts
2667 2: meta.brace.round.ts
2668 push:
2669 - meta_scope: switch-expression.expr.ts
2670 - match: \)
2671 captures:
2672 0: meta.brace.round.ts
2673 pop: true
2674 - include: expression
2675 - match: '\{'
2676 captures:
2677 0: punctuation.definition.block.ts
2678 push:
2679 - meta_scope: switch-block.expr.ts
2680 - match: '(?=\})'
2681 pop: true
2682 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(case|default(?=:))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2683 captures:
2684 1: keyword.control.switch.ts
2685 push:
2686 - meta_scope: case-clause.expr.ts
2687 - match: (?=:)
2688 pop: true
2689 - include: expression
2690 - match: '(:)\s*(\{)'
2691 captures:
2692 1: case-clause.expr.ts punctuation.definition.section.case-statement.ts
2693 2: meta.block.ts punctuation.definition.block.ts
2694 push:
2695 - meta_content_scope: meta.block.ts
2696 - match: '\}'
2697 captures:
2698 0: meta.block.ts punctuation.definition.block.ts
2699 pop: true
2700 - include: statements
2701 - match: (:)
2702 captures:
2703 0: case-clause.expr.ts punctuation.definition.section.case-statement.ts
2704 - include: statements
2705 template:
2706 - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`)'
2707 push:
2708 - meta_scope: string.template.ts
2709 - match: (?=`)
2710 pop: true
2711 - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*))'
2712 push:
2713 - match: '(?=(<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`)'
2714 pop: true
2715 - include: support-function-call-identifiers
2716 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
2717 scope: entity.name.function.tagged-template.ts
2718 - include: type-arguments
2719 - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?=(<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)`)'
2720 captures:
2721 1: entity.name.function.tagged-template.ts
2722 push:
2723 - meta_scope: string.template.ts
2724 - match: (?=`)
2725 pop: true
2726 - include: type-arguments
2727 - match: "([_$[:alpha:]][_$[:alnum:]]*)?(`)"
2728 captures:
2729 1: entity.name.function.tagged-template.ts
2730 2: punctuation.definition.string.template.begin.ts
2731 push:
2732 - meta_scope: string.template.ts
2733 - match: "`"
2734 captures:
2735 0: punctuation.definition.string.template.end.ts
2736 pop: true
2737 - include: template-substitution-element
2738 - include: string-character-escape
2739 template-substitution-element:
2740 - match: '\$\{'
2741 captures:
2742 0: punctuation.definition.template-expression.begin.ts
2743 push:
2744 - meta_scope: meta.template.expression.ts
2745 - meta_content_scope: meta.embedded.line.ts
2746 - match: '\}'
2747 captures:
2748 0: punctuation.definition.template-expression.end.ts
2749 pop: true
2750 - include: expression
2751 ternary-expression:
2752 - match: '(?!\?\.\s*[^[:digit:]])(\?)(?!\?)'
2753 captures:
2754 1: keyword.operator.ternary.ts
2755 push:
2756 - match: \s*(:)
2757 captures:
2758 1: keyword.operator.ternary.ts
2759 pop: true
2760 - include: expression
2761 this-literal:
2762 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))this\b(?!\$)'
2763 scope: variable.language.this.ts
2764 type:
2765 - include: comment
2766 - include: string
2767 - include: numeric-literal
2768 - include: type-primitive
2769 - include: type-builtin-literals
2770 - include: type-parameters
2771 - include: type-tuple
2772 - include: type-object
2773 - include: type-conditional
2774 - include: type-operators
2775 - include: type-fn-type-parameters
2776 - include: type-paren-or-function-parameters
2777 - include: type-function-return-type
2778 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(readonly)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*'
2779 captures:
2780 1: storage.modifier.ts
2781 - include: type-name
2782 type-alias-declaration:
2783 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(type)\b\s+([_$[:alpha:]][_$[:alnum:]]*)\s*'
2784 captures:
2785 1: keyword.control.export.ts
2786 2: storage.modifier.ts
2787 3: storage.type.type.ts
2788 4: entity.name.type.alias.ts
2789 push:
2790 - meta_scope: meta.type.declaration.ts
2791 - match: '(?=\}|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
2792 pop: true
2793 - include: comment
2794 - include: type-parameters
2795 - match: (=)\s*
2796 captures:
2797 1: keyword.operator.assignment.ts
2798 push:
2799 - match: '(?=\}|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
2800 pop: true
2801 - include: type
2802 type-annotation:
2803 - match: (:)(?=\s*\S)
2804 captures:
2805 1: keyword.operator.type.annotation.ts
2806 push:
2807 - meta_scope: meta.type.annotation.ts
2808 - match: '(?<![:|&])((?=$|^|[,);\}\]]|//)|(?==[^>])|((?<=[\}>\]\)]|[_$[:alpha:]])\s*(?=\{)))'
2809 pop: true
2810 - include: type
2811 - match: (:)
2812 captures:
2813 1: keyword.operator.type.annotation.ts
2814 push:
2815 - meta_scope: meta.type.annotation.ts
2816 - match: '(?<![:|&])((?=[,);\}\]]|//)|(?==[^>])|(?=^\s*$)|((?<=\S)(?=\s*$))|((?<=[\}>\]\)]|[_$[:alpha:]])\s*(?=\{)))'
2817 pop: true
2818 - include: type
2819 type-arguments:
2820 - match: \<
2821 captures:
2822 0: punctuation.definition.typeparameters.begin.ts
2823 push:
2824 - meta_scope: meta.type.parameters.ts
2825 - match: \>
2826 captures:
2827 0: punctuation.definition.typeparameters.end.ts
2828 pop: true
2829 - include: type-arguments-body
2830 type-arguments-body:
2831 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(_)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2832 captures:
2833 0: keyword.operator.type.ts
2834 - include: type
2835 - include: punctuation-comma
2836 type-builtin-literals:
2837 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(this|true|false|undefined|null|object)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2838 scope: support.type.builtin.ts
2839 type-conditional:
2840 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(extends)\s+'
2841 captures:
2842 1: storage.modifier.ts
2843 push:
2844 - match: (?<=:)
2845 pop: true
2846 - match: \?
2847 captures:
2848 0: keyword.operator.ternary.ts
2849 push:
2850 - match: ":"
2851 captures:
2852 0: keyword.operator.ternary.ts
2853 pop: true
2854 - include: type
2855 - include: type
2856 type-fn-type-parameters:
2857 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\b(?=\s*\<)'
2858 captures:
2859 1: meta.type.constructor.ts keyword.control.new.ts
2860 push:
2861 - match: (?<=>)
2862 pop: true
2863 - include: comment
2864 - include: type-parameters
2865 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\b\s*(?=\()'
2866 captures:
2867 1: keyword.control.new.ts
2868 push:
2869 - meta_scope: meta.type.constructor.ts
2870 - match: (?<=\))
2871 pop: true
2872 - include: function-parameters
2873 - match: |-
2874 (?x)(
2875 (?=
2876 [(]\s*(
2877 ([)]) |
2878 (\.\.\.) |
2879 ([_$[:alnum:]]+\s*(
2880 ([:,?=])|
2881 ([)]\s*=>)
2882 ))
2886 push:
2887 - meta_scope: meta.type.function.ts
2888 - match: (?<=\))
2889 pop: true
2890 - include: function-parameters
2891 type-function-return-type:
2892 - match: (=>)(?=\s*\S)
2893 captures:
2894 1: storage.type.function.arrow.ts
2895 push:
2896 - meta_scope: meta.type.function.return.ts
2897 - match: '(?<!=>)(?<![|&])(?=[,\]\)\{\}=;>:\?]|//|$)'
2898 pop: true
2899 - include: type-function-return-type-core
2900 - match: "=>"
2901 captures:
2902 0: storage.type.function.arrow.ts
2903 push:
2904 - meta_scope: meta.type.function.return.ts
2905 - match: '(?<!=>)(?<![|&])((?=[,\]\)\{\}=;:\?>]|//|^\s*$)|((?<=\S)(?=\s*$)))'
2906 pop: true
2907 - include: type-function-return-type-core
2908 type-function-return-type-core:
2909 - include: comment
2910 - match: '(?<==>)(?=\s*\{)'
2911 push:
2912 - match: '(?<=\})'
2913 pop: true
2914 - include: type-object
2915 - include: type-predicate-operator
2916 - include: type
2917 type-name:
2918 - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(<)'
2919 captures:
2920 1: entity.name.type.module.ts
2921 2: punctuation.accessor.ts
2922 3: punctuation.accessor.optional.ts
2923 4: meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
2924 push:
2925 - meta_content_scope: meta.type.parameters.ts
2926 - match: (>)
2927 captures:
2928 1: meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
2929 pop: true
2930 - include: type-arguments-body
2931 - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(<)'
2932 captures:
2933 1: entity.name.type.ts
2934 2: meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
2935 push:
2936 - meta_content_scope: meta.type.parameters.ts
2937 - match: (>)
2938 captures:
2939 1: meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
2940 pop: true
2941 - include: type-arguments-body
2942 - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))'
2943 captures:
2944 1: entity.name.type.module.ts
2945 2: punctuation.accessor.ts
2946 3: punctuation.accessor.optional.ts
2947 - match: "[_$[:alpha:]][_$[:alnum:]]*"
2948 scope: entity.name.type.ts
2949 type-object:
2950 - match: '\{'
2951 captures:
2952 0: punctuation.definition.block.ts
2953 push:
2954 - meta_scope: meta.object.type.ts
2955 - match: '\}'
2956 captures:
2957 0: punctuation.definition.block.ts
2958 pop: true
2959 - include: comment
2960 - include: method-declaration
2961 - include: indexer-declaration
2962 - include: indexer-mapped-type-declaration
2963 - include: field-declaration
2964 - include: type-annotation
2965 - match: \.\.\.
2966 captures:
2967 0: keyword.operator.spread.ts
2968 push:
2969 - match: '(?=\}|;|,|$)|(?<=\})'
2970 pop: true
2971 - include: type
2972 - include: punctuation-comma
2973 - include: punctuation-semicolon
2974 - include: type
2975 type-operators:
2976 - include: typeof-operator
2977 - match: '([&|])(?=\s*\{)'
2978 captures:
2979 0: keyword.operator.type.ts
2980 push:
2981 - match: '(?<=\})'
2982 pop: true
2983 - include: type-object
2984 - match: "[&|]"
2985 captures:
2986 0: keyword.operator.type.ts
2987 push:
2988 - match: (?=\S)
2989 pop: true
2990 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))keyof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2991 scope: keyword.operator.expression.keyof.ts
2992 - match: (\?|\:)
2993 scope: keyword.operator.ternary.ts
2994 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))infer(?=\s+[_$[:alpha:]])'
2995 scope: keyword.operator.expression.infer.ts
2996 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))awaited(?=\s+[_$[:alpha:]])'
2997 scope: keyword.operator.expression.awaited.ts
2998 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))import(?=\s*\()'
2999 scope: keyword.operator.expression.import.ts
3000 type-parameters:
3001 - match: (<)
3002 captures:
3003 1: punctuation.definition.typeparameters.begin.ts
3004 push:
3005 - meta_scope: meta.type.parameters.ts
3006 - match: (>)
3007 captures:
3008 1: punctuation.definition.typeparameters.end.ts
3009 pop: true
3010 - include: comment
3011 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(extends)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
3012 scope: storage.modifier.ts
3013 - include: type
3014 - include: punctuation-comma
3015 - match: (=)(?!>)
3016 scope: keyword.operator.assignment.ts
3017 type-paren-or-function-parameters:
3018 - match: \(
3019 captures:
3020 0: meta.brace.round.ts
3021 push:
3022 - meta_scope: meta.type.paren.cover.ts
3023 - match: \)
3024 captures:
3025 0: meta.brace.round.ts
3026 pop: true
3027 - match: |-
3028 (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))\s*(\??)(?=\s*(:\s*(
3029 (<) |
3030 ([(]\s*(
3031 ([)]) |
3032 (\.\.\.) |
3033 ([_$[:alnum:]]+\s*(
3034 ([:,?=])|
3035 ([)]\s*=>)
3036 ))
3037 ))
3038 )) |
3039 (:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
3040 (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))))
3041 captures:
3042 1: storage.modifier.ts
3043 2: keyword.operator.rest.ts
3044 3: entity.name.function.ts variable.language.this.ts
3045 4: entity.name.function.ts
3046 5: keyword.operator.optional.ts
3047 - match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))\s*(\??)(?=:)'
3048 captures:
3049 1: storage.modifier.ts
3050 2: keyword.operator.rest.ts
3051 3: variable.parameter.ts variable.language.this.ts
3052 4: variable.parameter.ts
3053 5: keyword.operator.optional.ts
3054 - include: type-annotation
3055 - match: ","
3056 scope: punctuation.separator.parameter.ts
3057 - include: type
3058 type-predicate-operator:
3059 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(asserts)\s+)?(?!asserts)(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))\s(is)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
3060 captures:
3061 1: keyword.operator.type.asserts.ts
3062 2: variable.parameter.ts variable.language.this.ts
3063 3: variable.parameter.ts
3064 4: keyword.operator.expression.is.ts
3065 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(asserts)\s+(?!is)(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
3066 captures:
3067 1: keyword.operator.type.asserts.ts
3068 2: variable.parameter.ts variable.language.this.ts
3069 3: variable.parameter.ts
3070 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))asserts(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
3071 scope: keyword.operator.type.asserts.ts
3072 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))is(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
3073 scope: keyword.operator.expression.is.ts
3074 type-primitive:
3075 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(string|number|bigint|boolean|symbol|any|void|never|unknown)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
3076 scope: support.type.primitive.ts
3077 type-tuple:
3078 - match: '\['
3079 captures:
3080 0: meta.brace.square.ts
3081 push:
3082 - meta_scope: meta.type.tuple.ts
3083 - match: '\]'
3084 captures:
3085 0: meta.brace.square.ts
3086 pop: true
3087 - match: \.\.\.
3088 scope: keyword.operator.rest.ts
3089 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))([_$[:alpha:]][_$[:alnum:]]*)\s*(\?)?\s*(:)'
3090 captures:
3091 1: entity.name.label.ts
3092 2: keyword.operator.optional.ts
3093 3: punctuation.separator.label.ts
3094 - include: type
3095 - include: punctuation-comma
3096 typeof-operator:
3097 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))typeof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
3098 scope: keyword.operator.expression.typeof.ts
3099 undefined-literal:
3100 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))undefined(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
3101 scope: constant.language.undefined.ts
3102 var-expr:
3103 - match: '(?=(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))'
3104 push:
3105 - meta_scope: meta.var.expr.ts
3106 - match: '(?!(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))((?=;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|^\s*$|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))|((?<!^let|[^\._$[:alnum:]]let|^var|[^\._$[:alnum:]]var)(?=\s*$)))'
3107 pop: true
3108 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*'
3109 captures:
3110 1: keyword.control.export.ts
3111 2: storage.modifier.ts
3112 3: storage.type.ts
3113 push:
3114 - match: (?=\S)
3115 pop: true
3116 - include: destructuring-variable
3117 - include: var-single-variable
3118 - include: variable-initializer
3119 - include: comment
3120 - match: (,)\s*((?!\S)|(?=\/\/))
3121 captures:
3122 1: punctuation.separator.comma.ts
3123 push:
3124 - match: '(?<!,)(((?==|;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|^\s*$))|((?<=\S)(?=\s*$)))'
3125 pop: true
3126 - include: single-line-comment-consuming-line-ending
3127 - include: comment
3128 - include: destructuring-variable
3129 - include: var-single-variable
3130 - include: punctuation-comma
3131 - include: punctuation-comma
3132 - match: '(?=(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))'
3133 captures:
3134 1: keyword.control.export.ts
3135 2: storage.modifier.ts
3136 3: storage.type.ts
3137 push:
3138 - meta_scope: meta.var.expr.ts
3139 - match: '(?!(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))((?=;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|^\s*$|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))|((?<!^const|[^\._$[:alnum:]]const)(?=\s*$)))'
3140 pop: true
3141 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*'
3142 captures:
3143 1: keyword.control.export.ts
3144 2: storage.modifier.ts
3145 3: storage.type.ts
3146 push:
3147 - match: (?=\S)
3148 pop: true
3149 - include: destructuring-const
3150 - include: var-single-const
3151 - include: variable-initializer
3152 - include: comment
3153 - match: (,)\s*((?!\S)|(?=\/\/))
3154 captures:
3155 1: punctuation.separator.comma.ts
3156 push:
3157 - match: '(?<!,)(((?==|;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|^\s*$))|((?<=\S)(?=\s*$)))'
3158 pop: true
3159 - include: single-line-comment-consuming-line-ending
3160 - include: comment
3161 - include: destructuring-const
3162 - include: var-single-const
3163 - include: punctuation-comma
3164 - include: punctuation-comma
3165 var-single-const:
3166 - match: |-
3167 (?x)([_$[:alpha:]][_$[:alnum:]]*)(?=\s*
3168 # function assignment |
3169 (=\s*(
3170 ((async\s+)?(
3171 (function\s*[(<*]) |
3172 (function\s+) |
3173 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
3174 )) |
3175 ((async\s*)?(
3176 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
3177 # sure shot arrow functions even if => is on new line
3179 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
3180 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
3182 ([)]\s*:) | # ():
3183 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
3185 ) |
3187 # arrow function possible to detect only with => on same line
3189 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
3190 \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
3191 (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
3192 \s*=> # arrow operator
3194 ))
3195 )) |
3196 # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
3197 (:\s*(
3198 (<) |
3199 ([(]\s*(
3200 ([)]) |
3201 (\.\.\.) |
3202 ([_$[:alnum:]]+\s*(
3203 ([:,?=])|
3204 ([)]\s*=>)
3205 ))
3206 ))
3207 )) |
3208 (:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
3209 (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
3210 (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
3211 ((async\s+)?(
3212 (function\s*[(<*]) |
3213 (function\s+) |
3214 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
3215 )) |
3216 ((async\s*)?(
3217 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
3218 # sure shot arrow functions even if => is on new line
3220 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
3221 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
3223 ([)]\s*:) | # ():
3224 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
3226 ) |
3228 # arrow function possible to detect only with => on same line
3230 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
3231 \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
3232 (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
3233 \s*=> # arrow operator
3235 ))
3236 )))
3237 captures:
3238 1: meta.definition.variable.ts variable.other.constant.ts entity.name.function.ts
3239 push:
3240 - meta_scope: meta.var-single-variable.expr.ts
3241 - match: '(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
3242 pop: true
3243 - include: var-single-variable-type-annotation
3244 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
3245 captures:
3246 1: meta.definition.variable.ts variable.other.constant.ts
3247 push:
3248 - meta_scope: meta.var-single-variable.expr.ts
3249 - match: '(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
3250 pop: true
3251 - include: var-single-variable-type-annotation
3252 var-single-variable:
3253 - match: |-
3254 (?x)([_$[:alpha:]][_$[:alnum:]]*)(\!)?(?=\s*
3255 # function assignment |
3256 (=\s*(
3257 ((async\s+)?(
3258 (function\s*[(<*]) |
3259 (function\s+) |
3260 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
3261 )) |
3262 ((async\s*)?(
3263 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
3264 # sure shot arrow functions even if => is on new line
3266 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
3267 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
3269 ([)]\s*:) | # ():
3270 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
3272 ) |
3274 # arrow function possible to detect only with => on same line
3276 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
3277 \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
3278 (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
3279 \s*=> # arrow operator
3281 ))
3282 )) |
3283 # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
3284 (:\s*(
3285 (<) |
3286 ([(]\s*(
3287 ([)]) |
3288 (\.\.\.) |
3289 ([_$[:alnum:]]+\s*(
3290 ([:,?=])|
3291 ([)]\s*=>)
3292 ))
3293 ))
3294 )) |
3295 (:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
3296 (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
3297 (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
3298 ((async\s+)?(
3299 (function\s*[(<*]) |
3300 (function\s+) |
3301 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
3302 )) |
3303 ((async\s*)?(
3304 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
3305 # sure shot arrow functions even if => is on new line
3307 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
3308 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
3310 ([)]\s*:) | # ():
3311 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
3313 ) |
3315 # arrow function possible to detect only with => on same line
3317 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
3318 \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
3319 (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
3320 \s*=> # arrow operator
3322 ))
3323 )))
3324 captures:
3325 1: meta.definition.variable.ts entity.name.function.ts
3326 2: keyword.operator.definiteassignment.ts
3327 push:
3328 - meta_scope: meta.var-single-variable.expr.ts
3329 - match: '(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
3330 pop: true
3331 - include: var-single-variable-type-annotation
3332 - match: '([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])(\!)?'
3333 captures:
3334 1: meta.definition.variable.ts variable.other.constant.ts
3335 2: keyword.operator.definiteassignment.ts
3336 push:
3337 - meta_scope: meta.var-single-variable.expr.ts
3338 - match: '(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
3339 pop: true
3340 - include: var-single-variable-type-annotation
3341 - match: '([_$[:alpha:]][_$[:alnum:]]*)(\!)?'
3342 captures:
3343 1: meta.definition.variable.ts variable.other.readwrite.ts
3344 2: keyword.operator.definiteassignment.ts
3345 push:
3346 - meta_scope: meta.var-single-variable.expr.ts
3347 - match: '(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
3348 pop: true
3349 - include: var-single-variable-type-annotation
3350 var-single-variable-type-annotation:
3351 - include: type-annotation
3352 - include: string
3353 - include: comment
3354 variable-initializer:
3355 - match: (?<!=|!)(=)(?!=)(?=\s*\S)(?!\s*.*=>\s*$)
3356 captures:
3357 1: keyword.operator.assignment.ts
3358 push:
3359 - match: '(?=$|^|[,);}\]]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
3360 pop: true
3361 - include: expression
3362 - match: (?<!=|!)(=)(?!=)
3363 captures:
3364 1: keyword.operator.assignment.ts
3365 push:
3366 - match: '(?=[,);}\]]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))|(?=^\s*$)|(?<=\S)(?<!=)(?=\s*$)'
3367 pop: true
3368 - include: expression