@@ -78,6 +78,7 @@ repository:
7878 - include : ' #comment'
7979 - include : ' #literal'
8080 - include : ' #function-declaration'
81+ - include : ' #class-or-interface-declaration'
8182 - include : ' #paren-expression'
8283 - include : ' #ternary-expression'
8384 - include : ' #cast'
@@ -119,6 +120,7 @@ repository:
119120 - include : ' #enum-declaration'
120121 - include : ' #import-equals-declaration'
121122 - include : ' #import-declaration'
123+ - include : ' #export-declaration'
122124 # TODO: change this to actual declarations of export, import, namespace
123125 - include : ' #storage-keyword'
124126
@@ -129,7 +131,7 @@ repository:
129131 ' 1 ' : { name: keyword.control.export.ts }
130132 ' 2 ' : { name: storage.type.type.ts }
131133 ' 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 )
133135 patterns :
134136 - include : ' #comment'
135137 - include : ' #type-parameters'
@@ -175,27 +177,56 @@ repository:
175177 - include : ' #comment'
176178 - match : \b([a-zA-Z_$][\w$]*)\s*(\.)
177179 captures :
178- ' 1 ' : { name: entity.name.module.ts }
180+ ' 1 ' : { name: entity.name.type. module.ts }
179181 ' 2 ' : { name: punctuation.accessor.ts }
180182 - name : variable.other.readwrite.ts
181183 match : \b([a-zA-Z_$][\w$]*)\b
182184
183185 import-declaration :
184186 name : meta.import.ts
185- begin : (?:(\bexport)\s+)?(?<!\.)\b (import)(?!\s*:)\b
187+ begin : (?:(\bexport)\s+)?\b (?<!\.)(import)(?!\s*:)\b
186188 beginCaptures :
187189 ' 1 ' : { name: keyword.control.export.ts }
188190 ' 2 ' : { name: keyword.control.import.ts }
189191 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 :
190221 patterns :
191222 - include : ' #comment'
192223 - include : ' #string'
193- - include : ' #import-block'
224+ - include : ' #import-export- block'
194225 - name : keyword.control.from.ts
195226 match : \bfrom\b
196- - include : ' #import-clause'
227+ - include : ' #import-export- clause'
197228
198- import-block :
229+ import-export- block :
199230 name : meta.block.ts
200231 begin : \{
201232 beginCaptures :
@@ -204,24 +235,24 @@ repository:
204235 endCaptures :
205236 ' 0 ' : { name: punctuation.definition.block.ts }
206237 patterns :
207- - include : ' #import-clause'
238+ - include : ' #import-export- clause'
208239
209- import-clause :
240+ import-export- clause :
210241 patterns :
211242 - include : ' #comment'
212243 - comment : (default|*|name) as alias
213244 match : ' (?x) (?: \b(default)\b | (\*) | \b([a-zA-Z_$][a-zA-Z_$0-9]*)\b) \s* (\b
214245 as \b) \s* (?: (\b default \b | \*) | \b([a-zA-Z_$][a-zA-Z_$0-9]*)\b)'
215246 captures :
216247 ' 1 ' : { name: keyword.control.default.ts }
217- ' 2 ' : { name: constant.language.import-all.ts }
248+ ' 2 ' : { name: constant.language.import-export- all.ts }
218249 ' 3 ' : { name: variable.other.readwrite.ts }
219250 ' 4 ' : { name: keyword.control.as.ts }
220251 ' 5 ' : { name: invalid.illegal.ts }
221252 ' 6 ' : { name: variable.other.readwrite.alias.ts }
222253 - name : meta.delimiter.object.comma.ts
223254 match : ' ,'
224- - name : constant.language.import-all.ts
255+ - name : constant.language.import-export- all.ts
225256 match : \*
226257 - name : keyword.control.default.ts
227258 match : \b(default)\b
@@ -741,7 +772,7 @@ repository:
741772
742773 storage-keyword :
743774 name : storage.type.ts
744- match : \b(var|let|function|const| module|namespace)\b
775+ match : \b(module|namespace)\b
745776
746777 paren-expression :
747778 begin : \(
0 commit comments