Skip to content

Commit 2061bba

Browse files
deathaxeskyronic
authored andcommitted
Fix meta-attribute scopes in vue-directives
All `v-foo` directive attributes have not been scoped `meta-attribute-with-value` which effects syntax highlighting when using certain color schemes. That's fixed by this commit. Note: It appears YAMLmacros sorts generated output randomly, so many changes of the generated sublime-syntax file can be ignored.
1 parent 27064cd commit 2061bba

File tree

3 files changed

+95
-56
lines changed

3 files changed

+95
-56
lines changed

Vue Component.sublime-syntax

Lines changed: 56 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -101,37 +101,46 @@ contexts:
101101
vue-directive:
102102
- match: (?=v-)
103103
push:
104+
- vue-directive-meta
104105
- vue-directive-assignment
105106
- tag-generic-attribute-name
106107
- match: (?::|@)
107108
scope: punctuation.definition.attribute.html
108109
push:
110+
- vue-directive-meta
109111
- vue-directive-assignment
110112
- tag-generic-attribute-name
111113

114+
vue-directive-meta:
115+
- meta_include_prototype: false
116+
- meta_scope: meta.attribute-with-value.directive.html
117+
- include: immediately-pop
118+
112119
vue-directive-assignment:
113-
- match: '='
120+
- match: =
114121
scope: punctuation.separator.key-value.html
115122
set: vue-directive-value
116123
- include: else-pop
117124

118125
vue-directive-value:
119-
- match: '"'
126+
- match: \"
120127
scope: meta.string.html string.quoted.double.html punctuation.definition.string.begin.html
121-
embed: scope:source.js
122128
pop: true
123-
embed_scope: meta.string.html source.js.embedded.vue
124-
escape: '"'
129+
embed: scope:source.js
130+
embed_scope: meta.string.html meta.interpolation.html source.js.embedded.html
131+
escape: \"
125132
escape_captures:
126-
0: meta.string.html string.quoted.double.html punctuation.definition.string.end.html
127-
- match: "'"
133+
0: meta.attribute-with-value.directive.html meta.string.html string.quoted.double.html
134+
punctuation.definition.string.end.html
135+
- match: \'
128136
scope: meta.string.html string.quoted.single.html punctuation.definition.string.begin.html
129-
embed: scope:source.js
130137
pop: true
131-
embed_scope: meta.string.html source.js.embedded.vue
132-
escape: "'"
138+
embed: scope:source.js
139+
embed_scope: meta.string.html meta.interpolation.html source.js.embedded.html
140+
escape: \'
133141
escape_captures:
134-
0: meta.string.html string.quoted.single.html punctuation.definition.string.end.html
142+
0: meta.attribute-with-value.directive.html meta.string.html string.quoted.single.html
143+
punctuation.definition.string.end.html
135144
- include: else-pop
136145

137146
###[ STYLE TAG ]##############################################################
@@ -203,13 +212,13 @@ contexts:
203212
scope: punctuation.definition.tag.end.html
204213
set:
205214
- - include: style-close-tag
206-
- - escape_captures:
215+
- - embed_scope: source.sass.embedded.html
216+
match: '{{style_content_begin}}'
217+
escape_captures:
207218
1: source.sass.embedded.html
208219
2: comment.block.html punctuation.definition.comment.end.html
209220
3: source.sass.embedded.html
210221
4: comment.block.html punctuation.definition.comment.end.html
211-
match: '{{style_content_begin}}'
212-
embed_scope: source.sass.embedded.html
213222
captures:
214223
1: comment.block.html punctuation.definition.comment.begin.html
215224
pop: 1
@@ -225,13 +234,13 @@ contexts:
225234
scope: punctuation.definition.tag.end.html
226235
set:
227236
- - include: style-close-tag
228-
- - escape_captures:
237+
- - embed_scope: source.scss.embedded.html
238+
match: '{{style_content_begin}}'
239+
escape_captures:
229240
1: source.scss.embedded.html
230241
2: comment.block.html punctuation.definition.comment.end.html
231242
3: source.scss.embedded.html
232243
4: comment.block.html punctuation.definition.comment.end.html
233-
match: '{{style_content_begin}}'
234-
embed_scope: source.scss.embedded.html
235244
captures:
236245
1: comment.block.html punctuation.definition.comment.begin.html
237246
pop: 1
@@ -247,13 +256,13 @@ contexts:
247256
scope: punctuation.definition.tag.end.html
248257
set:
249258
- - include: style-close-tag
250-
- - escape_captures:
259+
- - embed_scope: source.stylus.embedded.html
260+
match: '{{style_content_begin}}'
261+
escape_captures:
251262
1: source.stylus.embedded.html
252263
2: comment.block.html punctuation.definition.comment.end.html
253264
3: source.stylus.embedded.html
254265
4: comment.block.html punctuation.definition.comment.end.html
255-
match: '{{style_content_begin}}'
256-
embed_scope: source.stylus.embedded.html
257266
captures:
258267
1: comment.block.html punctuation.definition.comment.begin.html
259268
pop: 1
@@ -269,13 +278,13 @@ contexts:
269278
scope: punctuation.definition.tag.end.html
270279
set:
271280
- - include: style-close-tag
272-
- - escape_captures:
281+
- - embed_scope: source.sss.embedded.html
282+
match: '{{style_content_begin}}'
283+
escape_captures:
273284
1: source.sss.embedded.html
274285
2: comment.block.html punctuation.definition.comment.end.html
275286
3: source.sss.embedded.html
276287
4: comment.block.html punctuation.definition.comment.end.html
277-
match: '{{style_content_begin}}'
278-
embed_scope: source.sss.embedded.html
279288
captures:
280289
1: comment.block.html punctuation.definition.comment.begin.html
281290
pop: 1
@@ -291,13 +300,13 @@ contexts:
291300
scope: punctuation.definition.tag.end.html
292301
set:
293302
- - include: style-close-tag
294-
- - escape_captures:
303+
- - embed_scope: source.postcss.embedded.html
304+
match: '{{style_content_begin}}'
305+
escape_captures:
295306
1: source.postcss.embedded.html
296307
2: comment.block.html punctuation.definition.comment.end.html
297308
3: source.postcss.embedded.html
298309
4: comment.block.html punctuation.definition.comment.end.html
299-
match: '{{style_content_begin}}'
300-
embed_scope: source.postcss.embedded.html
301310
captures:
302311
1: comment.block.html punctuation.definition.comment.begin.html
303312
pop: 1
@@ -313,13 +322,13 @@ contexts:
313322
scope: punctuation.definition.tag.end.html
314323
set:
315324
- - include: style-close-tag
316-
- - escape_captures:
325+
- - embed_scope: source.less.embedded.html
326+
match: '{{style_content_begin}}'
327+
escape_captures:
317328
1: source.less.embedded.html
318329
2: comment.block.html punctuation.definition.comment.end.html
319330
3: source.less.embedded.html
320331
4: comment.block.html punctuation.definition.comment.end.html
321-
match: '{{style_content_begin}}'
322-
embed_scope: source.less.embedded.html
323332
captures:
324333
1: comment.block.html punctuation.definition.comment.begin.html
325334
pop: 1
@@ -402,13 +411,13 @@ contexts:
402411
scope: punctuation.definition.tag.end.html
403412
set:
404413
- - include: script-close-tag
405-
- - escape_captures:
414+
- - embed_scope: source.coffee.embedded.html
415+
match: '{{script_content_begin}}'
416+
escape_captures:
406417
1: source.coffee.embedded.html
407418
2: comment.block.html punctuation.definition.comment.end.html
408419
3: source.coffee.embedded.html
409420
4: comment.block.html punctuation.definition.comment.end.html
410-
match: '{{script_content_begin}}'
411-
embed_scope: source.coffee.embedded.html
412421
captures:
413422
1: comment.block.html punctuation.definition.comment.begin.html
414423
pop: 1
@@ -424,13 +433,13 @@ contexts:
424433
scope: punctuation.definition.tag.end.html
425434
set:
426435
- - include: script-close-tag
427-
- - escape_captures:
436+
- - embed_scope: source.livescript.embedded.html
437+
match: '{{script_content_begin}}'
438+
escape_captures:
428439
1: source.livescript.embedded.html
429440
2: comment.block.html punctuation.definition.comment.end.html
430441
3: source.livescript.embedded.html
431442
4: comment.block.html punctuation.definition.comment.end.html
432-
match: '{{script_content_begin}}'
433-
embed_scope: source.livescript.embedded.html
434443
captures:
435444
1: comment.block.html punctuation.definition.comment.begin.html
436445
pop: 1
@@ -446,13 +455,13 @@ contexts:
446455
scope: punctuation.definition.tag.end.html
447456
set:
448457
- - include: script-close-tag
449-
- - escape_captures:
458+
- - embed_scope: source.ts.embedded.html
459+
match: '{{script_content_begin}}'
460+
escape_captures:
450461
1: source.ts.embedded.html
451462
2: comment.block.html punctuation.definition.comment.end.html
452463
3: source.ts.embedded.html
453464
4: comment.block.html punctuation.definition.comment.end.html
454-
match: '{{script_content_begin}}'
455-
embed_scope: source.ts.embedded.html
456465
captures:
457466
1: comment.block.html punctuation.definition.comment.begin.html
458467
pop: 1
@@ -529,13 +538,13 @@ contexts:
529538
scope: punctuation.definition.tag.end.html
530539
set:
531540
- - include: template-close-tag
532-
- - escape_captures:
541+
- - embed_scope: text.jade.embedded.html
542+
match: '{{template_content_begin}}'
543+
escape_captures:
533544
1: text.jade.embedded.html
534545
2: comment.block.html punctuation.definition.comment.end.html
535546
3: text.jade.embedded.html
536547
4: comment.block.html punctuation.definition.comment.end.html
537-
match: '{{template_content_begin}}'
538-
embed_scope: text.jade.embedded.html
539548
captures:
540549
1: comment.block.html punctuation.definition.comment.begin.html
541550
pop: 1
@@ -551,13 +560,13 @@ contexts:
551560
scope: punctuation.definition.tag.end.html
552561
set:
553562
- - include: template-close-tag
554-
- - escape_captures:
563+
- - embed_scope: text.pug.embedded.html
564+
match: '{{template_content_begin}}'
565+
escape_captures:
555566
1: text.pug.embedded.html
556567
2: comment.block.html punctuation.definition.comment.end.html
557568
3: text.pug.embedded.html
558569
4: comment.block.html punctuation.definition.comment.end.html
559-
match: '{{template_content_begin}}'
560-
embed_scope: text.pug.embedded.html
561570
captures:
562571
1: comment.block.html punctuation.definition.comment.begin.html
563572
pop: 1
@@ -573,13 +582,13 @@ contexts:
573582
scope: punctuation.definition.tag.end.html
574583
set:
575584
- - include: template-close-tag
576-
- - escape_captures:
585+
- - embed_scope: text.slm.embedded.html
586+
match: '{{template_content_begin}}'
587+
escape_captures:
577588
1: text.slm.embedded.html
578589
2: comment.block.html punctuation.definition.comment.end.html
579590
3: text.slm.embedded.html
580591
4: comment.block.html punctuation.definition.comment.end.html
581-
match: '{{template_content_begin}}'
582-
embed_scope: text.slm.embedded.html
583592
captures:
584593
1: comment.block.html punctuation.definition.comment.begin.html
585594
pop: 1

Vue Component.sublime-syntax.yaml-macros

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,43 +102,56 @@ contexts:
102102
vue-directive:
103103
- match: (?=v-)
104104
push:
105+
- vue-directive-meta
105106
- vue-directive-assignment
106107
- tag-generic-attribute-name
107108
- match: (?::|@)
108109
scope: punctuation.definition.attribute.html
109110
push:
111+
- vue-directive-meta
110112
- vue-directive-assignment
111113
- tag-generic-attribute-name
112114

115+
vue-directive-meta:
116+
- meta_include_prototype: false
117+
- meta_scope: meta.attribute-with-value.directive.html
118+
- include: immediately-pop
119+
113120
vue-directive-assignment:
114-
- match: '='
121+
- match: =
115122
scope: punctuation.separator.key-value.html
116123
set: vue-directive-value
117124
- include: else-pop
118125

119126
vue-directive-value:
120-
- match: '"'
127+
- match: \"
121128
scope:
122129
meta.string.html string.quoted.double.html
123130
punctuation.definition.string.begin.html
124-
embed: scope:source.js
125131
pop: true
126-
embed_scope: meta.string.html source.js.embedded.vue
127-
escape: '"'
132+
embed: scope:source.js
133+
embed_scope:
134+
meta.string.html meta.interpolation.html
135+
source.js.embedded.html
136+
escape: \"
128137
escape_captures:
129138
0:
139+
meta.attribute-with-value.directive.html
130140
meta.string.html string.quoted.double.html
131141
punctuation.definition.string.end.html
132-
- match: "'"
142+
- match: \'
133143
scope:
134144
meta.string.html string.quoted.single.html
135145
punctuation.definition.string.begin.html
136-
embed: scope:source.js
137146
pop: true
138-
embed_scope: meta.string.html source.js.embedded.vue
139-
escape: "'"
147+
embed: scope:source.js
148+
embed_scope:
149+
meta.string.html meta.interpolation.html
150+
source.js.embedded.html
151+
escape: \'
140152
escape_captures:
141153
0:
154+
meta.attribute-with-value.directive.html
142155
meta.string.html string.quoted.single.html
143156
punctuation.definition.string.end.html
144157
- include: else-pop

tests/syntax_tests_mustage.vue

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,22 @@
3838
// ^^^^^^^^^^^ source.js.embedded.vue
3939
// ^^ punctuation.definition.template.end.html - source.js
4040

41+
<p v-attrib="let i = 0">
42+
// ^^^ meta.tag - meta.attribute-with-value
43+
// ^^^^^^^^^ meta.tag meta.attribute-with-value.directive.html - meta.string
44+
// ^ meta.tag meta.attribute-with-value.directive.html meta.string.html - meta.interpolation
45+
// ^^^^^^^^^ meta.tag meta.attribute-with-value.directive.html meta.string.html meta.interpolation.html source.js.embedded.html
46+
// ^ meta.tag meta.attribute-with-value.directive.html meta.string.html - meta.interpolation
47+
// ^ meta.tag - meta.attribute-with-value
48+
// ^ - meta.tag
49+
50+
<p v-attrib='let i = 0'>
51+
// ^^^ meta.tag - meta.attribute-with-value
52+
// ^^^^^^^^^ meta.tag meta.attribute-with-value.directive.html - meta.string
53+
// ^ meta.tag meta.attribute-with-value.directive.html meta.string.html - meta.interpolation
54+
// ^^^^^^^^^ meta.tag meta.attribute-with-value.directive.html meta.string.html meta.interpolation.html source.js.embedded.html
55+
// ^ meta.tag meta.attribute-with-value.directive.html meta.string.html - meta.interpolation
56+
// ^ meta.tag - meta.attribute-with-value
57+
// ^ - meta.tag
4158

4259
</html>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy