@@ -40,11 +40,7 @@ contexts:
40
40
41
41
tag-attributes :
42
42
- meta_prepend : true
43
- - include : tag-ng-template-attribute
44
- - include : tag-ng-reference-attribute
45
- - include : tag-ng-bind-attribute
46
- - include : tag-ng-on-attribute
47
- - include : tag-ng-bindon-attribute
43
+ - include : ng-directives
48
44
49
45
# ##[ ANGULAR EXPRESSIONS ]#####################################################
50
46
@@ -61,60 +57,91 @@ contexts:
61
57
- include : ng-strings
62
58
- include : ng-variables
63
59
64
- # ##[ ANGULAR TAG ATTRIBUTES ] ##################################################
60
+ # ##[ ANGULAR DIRECTIVES ]#### ##################################################
65
61
66
- tag-ng-template-attribute :
67
- - match : (\*)([a-zA-Z]\w*)
68
- scope : meta.attribute-with-value.template.html
62
+ ng-directives :
63
+ # template
64
+ - match : (\*)(?:(ngIf)|(ngFor)|(ngSwitch(?:Case|Default))|([a-zA-Z]\w*))
65
+ scope : meta.directive.template.ngx
69
66
captures :
70
- 1 : punctuation.definition.template.html
71
- 2 : entity.other.attribute-name.template.html
72
- push :
73
- - tag-event-attribute-meta
74
- - tag-event- attribute-assignment
75
-
76
- tag-ng- reference-attribute :
67
+ 1 : punctuation.definition.template.ngx
68
+ 2 : keyword.control.conditional.if.ngx
69
+ 3 : keyword.control.loop.for.ngx
70
+ 4 : keyword.control.conditional.case.ngx
71
+ 5 : entity.other. attribute-name.template.ngx
72
+ push : ng-directive-assignment
73
+ # reference
77
74
- match : (\#)([a-zA-Z]\w*)
78
- scope : meta.attribute .reference.html
75
+ scope : meta.directive .reference.ngx
79
76
captures :
80
- 1 : punctuation.definition.reference.html
81
- 2 : entity.other.attribute-name.reference.html
82
- push :
83
- - tag-event-attribute-meta
84
- - tag-event-attribute-assignment
85
-
86
- tag-ng-bind-attribute :
87
- - match : (\[)([a-zA-Z@][!\w.-]*)(\])
88
- scope : meta.attribute-with-value.bind.html
77
+ 1 : punctuation.definition.reference.ngx
78
+ 2 : entity.other.attribute-name.reference.ngx
79
+ push : ng-directive-assignment
80
+ # bind
81
+ - match : (\[)(?:(ngSwitch)|([a-zA-Z@][!\w.-]*))(\])
82
+ scope : meta.directive.bind.ngx
89
83
captures :
90
- 1 : punctuation.section.bind.begin.html
91
- 2 : entity.other.attribute-name.bind.html
92
- 3 : punctuation.section.bind.end.html
93
- push :
94
- - tag-event-attribute-meta
95
- - tag-event-attribute-assignment
96
-
97
- tag-ng-on-attribute :
84
+ 1 : punctuation.definition.bind.begin.ngx
85
+ 2 : keyword.control.conditional.switch.ngx
86
+ 3 : entity.other.attribute-name.bind.ngx
87
+ 4 : punctuation.definition.bind.end.ngx
88
+ push : ng-directive-assignment
89
+ # on
98
90
- match : (\()([a-zA-Z@][\w:.]*)(\))
99
- scope : meta.attribute-with-value .on.html
91
+ scope : meta.directive .on.ngx
100
92
captures :
101
- 1 : punctuation.section.on.begin.html
102
- 2 : entity.other.attribute-name.on.html
103
- 3 : punctuation.section.on.end.html
104
- push :
105
- - tag-event-attribute-meta
106
- - tag-event-attribute-assignment
107
-
108
- tag-ng-bindon-attribute :
93
+ 1 : punctuation.definition.on.begin.ngx
94
+ 2 : entity.other.attribute-name.on.ngx
95
+ 3 : punctuation.definition.on.end.ngx
96
+ push : ng-directive-assignment
97
+ # bindon
109
98
- match : (\[\()([a-zA-Z][\w.]*)(\)\])
110
- scope : meta.attribute-with-value .bindon.html
99
+ scope : meta.directive .bindon.ngx
111
100
captures :
112
- 1 : punctuation.section.bindon.begin.html
113
- 2 : entity.other.attribute-name.bindon.html
114
- 3 : punctuation.section.bindon.end.html
115
- push :
116
- - tag-event-attribute-meta
117
- - tag-event-attribute-assignment
101
+ 1 : punctuation.definition.bindon.begin.ngx
102
+ 2 : entity.other.attribute-name.bindon.ngx
103
+ 3 : punctuation.definition.bindon.end.ngx
104
+ push : ng-directive-assignment
105
+
106
+ ng-directive-assignment :
107
+ - meta_include_prototype : false
108
+ - meta_content_scope : meta.directive.ngx
109
+ - match : =
110
+ scope : meta.directive.ngx punctuation.separator.key-value.ngx
111
+ set :
112
+ - immediately-pop # workaround https://github.com/sublimehq/sublime_text/issues/4069
113
+ - ng-directive-value
114
+ - include : else-pop
115
+
116
+ ng-directive-value :
117
+ - meta_content_scope : meta.directive.value.ngx
118
+ - match : \"
119
+ scope : meta.string.ngx string.quoted.double.ngx punctuation.definition.string.begin.ngx
120
+ embed : ng-directive-expressions
121
+ embed_scope : meta.directive.value.ngx meta.string.ngx meta.interpolation.ngx source.ngx.embedded.html
122
+ escape : \"
123
+ escape_captures :
124
+ 0 : meta.string.ngx string.quoted.double.ngx punctuation.definition.string.end.ngx
125
+ pop : 1
126
+ - match : \'
127
+ scope : meta.string.ngx string.quoted.single.ngx punctuation.definition.string.begin.ngx
128
+ embed : ng-directive-expressions
129
+ embed_scope : meta.directive.value.ngx meta.string.ngx meta.interpolation.ngx source.ngx.embedded.html
130
+ escape : \'
131
+ escape_captures :
132
+ 0 : meta.string.ngx string.quoted.single.ngx punctuation.definition.string.end.ngx
133
+ pop : 1
134
+ - include : else-pop
135
+
136
+ ng-directive-expressions :
137
+ - match : (trackBy)\s*(:)
138
+ captures :
139
+ 1 : keyword.control.flow.ngx
140
+ 2 : punctuation.separator.key-value.ngx
141
+ - include : ng-conditional-keywords
142
+ - include : ng-defer-keywords
143
+ - include : ng-for-keywords
144
+ - include : ng-expressions
118
145
119
146
# ##[ ANGULAR DECLARATIONS ]####################################################
120
147
@@ -240,9 +267,12 @@ contexts:
240
267
- match : \)
241
268
scope : punctuation.section.group.end.ngx
242
269
pop : 1
270
+ - include : ng-conditional-keywords
271
+ - include : ng-expressions
272
+
273
+ ng-conditional-keywords :
243
274
- match : as{{ident_break}}
244
275
scope : keyword.operator.assignment.as.ngx
245
- - include : ng-expressions
246
276
247
277
ng-defer-group :
248
278
- meta_include_prototype : false
@@ -256,15 +286,22 @@ contexts:
256
286
- match : \)
257
287
scope : punctuation.section.group.end.ngx
258
288
pop : 1
259
- - match : (?:idle|viewport|interaction|hover|immediatetimer){{ident_break}}
260
- scope : constant.language.event.ngx
289
+ - include : ng-defer-keywords
290
+ - include : ng-expressions
291
+
292
+ ng-defer-keywords :
261
293
- match : (?:prefetch on|on|prefetch when|when){{ident_break}}
262
294
scope : keyword.control.flow.ngx
295
+ push : ng-defer-event
263
296
- match : (minimum|after)(\?)
264
297
captures :
265
298
1 : keyword.operator.word.ngx
266
299
2 : keyword.control.question.ngx
267
- - include : ng-expressions
300
+
301
+ ng-defer-event :
302
+ - match : (?:idle|viewport|interaction|hover|immediatetimer){{ident_break}}
303
+ scope : constant.language.event.ngx
304
+ - include : else-pop
268
305
269
306
ng-for-group :
270
307
- meta_include_prototype : false
@@ -278,13 +315,16 @@ contexts:
278
315
- match : \)
279
316
scope : punctuation.section.group.end.ngx
280
317
pop : 1
318
+ - include : ng-for-keywords
319
+ - include : ng-expressions
320
+
321
+ ng-for-keywords :
281
322
- match : track{{ident_break}}
282
323
scope : keyword.control.flow.ngx
283
324
- match : let{{ident_break}}
284
325
scope : keyword.declation.variable.ngx
285
326
- match : of{{ident_break}}
286
327
scope : keyword.operator.iteration.ngx
287
- - include : ng-expressions
288
328
289
329
# ##[ ANGULAR INTERPOLATIONS ]##################################################
290
330
0 commit comments