@@ -26,6 +26,7 @@ variables:
26
26
lookBehindOf : ' ^of|{{nonPropertyLookBehind}}of'
27
27
lookBehindTypeof : ' ^typeof|{{nonPropertyLookBehind}}typeof'
28
28
lookBehindCase : ' ^case|{{nonPropertyLookBehind}}case'
29
+ lookBehindImport : ' ^import|{{nonPropertyLookBehind}}import'
29
30
matchingParenthesis : (\(([^\(\)]|(\([^\(\)]*\)))*\))
30
31
matchingBraces : (\{([^\{\}]|(\{[^\{\}]*\}))*\})
31
32
matchingBrackets : (\[([^\[\]]|(\[[^\[\]]*\]))*\])
@@ -35,7 +36,7 @@ variables:
35
36
typeParamersStart : ([_$[:alpha:]]|{{matchingBraces}}|{{matchingParenthesis}}|{{matchingBrackets}})
36
37
typeParameters : (<\s*{{typeParamersStart}}([^=<>]|=[^<]|\<\s*{{typeParamersStart}}([^=<>]|=[^<])*\>)*>\s*)
37
38
# Identifier start | matching braces | matching parenthesis | matching square brackets | matching strings
38
- typeArgumentsStart : ({{typeParamersStart }}|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))
39
+ typeArgumentsStart : ({{identifier }}|{{matchingBraces}}|{{matchingParenthesis}}|{{matchingBrackets}}| (\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,]|=>|&(?!&)|\|(?!\|) ))
39
40
typeArgumentsInnerExpressionPart : ' [^<>\(]|{{matchingParenthesis}}|(?<==)\>'
40
41
typeArguments : ' <\s*{{typeArgumentsStart}}({{typeArgumentsInnerExpressionPart}}|\<\s*{{typeArgumentsStart}}({{typeArgumentsInnerExpressionPart}})*(?!=)\>)*(?!=)>'
41
42
functionCallLookup : \s*(\?\.\s*)?({{typeArguments}}\s*)?\(
@@ -875,6 +876,14 @@ repository:
875
876
' 2 ' : { name: keyword.control.import.ts }
876
877
end : (?=;|$|^)
877
878
patterns :
879
+ - include : ' #comment'
880
+ - include : ' #string'
881
+ - begin : (?<={{lookBehindImport}})(?!\s*["'])
882
+ end : \bfrom\b
883
+ endCaptures :
884
+ ' 0 ' : { name: keyword.control.from.ts }
885
+ patterns :
886
+ - include : ' #import-export-declaration'
878
887
- include : ' #import-export-declaration'
879
888
880
889
export-declaration :
@@ -1012,7 +1021,7 @@ repository:
1012
1021
# object literals
1013
1022
after-operator-block-as-object-literal :
1014
1023
name : meta.objectliteral.ts
1015
- begin : (?<=[=(,\[?+!]|{{lookBehindAwait}}|{{lookBehindReturn}}|{{lookBehindYield}}|{{lookBehindThrow}}|{{lookBehindIn}}|{{lookBehindOf}}|{{lookBehindTypeof}}|&&|\|\||\*)\s*(\{)
1024
+ begin : (?<!\+\+|--)(?< =[=(,\[?+!]|{{lookBehindAwait}}|{{lookBehindReturn}}|{{lookBehindYield}}|{{lookBehindThrow}}|{{lookBehindIn}}|{{lookBehindOf}}|{{lookBehindTypeof}}|&&|\|\||\*)\s*(\{)
1016
1025
beginCaptures :
1017
1026
' 1 ' : { name: punctuation.definition.block.ts }
1018
1027
end : \}
@@ -1199,7 +1208,7 @@ repository:
1199
1208
# If '<' is preceeded by 'return', 'throw', 'yield', or 'await', it's most likely a type assertion
1200
1209
# If '=', '(', ',', ':', or '>' are followed by a '<', it is also likely a type assertion as otherwise it would be a syntax error
1201
1210
# '<=' and '<<=' are cannot be type assertions, as they are assignment operators.
1202
- begin : (?:(?<={{lookBehindReturn}}|{{lookBehindThrow}}|{{lookBehindYield}}|{{lookBehindAwait}}|{{lookBehindDefault}}|[=(,:>*?\&\|\^]|[^_$[:alnum:]](?:\+\+|\-\-)|[^\+]\+|[^\-]\-))\s*(<)(?!<?\=)
1211
+ begin : (?:(?<!\+\+|--)(?< ={{lookBehindReturn}}|{{lookBehindThrow}}|{{lookBehindYield}}|{{lookBehindAwait}}|{{lookBehindDefault}}|[=(,:>*?\&\|\^]|[^_$[:alnum:]](?:\+\+|\-\-)|[^\+]\+|[^\-]\-))\s*(<)(?!<?\=)
1203
1212
beginCaptures :
1204
1213
' 1 ' : { name: meta.brace.angle.ts }
1205
1214
end : (\>)\s*
@@ -1386,11 +1395,13 @@ repository:
1386
1395
- name : support.class.builtin.ts
1387
1396
match : |-
1388
1397
(?x){{startOfIdentifier}}(Array|ArrayBuffer|Atomics|Boolean|DataView|Date|Float32Array|Float64Array|Function|Generator
1389
- |GeneratorFunction|Int8Array|Int16Array|Int32Array|Intl|Map|Number|Object|Promise| Proxy
1398
+ |GeneratorFunction|Int8Array|Int16Array|Int32Array|Intl|Map|Number|Object|Proxy
1390
1399
|Reflect|RegExp|Set|SharedArrayBuffer|SIMD|String|Symbol|TypedArray
1391
1400
|Uint8Array|Uint16Array|Uint32Array|Uint8ClampedArray|WeakMap|WeakSet)\b(?!\$)
1392
1401
- name : support.class.error.ts
1393
1402
match : ' {{startOfIdentifier}}((Eval|Internal|Range|Reference|Syntax|Type|URI)?Error)\b(?!\$)'
1403
+ - name : support.class.promise.ts
1404
+ match : ' {{startOfIdentifier}}(Promise)\b(?!\$)'
1394
1405
# known builtin function calls
1395
1406
- name : support.function.ts
1396
1407
match : |-
@@ -1643,6 +1654,8 @@ repository:
1643
1654
slice|splitText|stepDown|stepUp|stopImmediatePropagation|stopPropagation|
1644
1655
submit|substringData|supports|surroundContents|takeRecords|terminate|toBlob|
1645
1656
toDataURL|toggle|toString|values|write|writeln
1657
+ ) |
1658
+ (all|catch|finally|race|reject|resolve|then
1646
1659
)
1647
1660
)(?=\s*\()
1648
1661
captures:
@@ -1651,6 +1664,7 @@ repository:
1651
1664
'3': { name: support.function.event-handler.ts }
1652
1665
'4': { name: support.function.ts }
1653
1666
'5': { name: support.function.dom.ts }
1667
+ '6': { name: support.function.promise.ts }
1654
1668
1655
1669
identifiers :
1656
1670
patterns :
@@ -1885,10 +1899,9 @@ repository:
1885
1899
1886
1900
# conditional type
1887
1901
type-conditional :
1888
- match : ' {{startOfIdentifier}}({{identifier}})\s+( extends)\s+'
1902
+ match : ' {{startOfIdentifier}}(extends)\s+'
1889
1903
captures :
1890
- ' 1 ' : { name: entity.name.type.ts }
1891
- ' 2 ' : { name: storage.modifier.ts }
1904
+ ' 1 ' : { name: storage.modifier.ts }
1892
1905
1893
1906
# Parenthesis can contain either types and function parameters
1894
1907
# (number | string) or (param: number, param2: string)
@@ -2089,77 +2102,82 @@ repository:
2089
2102
regex :
2090
2103
patterns :
2091
2104
- name : string.regexp.ts
2092
- begin : (?<=[=(:,\[?+!]|{{lookBehindReturn}}|{{lookBehindCase}}|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/(?![\/*])[gimuy ]*(?!\s*[a-zA-Z0-9_$]))
2105
+ begin : (?<!\+\+|--)(?< =[=(:,\[?+!]|{{lookBehindReturn}}|{{lookBehindCase}}|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/(?![\/*])[gimsuy ]*(?!\s*[a-zA-Z0-9_$]))
2093
2106
beginCaptures :
2094
- ' 1 ' : {name: punctuation.definition.string.begin.ts}
2095
- end : (/)([gimuy ]*)
2107
+ ' 1 ' : { name: punctuation.definition.string.begin.ts }
2108
+ end : (/)([gimsuy ]*)
2096
2109
endCaptures :
2097
- ' 1 ' : {name: punctuation.definition.string.end.ts}
2098
- ' 2 ' : {name: keyword.other.ts}
2110
+ ' 1 ' : { name: punctuation.definition.string.end.ts }
2111
+ ' 2 ' : { name: keyword.other.ts}
2099
2112
patterns :
2100
2113
- include : ' #regexp'
2101
2114
# Check if complete regexp syntax
2102
2115
- name : string.regexp.ts
2103
- begin : (?<![_$[:alnum:])\]])\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/(?![\/*])[gimuy ]*(?!\s*[a-zA-Z0-9_$]))
2116
+ begin : (?<![_$[:alnum:])\]]|\+\+|-- )\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/(?![\/*])[gimsuy ]*(?!\s*[a-zA-Z0-9_$]))
2104
2117
beginCaptures :
2105
- ' 0 ' : {name: punctuation.definition.string.begin.ts}
2106
- end : (/)([gimuy ]*)
2118
+ ' 0 ' : { name: punctuation.definition.string.begin.ts }
2119
+ end : (/)([gimsuy ]*)
2107
2120
endCaptures :
2108
- ' 1 ' : {name: punctuation.definition.string.end.ts}
2109
- ' 2 ' : {name: keyword.other.ts}
2121
+ ' 1 ' : { name: punctuation.definition.string.end.ts }
2122
+ ' 2 ' : { name: keyword.other.ts }
2110
2123
patterns :
2111
2124
- include : ' #regexp'
2112
2125
2113
2126
regexp :
2114
2127
patterns :
2115
2128
- name : keyword.control.anchor.regexp
2116
2129
match : \\[bB]|\^|\$
2117
- - name : keyword.other.back-reference.regexp
2118
- match : \\[1-9]\d*
2130
+ - match : \\[1-9]\d*|\\k<([a-zA-Z_$][\w$]*)>
2131
+ captures :
2132
+ ' 0 ' : { name: keyword.other.back-reference.regexp }
2133
+ ' 1 ' : { name: variable.other.regexp }
2119
2134
- name : keyword.operator.quantifier.regexp
2120
2135
match : ' [?+*]|\{(\d+,\d+|\d+,|,\d+|\d+)\}\??'
2121
2136
- name : keyword.operator.or.regexp
2122
2137
match : \|
2123
2138
- name : meta.group.assertion.regexp
2124
- begin : (\()((\?=)|(\?!))
2139
+ begin : (\()((\?=)|(\?!)|(\?<=)|(\?<!) )
2125
2140
beginCaptures :
2126
- ' 1 ' : {name: punctuation.definition.group.regexp}
2127
- ' 2 ' : {name: punctuation.definition.group.assertion.regexp}
2128
- ' 3 ' : {name: meta.assertion.look-ahead.regexp}
2129
- ' 4 ' : {name: meta.assertion.negative-look-ahead.regexp}
2141
+ ' 1 ' : { name: punctuation.definition.group.regexp }
2142
+ ' 2 ' : { name: punctuation.definition.group.assertion.regexp }
2143
+ ' 3 ' : { name: meta.assertion.look-ahead.regexp }
2144
+ ' 4 ' : { name: meta.assertion.negative-look-ahead.regexp }
2145
+ ' 5 ' : { name: meta.assertion.look-behind.regexp }
2146
+ ' 6 ' : { name: meta.assertion.negative-look-behind.regexp }
2130
2147
end : (\))
2131
2148
endCaptures :
2132
- ' 1 ' : {name: punctuation.definition.group.regexp}
2149
+ ' 1 ' : {name: punctuation.definition.group.regexp }
2133
2150
patterns :
2134
2151
- include : ' #regexp'
2135
2152
- name : meta.group.regexp
2136
- begin : \((\?:)?
2153
+ begin : \((?:( \?:)|(?:\?<([a-zA-Z_$][\w$]*)>) )?
2137
2154
beginCaptures :
2138
- ' 0 ' : {name: punctuation.definition.group.regexp}
2139
- ' 1 ' : {name: punctuation.definition.group.no-capture.regexp}
2155
+ ' 0 ' : { name: punctuation.definition.group.regexp }
2156
+ ' 1 ' : { name: punctuation.definition.group.no-capture.regexp }
2157
+ ' 2 ' : { name: variable.other.regexp }
2140
2158
end : \)
2141
2159
endCaptures :
2142
- ' 0 ' : {name: punctuation.definition.group.regexp}
2160
+ ' 0 ' : { name: punctuation.definition.group.regexp }
2143
2161
patterns :
2144
2162
- include : ' #regexp'
2145
2163
- name : constant.other.character-class.set.regexp
2146
2164
begin : (\[)(\^)?
2147
2165
beginCaptures :
2148
- ' 1 ' : {name: punctuation.definition.character-class.regexp}
2149
- ' 2 ' : {name: keyword.operator.negation.regexp}
2166
+ ' 1 ' : { name: punctuation.definition.character-class.regexp }
2167
+ ' 2 ' : { name: keyword.operator.negation.regexp }
2150
2168
end : (\])
2151
2169
endCaptures :
2152
- ' 1 ' : {name: punctuation.definition.character-class.regexp}
2170
+ ' 1 ' : {name: punctuation.definition.character-class.regexp }
2153
2171
patterns :
2154
2172
- name : constant.other.character-class.range.regexp
2155
2173
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])|(\\.))
2156
2174
captures :
2157
- ' 1 ' : {name: constant.character.numeric.regexp}
2158
- ' 2 ' : {name: constant.character.control.regexp}
2159
- ' 3 ' : {name: constant.character.escape.backslash.regexp}
2160
- ' 4 ' : {name: constant.character.numeric.regexp}
2161
- ' 5 ' : {name: constant.character.control.regexp}
2162
- ' 6 ' : {name: constant.character.escape.backslash.regexp}
2175
+ ' 1 ' : { name: constant.character.numeric.regexp }
2176
+ ' 2 ' : { name: constant.character.control.regexp }
2177
+ ' 3 ' : { name: constant.character.escape.backslash.regexp }
2178
+ ' 4 ' : { name: constant.character.numeric.regexp }
2179
+ ' 5 ' : { name: constant.character.control.regexp }
2180
+ ' 6 ' : { name: constant.character.escape.backslash.regexp }
2163
2181
- include : ' #regex-character-class'
2164
2182
- include : ' #regex-character-class'
2165
2183
0 commit comments