@@ -12,13 +12,26 @@ patterns: [
1212repository :
1313 " var-expr" :
1414 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 )"
1616 beginCaptures :
1717 " 1" :
1818 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" :
2033 name : " variable.ts"
21- end : " (?=$|[;= \\ } \\ {])|(?<= \\ } )"
34+ end : " (?=$|[;,] )"
2235 patterns : [
2336 {
2437 include : " #type-annotation"
@@ -29,22 +42,13 @@ repository:
2942 {
3043 include : " #comment"
3144 }
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 : [
4445 {
4546 include : " #expression"
4647 }
4748 ]
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"
4852 declaration :
4953 name : " meta.declaration.ts"
5054 patterns : [
@@ -136,6 +140,9 @@ repository:
136140 {
137141 include : " #comment"
138142 }
143+ {
144+ include : " #object-heritage"
145+ }
139146 {
140147 include : " #type-parameters"
141148 }
@@ -250,7 +257,7 @@ repository:
250257 name : " entity.name.function.ts"
251258 " 7" :
252259 name : " keyword.operator.ts"
253- end : " (?=\\ }|;|,|$ )|(?<=\\ })"
260+ end : " (?=\\ }|;|,)|(?<=\\ })"
254261 patterns : [
255262 {
256263 include : " #comment"
@@ -273,15 +280,21 @@ repository:
273280 ]
274281 " method-overload-declaration" :
275282 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*(?=\\ (|\\ <)"
277284 captures :
278285 " 1" :
279286 name : " storage.modifier.ts"
280287 " 2" :
281- name : " keyword.operator .ts"
288+ name : " storage.modifier .ts"
282289 " 3" :
283- name : " entity.name.function .ts"
290+ name : " storage.modifier .ts"
284291 " 4" :
292+ name : " storage.type.property.ts"
293+ " 5" :
294+ name : " keyword.operator.ts"
295+ " 6" :
296+ name : " entity.name.function.ts"
297+ " 7" :
285298 name : " keyword.operator.ts"
286299 " indexer-declaration" :
287300 name : " meta.indexer.declaration.ts"
@@ -582,7 +595,7 @@ repository:
582595 patterns : [
583596 {
584597 comment : " Match ES6 \" import from\" syntax"
585- match : " (import).* (from)\\ s+((['\" ` ]).*\\ 4)"
598+ match : " \\ b (import)\\ b.* \\ b (from)\\ b \\ s+((['\" ]).*\\ 4)"
586599 captures :
587600 " 1" :
588601 name : " keyword.other.ts"
@@ -593,7 +606,7 @@ repository:
593606 }
594607 {
595608 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*\\ ((.*)\\ )"
597610 captures :
598611 " 1" :
599612 name : " keyword.other.ts"
@@ -677,6 +690,9 @@ repository:
677690 {
678691 include : " #new-expr"
679692 }
693+ {
694+ include : " #switch-statement"
695+ }
680696 {
681697 include : " #block"
682698 }
@@ -702,12 +718,57 @@ repository:
702718 include : " #function-call"
703719 }
704720 {
705- include : " #switch- case"
721+ include : " #case-clause "
706722 }
707723 {
708724 include : " #control-statement"
709725 }
710726 ]
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+ ]
711772 " for-in-simple" :
712773 name : " forin.expr.ts"
713774 match : " (?<=\\ ()\\ s*\\ b(var|let|const)\\ s+([a-zA-Z_$][\\ w$]*)\\ s+(in|of)\\ b"
@@ -770,7 +831,7 @@ repository:
770831 ]
771832 " expression-operator" :
772833 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"
774835 " arithmetic-operator" :
775836 name : " keyword.operator.arithmetic.ts"
776837 match : " \\ *|/|\\ -\\ -|\\ -|\\ +\\ +|\\ +|%"
0 commit comments