@@ -12,13 +12,26 @@ patterns: [
12
12
repository :
13
13
" var-expr" :
14
14
name : " meta.var.expr.ts"
15
- begin : " (?<!\\ ()\\ s*\\ b(var|let|const(?!\\ s+enum)) \\ s+([a-zA-Z_$][ \\ w$]* )"
15
+ begin : " (?<!\\ ()\\ s*\\ b(var|let|const(?!\\ s+enum)\\ b )"
16
16
beginCaptures :
17
17
" 1" :
18
18
name : " storage.type.ts"
19
- " 2" :
19
+ end : " (?=$|;)"
20
+ patterns : [
21
+ {
22
+ include : " #var-single-variable"
23
+ }
24
+ {
25
+ include : " #comment"
26
+ }
27
+ ]
28
+ " var-single-variable" :
29
+ name : " meta.var-single-variable.expr.ts"
30
+ begin : " \\ b([a-zA-Z_$][\\ w$]*)\\ s*(=?)"
31
+ beginCaptures :
32
+ " 1" :
20
33
name : " variable.ts"
21
- end : " (?=$|[;= \\ } \\ {])|(?<= \\ } )"
34
+ end : " (?=$|[;,] )"
22
35
patterns : [
23
36
{
24
37
include : " #type-annotation"
@@ -29,22 +42,13 @@ repository:
29
42
{
30
43
include : " #comment"
31
44
}
32
- ]
33
- " control-statement" :
34
- name : " keyword.control.ts"
35
- match : " (?<!\\ .)\\ b(break|catch|continue|debugger|declare|do|else|finally|for|if|return|switch|throw|try|while|with|super|case|default)\\ b"
36
- " switch-case" :
37
- name : " case.expr.ts"
38
- begin : " (?<!\\ .)\\ b(case|default)\\ b"
39
- beginCaptures :
40
- " 1" :
41
- name : " keyword.control.ts"
42
- end : " :"
43
- patterns : [
44
45
{
45
46
include : " #expression"
46
47
}
47
48
]
49
+ " control-statement" :
50
+ name : " keyword.control.ts"
51
+ match : " (?<!\\ .)\\ b(break|catch|continue|debugger|declare|do|else|finally|for|if|return|switch|throw|try|while|with|super|case|default)\\ b"
48
52
declaration :
49
53
name : " meta.declaration.ts"
50
54
patterns : [
@@ -136,6 +140,9 @@ repository:
136
140
{
137
141
include : " #comment"
138
142
}
143
+ {
144
+ include : " #object-heritage"
145
+ }
139
146
{
140
147
include : " #type-parameters"
141
148
}
@@ -250,7 +257,7 @@ repository:
250
257
name : " entity.name.function.ts"
251
258
" 7" :
252
259
name : " keyword.operator.ts"
253
- end : " (?=\\ }|;|,|$ )|(?<=\\ })"
260
+ end : " (?=\\ }|;|,)|(?<=\\ })"
254
261
patterns : [
255
262
{
256
263
include : " #comment"
@@ -273,15 +280,21 @@ repository:
273
280
]
274
281
" method-overload-declaration" :
275
282
name : " meta.method.overload.declaration.ts"
276
- match : " \\ b(?:(public|private|protected)\\ s+)?(?:(new)|(?:([a-zA-Z_$][\\ .\\ w$]*)\\ s*(\\ ??)))?\\ s*(?=\\ (|\\ <)"
283
+ match : " \\ b(?:(abstract) \\ s+)? \\ b(?:( public|private|protected) \\ s+)? \\ b(?:(async) \\ s+)?(?:(get|set )\\ s+)?(?:(new)|(?:([a-zA-Z_$][\\ .\\ w$]*)\\ s*(\\ ??)))?\\ s*(?=\\ (|\\ <)"
277
284
captures :
278
285
" 1" :
279
286
name : " storage.modifier.ts"
280
287
" 2" :
281
- name : " keyword.operator .ts"
288
+ name : " storage.modifier .ts"
282
289
" 3" :
283
- name : " entity.name.function .ts"
290
+ name : " storage.modifier .ts"
284
291
" 4" :
292
+ name : " storage.type.property.ts"
293
+ " 5" :
294
+ name : " keyword.operator.ts"
295
+ " 6" :
296
+ name : " entity.name.function.ts"
297
+ " 7" :
285
298
name : " keyword.operator.ts"
286
299
" indexer-declaration" :
287
300
name : " meta.indexer.declaration.ts"
@@ -582,7 +595,7 @@ repository:
582
595
patterns : [
583
596
{
584
597
comment : " Match ES6 \" import from\" syntax"
585
- match : " (import).* (from)\\ s+((['\" ` ]).*\\ 4)"
598
+ match : " \\ b (import)\\ b.* \\ b (from)\\ b \\ s+((['\" ]).*\\ 4)"
586
599
captures :
587
600
" 1" :
588
601
name : " keyword.other.ts"
@@ -593,7 +606,7 @@ repository:
593
606
}
594
607
{
595
608
comment : " Match import = require"
596
- match : " (import)\\ s* ([\\ p{L}\\ p{Nl}$_][\\ p{L}\\ p{Nl}$\\ p{Mn}\\ p{Mc}\\ p{Nd}\\ p{Pc}\\ x{200C}\\ x{200D}]*)\\ s*=\\ s*(require)\\ s*\\ ((.*)\\ )"
609
+ match : " \\ b (import)\\ s+ ([\\ p{L}\\ p{Nl}$_][\\ p{L}\\ p{Nl}$\\ p{Mn}\\ p{Mc}\\ p{Nd}\\ p{Pc}\\ x{200C}\\ x{200D}]*)\\ s*=\\ s*(require)\\ s*\\ ((.*)\\ )"
597
610
captures :
598
611
" 1" :
599
612
name : " keyword.other.ts"
@@ -677,6 +690,9 @@ repository:
677
690
{
678
691
include : " #new-expr"
679
692
}
693
+ {
694
+ include : " #switch-statement"
695
+ }
680
696
{
681
697
include : " #block"
682
698
}
@@ -702,12 +718,57 @@ repository:
702
718
include : " #function-call"
703
719
}
704
720
{
705
- include : " #switch- case"
721
+ include : " #case-clause "
706
722
}
707
723
{
708
724
include : " #control-statement"
709
725
}
710
726
]
727
+ " switch-expression" :
728
+ name : " switch-expression.expr.ts"
729
+ begin : " \\ b(switch)\\ b\\ s*\\ ("
730
+ beginCaptures :
731
+ " 1" :
732
+ name : " keyword.operator.ts"
733
+ end : " \\ )"
734
+ patterns : [
735
+ {
736
+ include : " #expression"
737
+ }
738
+ ]
739
+ " switch-block" :
740
+ name : " switch-block.expr.ts"
741
+ begin : " {"
742
+ end : " (?=\\ })"
743
+ patterns : [
744
+ {
745
+ include : " #expression"
746
+ }
747
+ ]
748
+ " case-clause" :
749
+ name : " case-clause.expr.ts"
750
+ begin : " (?<!\\ .)\\ b(case|default)\\ b"
751
+ beginCaptures :
752
+ " 1" :
753
+ name : " keyword.control.ts"
754
+ end : " :"
755
+ patterns : [
756
+ {
757
+ include : " #expression"
758
+ }
759
+ ]
760
+ " switch-statement" :
761
+ name : " switch-statement.expr.ts"
762
+ begin : " (?=\\ bswitch\\ b\\ s*\\ ()"
763
+ end : " }"
764
+ patterns : [
765
+ {
766
+ include : " #switch-expression"
767
+ }
768
+ {
769
+ include : " #switch-block"
770
+ }
771
+ ]
711
772
" for-in-simple" :
712
773
name : " forin.expr.ts"
713
774
match : " (?<=\\ ()\\ s*\\ b(var|let|const)\\ s+([a-zA-Z_$][\\ w$]*)\\ s+(in|of)\\ b"
@@ -770,7 +831,7 @@ repository:
770
831
]
771
832
" expression-operator" :
772
833
name : " keyword.operator.ts"
773
- match : " =>|\\ b(delete|export|import|in|instanceof|module|namespace|new|typeof|void)\\ b"
834
+ match : " =>|\\ b(delete|export|import|from| in|instanceof|module|namespace|new|typeof|void|as )\\ b"
774
835
" arithmetic-operator" :
775
836
name : " keyword.operator.arithmetic.ts"
776
837
match : " \\ *|/|\\ -\\ -|\\ -|\\ +\\ +|\\ +|%"
0 commit comments