@@ -78,6 +78,7 @@ repository:
78
78
- include : ' #comment'
79
79
- include : ' #literal'
80
80
- include : ' #function-declaration'
81
+ - include : ' #class-or-interface-declaration'
81
82
- include : ' #paren-expression'
82
83
- include : ' #ternary-expression'
83
84
- include : ' #cast'
@@ -119,6 +120,7 @@ repository:
119
120
- include : ' #enum-declaration'
120
121
- include : ' #import-equals-declaration'
121
122
- include : ' #import-declaration'
123
+ - include : ' #export-declaration'
122
124
# TODO: change this to actual declarations of export, import, namespace
123
125
- include : ' #storage-keyword'
124
126
@@ -129,7 +131,7 @@ repository:
129
131
' 1 ' : { name: keyword.control.export.ts }
130
132
' 2 ' : { name: storage.type.type.ts }
131
133
' 3 ' : { name: entity.name.type.ts }
132
- end : (?=$|[,);>]|var|type|function|class|interface|namespace|enum|declare|export )
134
+ end : (?=$|[,);>]|\bvar\b|\blet\b|\bconst\b|\btype\b|\bfunction\b|\bclass\b|\binterface\b|\bnamespace\b|\bmodule\b|\bimport\b|\benum\b|\bdeclare\b|\bexport\b|\babstract\b|\basync\b )
133
135
patterns :
134
136
- include : ' #comment'
135
137
- include : ' #type-parameters'
@@ -175,27 +177,56 @@ repository:
175
177
- include : ' #comment'
176
178
- match : \b([a-zA-Z_$][\w$]*)\s*(\.)
177
179
captures :
178
- ' 1 ' : { name: entity.name.module.ts }
180
+ ' 1 ' : { name: entity.name.type. module.ts }
179
181
' 2 ' : { name: punctuation.accessor.ts }
180
182
- name : variable.other.readwrite.ts
181
183
match : \b([a-zA-Z_$][\w$]*)\b
182
184
183
185
import-declaration :
184
186
name : meta.import.ts
185
- begin : (?:(\bexport)\s+)?(?<!\.)\b (import)(?!\s*:)\b
187
+ begin : (?:(\bexport)\s+)?\b (?<!\.)(import)(?!\s*:)\b
186
188
beginCaptures :
187
189
' 1 ' : { name: keyword.control.export.ts }
188
190
' 2 ' : { name: keyword.control.import.ts }
189
191
end : (?=;|$)
192
+ patterns :
193
+ - include : ' #import-export-declaration'
194
+
195
+ export-declaration :
196
+ patterns :
197
+ - match : \b(?<!\.)(export)\s+(as)\s+(namespace)\s+([a-zA-Z_$][\w$]*)
198
+ captures :
199
+ ' 1 ' : { name: keyword.control.export.ts }
200
+ ' 2 ' : { name: keyword.control.as.ts }
201
+ ' 3 ' : { name: storage.type.namespace.ts }
202
+ ' 4 ' : { name: entity.name.type.module.ts }
203
+ - name : meta.export.default.ts
204
+ begin : \b(?<!\.)(export)(?:(?:\s*(=))|(?:\s+(default)\s+))
205
+ beginCaptures :
206
+ ' 1 ' : { name: keyword.control.export.ts }
207
+ ' 2 ' : { name: keyword.operator.assignment.ts }
208
+ ' 3 ' : { name: keyword.control.default.ts }
209
+ end : (?=;|\bexport\b|\bfunction\b|\bclass\b|\binterface\b|\blet\b|\bvar\b|\bconst\b|\bimport\b|\benum\b|\bnamespace\b|\bmodule\b|\btype\b|\babstract\b|\bdeclare\b|\basync\b|$)
210
+ patterns :
211
+ - include : ' #expression'
212
+ - name : meta.export.ts
213
+ begin : \b(?<!\.)(export)(?!\s*:)\b
214
+ beginCaptures :
215
+ ' 0 ' : { name: keyword.control.export.ts }
216
+ end : (?=;|\bexport\b|\bfunction\b|\bclass\b|\binterface\b|\blet\b|\bvar\b|\bconst\b|\bimport\b|\benum\b|\bnamespace\b|\bmodule\b|\btype\b|\babstract\b|\bdeclare\b|\basync\b|$)
217
+ patterns :
218
+ - include : ' #import-export-declaration'
219
+
220
+ import-export-declaration :
190
221
patterns :
191
222
- include : ' #comment'
192
223
- include : ' #string'
193
- - include : ' #import-block'
224
+ - include : ' #import-export- block'
194
225
- name : keyword.control.from.ts
195
226
match : \bfrom\b
196
- - include : ' #import-clause'
227
+ - include : ' #import-export- clause'
197
228
198
- import-block :
229
+ import-export- block :
199
230
name : meta.block.ts
200
231
begin : \{
201
232
beginCaptures :
@@ -204,24 +235,24 @@ repository:
204
235
endCaptures :
205
236
' 0 ' : { name: punctuation.definition.block.ts }
206
237
patterns :
207
- - include : ' #import-clause'
238
+ - include : ' #import-export- clause'
208
239
209
- import-clause :
240
+ import-export- clause :
210
241
patterns :
211
242
- include : ' #comment'
212
243
- comment : (default|*|name) as alias
213
244
match : ' (?x) (?: \b(default)\b | (\*) | \b([a-zA-Z_$][a-zA-Z_$0-9]*)\b) \s* (\b
214
245
as \b) \s* (?: (\b default \b | \*) | \b([a-zA-Z_$][a-zA-Z_$0-9]*)\b)'
215
246
captures :
216
247
' 1 ' : { name: keyword.control.default.ts }
217
- ' 2 ' : { name: constant.language.import-all.ts }
248
+ ' 2 ' : { name: constant.language.import-export- all.ts }
218
249
' 3 ' : { name: variable.other.readwrite.ts }
219
250
' 4 ' : { name: keyword.control.as.ts }
220
251
' 5 ' : { name: invalid.illegal.ts }
221
252
' 6 ' : { name: variable.other.readwrite.alias.ts }
222
253
- name : meta.delimiter.object.comma.ts
223
254
match : ' ,'
224
- - name : constant.language.import-all.ts
255
+ - name : constant.language.import-export- all.ts
225
256
match : \*
226
257
- name : keyword.control.default.ts
227
258
match : \b(default)\b
@@ -741,7 +772,7 @@ repository:
741
772
742
773
storage-keyword :
743
774
name : storage.type.ts
744
- match : \b(var|let|function|const| module|namespace)\b
775
+ match : \b(module|namespace)\b
745
776
746
777
paren-expression :
747
778
begin : \(
0 commit comments