@@ -26,9 +26,10 @@ variables:
26
26
lookBehindOf : ' ^of|{{nonPropertyLookBehind}}of'
27
27
lookBehindTypeof : ' ^typeof|{{nonPropertyLookBehind}}typeof'
28
28
lookBehindCase : ' ^case|{{nonPropertyLookBehind}}case'
29
- matchingParenthesis : (\([^\(\)]*\))
30
- matchingBraces : (\{[^\{\}]*\})
31
- matchingBrackets : (\[[^\[\]]*\])
29
+ matchingParenthesis : (\(([^\(\)]|(\([^\(\)]*\)))*\))
30
+ matchingBraces : (\{([^\{\}]|(\{[^\{\}]*\}))*\})
31
+ matchingBrackets : (\[([^\[\]]|(\[[^\[\]]*\]))*\])
32
+ inlineComment : \/\*([^\*]|(\*[^\/]))*\*\/
32
33
# Identifier start | matching braces | matching parenthesis | matching square brackets
33
34
typeParamersStart : ([_$[:alpha:]]|{{matchingBraces}}|{{matchingParenthesis}}|{{matchingBrackets}})
34
35
typeParameters : (<\s*{{typeParamersStart}}([^=<>]|=[^<]|\<\s*{{typeParamersStart}}([^=<>]|=[^<])*\>)*>\s*)
@@ -462,6 +463,7 @@ repository:
462
463
' 5 ' : { name: meta.definition.function.ts entity.name.function.ts }
463
464
end : (?=$|^|;)|(?<=\})
464
465
patterns :
466
+ - include : ' #function-name'
465
467
- include : ' #function-body'
466
468
467
469
function-expression :
@@ -474,15 +476,22 @@ repository:
474
476
' 4 ' : { name: meta.definition.function.ts entity.name.function.ts }
475
477
end : (?<=\})
476
478
patterns :
479
+ - include : ' #function-name'
477
480
- include : ' #function-body'
478
481
482
+ function-name :
483
+ name : meta.definition.function.ts entity.name.function.ts
484
+ match : ' {{identifier}}'
485
+
479
486
function-body :
480
487
patterns :
481
488
- include : ' #comment'
482
489
- include : ' #type-parameters'
483
490
- include : ' #function-parameters'
484
491
- include : ' #return-type'
485
492
- include : ' #decl-block'
493
+ - name : keyword.generator.asterisk.ts
494
+ match : \*
486
495
487
496
method-declaration :
488
497
patterns :
@@ -721,6 +730,7 @@ repository:
721
730
- include : ' #variable-initializer'
722
731
- include : ' #access-modifier'
723
732
- include : ' #property-accessor'
733
+ - include : ' #async-modifier'
724
734
- include : ' #after-operator-block-as-object-literal'
725
735
- include : ' #decl-block'
726
736
- include : ' #expression'
@@ -735,6 +745,10 @@ repository:
735
745
name : storage.type.property.ts
736
746
match : ' {{startOfIdentifier}}(get|set){{endOfIdentifier}}'
737
747
748
+ async-modifier :
749
+ name : storage.modifier.async.ts
750
+ match : ' {{startOfIdentifier}}(async){{endOfIdentifier}}'
751
+
738
752
# enum
739
753
enum-declaration :
740
754
name : meta.enum.declaration.ts
@@ -951,18 +965,24 @@ repository:
951
965
- include : ' #statements'
952
966
953
967
for-loop :
954
- begin : ' {{startOfIdentifier}}( for)(?: \s+(await)) ?\s*(\( )'
968
+ begin : ' {{startOfIdentifier}}for(?=(( \s+|(\s*{{inlineComment}}\s*))await) ?\s*({{inlineComment}}\s*)?(\() )'
955
969
beginCaptures :
956
- ' 1 ' : { name: keyword.control.loop.ts }
957
- ' 2 ' : { name: keyword.control.loop.ts }
958
- ' 3 ' : { name: meta.brace.round.ts }
959
- end : \)
960
- endCaptures :
961
- ' 0 ' : { name: meta.brace.round.ts }
970
+ ' 0 ' : { name: keyword.control.loop.ts }
971
+ end : (?<=\))
962
972
patterns :
963
- - include : ' #var-expr'
964
- - include : ' #expression'
965
- - include : ' #punctuation-semicolon'
973
+ - include : ' #comment'
974
+ - name : keyword.control.loop.ts
975
+ match : await
976
+ - begin : \(
977
+ beginCaptures :
978
+ ' 0 ' : { name: meta.brace.round.ts }
979
+ end : \)
980
+ endCaptures :
981
+ ' 0 ' : { name: meta.brace.round.ts }
982
+ patterns :
983
+ - include : ' #var-expr'
984
+ - include : ' #expression'
985
+ - include : ' #punctuation-semicolon'
966
986
967
987
# blocks
968
988
decl-block :
@@ -1005,14 +1025,19 @@ repository:
1005
1025
- include : ' #object-literal-method-declaration'
1006
1026
- name : meta.object.member.ts meta.object-literal.key.ts
1007
1027
begin : (?=\[)
1008
- end : (?=:)
1028
+ end : (?=:)|((?<=[\]])(?=\s*[\(\<]))
1009
1029
patterns :
1010
1030
- include : ' #array-literal'
1011
1031
- name : meta.object.member.ts meta.object-literal.key.ts
1012
1032
begin : (?=[\'\"])
1013
- end : (?=:)
1033
+ end : (?=:)|((?<=[\'\"])(?=\s*[\(\<]))
1014
1034
patterns :
1015
1035
- include : ' #string'
1036
+ - name : meta.method.declaration.ts
1037
+ begin : (?<=[\]\'\"])(?=\s*[\(\<])
1038
+ end : (?=\}|;|,)|(?<=\})
1039
+ patterns :
1040
+ - include : ' #function-body'
1016
1041
- name : meta.object.member.ts
1017
1042
match : (?![_$[:alpha:]])([[:digit:]]+)\s*(?=:)
1018
1043
captures :
@@ -1154,6 +1179,14 @@ repository:
1154
1179
patterns :
1155
1180
- name : keyword.control.flow.ts
1156
1181
match : ' {{startOfIdentifier}}(await){{endOfIdentifier}}'
1182
+ - begin : ' {{startOfIdentifier}}(yield){{endOfIdentifier}}(?=\s*{{inlineComment}}\s*\*)'
1183
+ beginCaptures :
1184
+ ' 1 ' : { name: keyword.control.flow.ts }
1185
+ end : \*
1186
+ endCaptures :
1187
+ ' 0 ' : { name: keyword.generator.asterisk.ts }
1188
+ patterns :
1189
+ - include : ' #comment'
1157
1190
- match : ' {{startOfIdentifier}}(yield){{endOfIdentifier}}(?:\s*(\*))?'
1158
1191
captures :
1159
1192
' 1 ' : { name: keyword.control.flow.ts }
0 commit comments