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