Skip to content

Commit d6ee336

Browse files
committed
More pattern variables for arrows, type parameters etc
1 parent 21f425d commit d6ee336

File tree

3 files changed

+411
-319
lines changed

3 files changed

+411
-319
lines changed

TypeScript.YAML-tmLanguage

Lines changed: 79 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,57 @@ uuid: ef98eb90-bf9b-11e4-bb52-0800200c9a66
88
variables:
99
identifier: '[_$[:alpha:]][_$[:alnum:]]*'
1010
constantIdentifier: '[[:upper:]][_$[:digit:][:upper:]]*'
11+
quotedStrings: (\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")
12+
nonIdentifierPropertyName: '{{quotedStrings}}|(\[([^\[\]]|\[[^\[\]]*\])+\])'
13+
propertyName: (({{identifier}})|{{nonIdentifierPropertyName}})
14+
constantVar: ({{constantIdentifier}})(?![_$[:alnum:]])
15+
typeParameters: (<\s*[_$[:alpha:]\{\(]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(]([^=<>]|=[^<])+\>)+>\s*)
16+
arrowLookup: |-
17+
# sure shot arrow functions even if => is on new line
18+
(
19+
[(]\s*
20+
(
21+
([)]\s*:) | # ():
22+
((\.\.\.\s*)?{{identifier}}\s*:) # [(]param: | [(]...param:
23+
)
24+
) |
25+
(
26+
[<]\s*{{identifier}}\s+extends\s*[^=>] # < typeparam extends
27+
) |
28+
# arrow function possible to detect only with => on same line
29+
(
30+
{{typeParameters}}? # typeparameters
31+
\((\s*[_$[:alpha:]\{\(]([^()]|\((\s*[_$[:alpha:]\{\(]\{\(][^()]*)?\))*)?\) # parameteres
32+
(\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
33+
\s*=> # arrow operator
34+
)
35+
functionOrArrowLookup: |-
36+
\s*(
37+
((async\s+)?(
38+
(function\s*[(<*]) |
39+
(function\s+) |
40+
({{identifier}}\s*=>)
41+
)) |
42+
((async\s*)?(
43+
{{arrowLookup}}
44+
))
45+
)
46+
functionLikeAssignmentOrType: |-
47+
\s*
48+
# function assignment |
49+
(={{functionOrArrowLookup}}) |
50+
# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
51+
(:\s*(
52+
(<) |
53+
([(]\s*(
54+
([)]) |
55+
(\.\.\.) |
56+
([_$[:alnum:]]+\s*(
57+
([:,?=])|
58+
([)]\s*=>)
59+
))
60+
))
61+
))
1162
1263
patterns:
1364
- include: '#directives'
@@ -124,41 +175,15 @@ repository:
124175
var-single-variable:
125176
patterns:
126177
- name: meta.var-single-variable.expr.ts
127-
# function assignment |
128-
# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
129178
begin: |-
130-
(?x)({{identifier}})(?=\s*
131-
(=\s*(
132-
((async\s+)?(
133-
(function\s*[(<*]) |
134-
(function\s+) |
135-
({{identifier}}\s*=>)
136-
)) |
137-
((async\s*)?(
138-
([(]\s*(([)]\s*:)|({{identifier}}\s*:)|(\.\.\.) )) |
139-
([<]\s*{{identifier}}((\s+extends\s*[^=>])|(\s*[,]))) |
140-
((<\s*[_$[:alpha:]\{\(]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(]([^=<>]|=[^<])+\>)+>\s*)?\((\s*[_$[:alpha:]\{\(]([^()]|\((\s*[_$[:alpha:]\{\(]\{\(][^()]*)?\))*)?\)(\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)?\s*=>)
141-
))
142-
)) |
143-
(:\s*(
144-
(<) |
145-
([(]\s*(
146-
([)]) |
147-
(\.\.\.) |
148-
([_$[:alnum:]]+\s*(
149-
([:,?=])|
150-
([)]\s*=>)
151-
))
152-
))
153-
))
154-
)
179+
(?x)({{identifier}})(?={{functionLikeAssignmentOrType}})
155180
beginCaptures:
156181
'1': { name: meta.definition.variable.ts entity.name.function.ts }
157182
end: (?=$|^|[;,=}]|(\s+(of|in)\s+))
158183
patterns:
159184
- include: '#var-single-variable-type-annotation'
160185
- name: meta.var-single-variable.expr.ts
161-
begin: ({{constantIdentifier}})(?![_$[:alnum:]])
186+
begin: '{{constantVar}}'
162187
beginCaptures:
163188
'1': { name: meta.definition.variable.ts variable.other.constant.ts }
164189
end: (?=$|^|[;,=}]|(\s+(of|in)\s+))
@@ -198,7 +223,7 @@ repository:
198223
object-binding-element:
199224
patterns:
200225
- include: '#comment'
201-
- begin: (?=(({{identifier}})|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
226+
- begin: (?={{propertyName}}\s*(:))
202227
end: (?=,|\})
203228
patterns:
204229
- include: '#object-binding-element-propertyName'
@@ -209,7 +234,7 @@ repository:
209234
- include: '#punctuation-comma'
210235

211236
object-binding-element-propertyName:
212-
begin: (?=(({{identifier}})|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
237+
begin: (?={{propertyName}}\s*(:))
213238
end: (:)
214239
endCaptures:
215240
'0': { name: punctuation.destructuring.ts }
@@ -261,34 +286,8 @@ repository:
261286
- match: \s*\b(public|protected|private|readonly)(?=\s+(public|protected|private|readonly)\s+)
262287
captures:
263288
'1': { name: storage.modifier.ts }
264-
# function assignment |
265-
# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
266289
- match: |-
267-
(?x)(?:\s*\b(public|private|protected|readonly)\s+)?(\.\.\.)?\s*(?<!=|:)(?:(this)|({{identifier}}))\s*(\??)(?=\s*
268-
(=\s*(
269-
((async\s+)?(
270-
(function\s*[(<*]) |
271-
(function\s+) |
272-
({{identifier}}\s*=>)
273-
)) |
274-
((async\s*)?(
275-
([(]\s*(([)]\s*:)|({{identifier}}\s*:)|(\.\.\.) )) |
276-
([<]\s*{{identifier}}((\s+extends\s*[^=>])|(\s*[,]))) |
277-
((<\s*[_$[:alpha:]\{\(]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(]([^=<>]|=[^<])+\>)+>\s*)?\((\s*[_$[:alpha:]\{\(]([^()]|\((\s*[_$[:alpha:]\{\(]\{\(][^()]*)?\))*)?\)(\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)?\s*=>)
278-
))
279-
)) |
280-
(:\s*(
281-
(<) |
282-
([(]\s*(
283-
([)]) |
284-
(\.\.\.) |
285-
([_$[:alnum:]]+\s*(
286-
([:,?=])|
287-
([)]\s*=>)
288-
))
289-
))
290-
))
291-
)
290+
(?x)(?:\s*\b(public|private|protected|readonly)\s+)?(\.\.\.)?\s*(?<!=|:)(?:(this)|({{identifier}}))\s*(\??)(?={{functionLikeAssignmentOrType}})
292291
captures:
293292
'1': { name: storage.modifier.ts }
294293
'2': { name: keyword.operator.rest.ts }
@@ -328,7 +327,7 @@ repository:
328327
parameter-object-binding-element:
329328
patterns:
330329
- include: '#comment'
331-
- begin: (?=(({{identifier}})|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
330+
- begin: (?={{propertyName}}\s*(:))
332331
end: (?=,|\})
333332
patterns:
334333
- include: '#object-binding-element-propertyName'
@@ -377,14 +376,14 @@ repository:
377376

378377
field-declaration:
379378
name: meta.field.declaration.ts
380-
begin: (?<!\()(?:(?<!\.|\$)\b(readonly)\s+)?(?=(({{identifier}})|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:))
379+
begin: (?<!\()(?:(?<!\.|\$)\b(readonly)\s+)?(?={{propertyName}}\s*(\?\s*)?(=|:))
381380
beginCaptures:
382381
'1': { name: storage.modifier.ts }
383-
end: (?=\}|;|,|$|(^(?!(({{identifier}})|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:))))|(?<=\})
382+
end: (?=\}|;|,|$|(^(?!{{propertyName}}\s*(\?\s*)?(=|:))))|(?<=\})
384383
patterns:
385384
- include: '#variable-initializer'
386-
- begin: (?=((?:{{identifier}})|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:))
387-
end: (?=[};,=]|$|(^(?!(({{identifier}})|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:))))|(?<=\})
385+
- begin: (?={{propertyName}}\s*(\?\s*)?(=|:))
386+
end: (?=[};,=]|$|(^(?!{{propertyName}}\s*(\?\s*)?(=|:))))|(?<=\})
388387
patterns:
389388
- include: '#type-annotation'
390389
- include: '#string'
@@ -394,31 +393,7 @@ repository:
394393
# function assignment |
395394
# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
396395
match: |-
397-
(?x)({{identifier}})(?=(\?\s*)?\s*
398-
(=\s*(
399-
((async\s+)?(
400-
(function\s*[(<*]) |
401-
(function\s+) |
402-
({{identifier}}\s*=>)
403-
)) |
404-
((async\s*)?(
405-
([(]\s*(([)]\s*:)|({{identifier}}\s*:)|(\.\.\.) )) |
406-
([<]\s*{{identifier}}((\s+extends\s*[^=>])|(\s*[,]))) |
407-
((<\s*[_$[:alpha:]\{\(]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(]([^=<>]|=[^<])+\>)+>\s*)?\((\s*[_$[:alpha:]\{\(]([^()]|\((\s*[_$[:alpha:]\{\(]\{\(][^()]*)?\))*)?\)(\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)?\s*=>)
408-
))
409-
)) |
410-
(:\s*(
411-
(<) |
412-
([(]\s*(
413-
([)]) |
414-
(\.\.\.) |
415-
([_$[:alnum:]]+\s*(
416-
([:,?=])|
417-
([)]\s*=>)
418-
))
419-
))
420-
))
421-
)
396+
(?x)({{identifier}})(?=(\?\s*)?{{functionLikeAssignmentOrType}})
422397
- name: meta.definition.property.ts variable.object.property.ts
423398
match: '{{identifier}}'
424399
- name: keyword.operator.optional.ts
@@ -479,7 +454,7 @@ repository:
479454
patterns:
480455
# method, accessor
481456
- name: meta.method.declaration.ts
482-
begin: (?<!\.|\$)(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:\b(get|set)\s+)(?:(\*)\s*)?(?=((({{identifier}})|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<])
457+
begin: (?<!\.|\$)(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:\b(get|set)\s+)(?:(\*)\s*)?(?=({{propertyName}}\s*(\??))\s*[\(\<])
483458
beginCaptures:
484459
'1': { name: storage.modifier.ts } # captures keyword (public or private or protected)
485460
'2': { name: storage.modifier.ts } # captures keyword (abstract)
@@ -492,7 +467,7 @@ repository:
492467
- include: '#function-body'
493468
# new, constructor or call signature
494469
- name: meta.method.declaration.ts
495-
begin: (?<!\.|\$)(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:(?:\b(?:(new)|(constructor))\b(?!\$|\.|:))|(?:(\*)\s*)?(?=((({{identifier}})|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))?\s*[\(\<]))
470+
begin: (?<!\.|\$)(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:(?:\b(?:(new)|(constructor))\b(?!\$|\.|:))|(?:(\*)\s*)?(?=({{propertyName}}\s*(\??))?\s*[\(\<]))
496471
beginCaptures:
497472
'1': { name: storage.modifier.ts } # captures keyword (public or private or protected)
498473
'2': { name: storage.modifier.ts } # captures keyword (abstract)
@@ -507,7 +482,7 @@ repository:
507482

508483
object-literal-method-declaration:
509484
name: meta.method.declaration.ts
510-
begin: (?<!\.|\$)(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=((({{identifier}})|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<])
485+
begin: (?<!\.|\$)(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=({{propertyName}}\s*(\??))\s*[\(\<])
511486
beginCaptures:
512487
'1': { name: storage.modifier.async.ts } # captures keyword (async)
513488
'2': { name: storage.type.property.ts } # captures keyword (get|set)
@@ -516,7 +491,7 @@ repository:
516491
patterns:
517492
- include: '#method-declaration-name'
518493
- include: '#function-body'
519-
- begin: (?<!\.|\$)(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=((({{identifier}})|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<])
494+
- begin: (?<!\.|\$)(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=({{propertyName}}\s*(\??))\s*[\(\<])
520495
beginCaptures:
521496
'1': { name: storage.modifier.async.ts } # captures keyword (async)
522497
'2': { name: storage.type.property.ts } # captures keyword (get|set)
@@ -526,7 +501,7 @@ repository:
526501
- include: '#method-declaration-name'
527502

528503
method-declaration-name:
529-
begin: (?=(({{identifier}})|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??)\s*[\(\<])
504+
begin: (?={{propertyName}}\s*(\??)\s*[\(\<])
530505
end: (?=\(|\<)
531506
patterns:
532507
- include: '#string'
@@ -553,24 +528,7 @@ repository:
553528
)?
554529
((?<![})!\]])\s*
555530
(?=
556-
# sure shot arrow functions even if => is on new line
557-
(
558-
[(]\s*
559-
(
560-
([)]\s*:) | # ():
561-
((\.\.\.\s*)?{{identifier}}\s*:) # [(]param: | [(]...param:
562-
)
563-
) |
564-
(
565-
[<]\s*{{identifier}}\s+extends\s*[^=>] # < typeparam extends
566-
) |
567-
# arrow function possible to detect only with => on same line
568-
(
569-
(<\s*[_$[:alpha:]\{\(]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(]([^=<>]|=[^<])+\>)+>\s*)? # typeparameters
570-
\((\s*[_$[:alpha:]\{\(]([^()]|\((\s*[_$[:alpha:]\{\(]\{\(][^()]*)?\))*)?\) # parameteres
571-
(\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
572-
\s*=> # arrow operator
573-
)
531+
{{arrowLookup}}
574532
)
575533
)
576534
beginCaptures:
@@ -767,7 +725,7 @@ repository:
767725
patterns:
768726
- include: '#comment'
769727
- include: '#variable-initializer'
770-
- begin: (?=((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\])))
728+
- begin: (?=({{nonIdentifierPropertyName}}))
771729
end: (?=,|\}|$)
772730
patterns:
773731
- include: '#string'
@@ -1026,18 +984,7 @@ repository:
1026984
'1': { name: constant.numeric.decimal.ts }
1027985
- name: meta.object.member.ts
1028986
match: |-
1029-
(?x)(?:({{identifier}})\s*(?=:\s*(
1030-
((async\s+)?(
1031-
(function\s*[(<*]) |
1032-
(function\s+) |
1033-
({{identifier}}\s*=>)
1034-
)) |
1035-
((async\s*)?(
1036-
([(]\s*(([)]\s*:)|({{identifier}}\s*:)|(\.\.\.) )) |
1037-
([<]\s*{{identifier}}((\s+extends\s*[^=>])|(\s*[,]))) |
1038-
((<\s*[_$[:alpha:]\{\(]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(]([^=<>]|=[^<])+\>)+>\s*)?\((\s*[_$[:alpha:]\{\(]([^()]|\((\s*[_$[:alpha:]\{\(]\{\(][^()]*)?\))*)?\)(\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)?\s*=>)
1039-
))
1040-
)))
987+
(?x)(?:({{identifier}})\s*(?=:{{functionOrArrowLookup}}))
1041988
captures:
1042989
'0': { name: meta.object-literal.key.ts }
1043990
'1': { name: entity.name.function.ts }
@@ -1084,12 +1031,12 @@ repository:
10841031

10851032
#function call and new expression
10861033
function-call:
1087-
begin: (?=(({{identifier}}\s*\.\s*)*|(\.\s*)?)({{identifier}})\s*(<\s*[_$[:alpha:]\{\(]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(]([^=<>]|=[^<])+\>)+>\s*)?\()
1088-
end: (?<=\))(?!(({{identifier}}\s*\.\s*)*|(\.\s*)?)({{identifier}})\s*(<\s*[_$[:alpha:]\{\(]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(]([^=<>]|=[^<])+\>)+>\s*)?\()
1034+
begin: (?=(({{identifier}}\s*\.\s*)*|(\.\s*)?)({{identifier}})\s*{{typeParameters}}?\()
1035+
end: (?<=\))(?!(({{identifier}}\s*\.\s*)*|(\.\s*)?)({{identifier}})\s*{{typeParameters}}?\()
10891036
patterns:
10901037
- name: meta.function-call.ts
10911038
begin: (?=(({{identifier}}\s*\.\s*)*|(\.\s*)?)({{identifier}}))
1092-
end: (?=\s*(<\s*[_$[:alpha:]\{\(]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(]([^=<>]|=[^<])+\>)+>\s*)?\()
1039+
end: (?=\s*{{typeParameters}}?\()
10931040
patterns:
10941041
- include: '#literal'
10951042
- include: '#support-objects'
@@ -1264,7 +1211,7 @@ repository:
12641211
(?:\b[0-9]+(\.)[0-9]+[eE][+-]?[0-9]+\b)| # 1.1E+3
12651212
(?:\b[0-9]+(\.)[eE][+-]?[0-9]+\b)| # 1.E+3
12661213
(?:\B(\.)[0-9]+[eE][+-]?[0-9]+\b)| # .1E+3
1267-
(?:\b[0-9]+[eE][+-]?[0-9]+\b)| # 1E+3
1214+
(?:\b[0-9]+[eE][+-]?[0-9]+\b)| # 1E+3
12681215
(?:\b[0-9]+(\.)[0-9]+\b)| # 1.1
12691216
(?:\b[0-9]+(\.)\B)| # 1.
12701217
(?:\B(\.)[0-9]+\b)| # .1
@@ -1464,7 +1411,7 @@ repository:
14641411
|siblingBelow|size|source|specified|standby|start|status|statusbar|statusText|style|styleSheets|suffixes|summary
14651412
|systemId|systemLanguage|tagName|tags|target|tBodies|text|textAlign|textDecoration|textIndent|textTransform|tFoot|tHead
14661413
|title|toolbar|top|type|undefined|uniqueID|updateInterval|URL|URLUnencoded|useMap|userAgent|userLanguage|userProfile
1467-
|vAlign|value|valueType|vendor|vendorSub|version|visibility|vspace|whiteSpace|width|X[MS]LDocument|zIndex))\b(?!\$|\s*(<\s*[_$[:alpha:]\{\(]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(]([^=<>]|=[^<])+\>)+>\s*)?\()
1414+
|vAlign|value|valueType|vendor|vendorSub|version|visibility|vspace|whiteSpace|width|X[MS]LDocument|zIndex))\b(?!\$|\s*{{typeParameters}}?\()
14681415
captures:
14691416
'1': { name: punctuation.accessor.ts }
14701417
'2': { name: support.constant.dom.ts }
@@ -1581,23 +1528,12 @@ repository:
15811528
- include: '#object-identifiers'
15821529
# function and method assignment
15831530
- match: |-
1584-
(?x)(?:(\.)\s*)?({{identifier}})(?=\s*=\s*(
1585-
((async\s+)?(
1586-
(function\s*[(<*]) |
1587-
(function\s+) |
1588-
({{identifier}}\s*=>)
1589-
)) |
1590-
((async\s*)?(
1591-
([(]\s*(([)]\s*:)|({{identifier}}\s*:)|(\.\.\.) )) |
1592-
([<]\s*{{identifier}}((\s+extends\s*[^=>])|(\s*[,]))) |
1593-
((<\s*[_$[:alpha:]\{\(]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(]([^=<>]|=[^<])+\>)+>\s*)?\((\s*[_$[:alpha:]\{\(]([^()]|\((\s*[_$[:alpha:]\{\(]\{\(][^()]*)?\))*)?\)(\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)?\s*=>)
1594-
))
1595-
))
1531+
(?x)(?:(\.)\s*)?({{identifier}})(?=\s*={{functionOrArrowLookup}})
15961532
captures:
15971533
'1': { name: punctuation.accessor.ts }
15981534
'2': { name: entity.name.function.ts }
15991535
# const properties
1600-
- match: (\.)\s*({{constantIdentifier}})(?![_$[:alnum:]])
1536+
- match: (\.)\s*{{constantVar}}
16011537
captures:
16021538
'1': { name: punctuation.accessor.ts }
16031539
'2': { name: variable.other.constant.property.ts }
@@ -1608,7 +1544,7 @@ repository:
16081544
'2': { name: variable.other.property.ts }
16091545
# const
16101546
- name: variable.other.constant.ts
1611-
match: ({{constantIdentifier}})(?![_$[:alnum:]])
1547+
match: '{{constantVar}}'
16121548
# vars
16131549
- name: variable.other.readwrite.ts
16141550
match: '{{identifier}}'
@@ -2094,7 +2030,7 @@ repository:
20942030

20952031
directives:
20962032
name: comment.line.triple-slash.directive.ts
2097-
begin: ^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|name)\s*=\s*((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")))+\s*/>\s*$)
2033+
begin: ^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|name)\s*=\s*({{quotedStrings}}))+\s*/>\s*$)
20982034
beginCaptures:
20992035
'1': { name: punctuation.definition.comment.ts }
21002036
end: (?=^)

0 commit comments

Comments
 (0)