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