Skip to content

Commit a97625d

Browse files
deathaxeskyronic
authored andcommitted
Fix meta.tag and meta.attribute-with-value scope boundaries
This commit adds another fix introduced with ST4114, which addresses the mentioned meta scopes not being applied correctly. They were missing at attribute assignment operators and closing `>` sign.
1 parent e61f3b3 commit a97625d

File tree

5 files changed

+56
-43
lines changed

5 files changed

+56
-43
lines changed

Vue Component.sublime-syntax

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -165,27 +165,27 @@ contexts:
165165
- match: =
166166
scope: punctuation.separator.key-value.html
167167
set:
168-
- meta_content_scope: meta.tag.style.begin.html meta.attribute-with-value.html
168+
- meta_scope: meta.tag.style.begin.html meta.attribute-with-value.html
169169
- include: style-lang-decider
170170
- match: (?=\S)
171171
set: style-css
172172

173173
style-lang-decider:
174174
- match: (?i)(?=sass{{unquoted_attribute_break}}|\'sass\'|"sass")
175175
set:
176-
- - meta_content_scope: meta.tag.style.begin.html
176+
- - meta_scope: meta.tag.style.begin.html
177177
- include: style-common
178178
- match: '>'
179179
scope: punctuation.definition.tag.end.html
180180
set:
181181
- - include: style-close-tag
182-
- - match: '{{style_content_begin}}'
182+
- - embed_scope: source.sass.embedded.html
183183
escape_captures:
184184
1: source.sass.embedded.html
185185
2: comment.block.html punctuation.definition.comment.end.html
186186
3: source.sass.embedded.html
187187
4: comment.block.html punctuation.definition.comment.end.html
188-
embed_scope: source.sass.embedded.html
188+
match: '{{style_content_begin}}'
189189
captures:
190190
1: comment.block.html punctuation.definition.comment.begin.html
191191
pop: 1
@@ -195,19 +195,19 @@ contexts:
195195
- tag-generic-attribute-value
196196
- match: (?i)(?=scss{{unquoted_attribute_break}}|\'scss\'|"scss")
197197
set:
198-
- - meta_content_scope: meta.tag.style.begin.html
198+
- - meta_scope: meta.tag.style.begin.html
199199
- include: style-common
200200
- match: '>'
201201
scope: punctuation.definition.tag.end.html
202202
set:
203203
- - include: style-close-tag
204-
- - match: '{{style_content_begin}}'
204+
- - embed_scope: source.scss.embedded.html
205205
escape_captures:
206206
1: source.scss.embedded.html
207207
2: comment.block.html punctuation.definition.comment.end.html
208208
3: source.scss.embedded.html
209209
4: comment.block.html punctuation.definition.comment.end.html
210-
embed_scope: source.scss.embedded.html
210+
match: '{{style_content_begin}}'
211211
captures:
212212
1: comment.block.html punctuation.definition.comment.begin.html
213213
pop: 1
@@ -217,19 +217,19 @@ contexts:
217217
- tag-generic-attribute-value
218218
- match: (?i)(?=stylus{{unquoted_attribute_break}}|\'stylus\'|"stylus")
219219
set:
220-
- - meta_content_scope: meta.tag.style.begin.html
220+
- - meta_scope: meta.tag.style.begin.html
221221
- include: style-common
222222
- match: '>'
223223
scope: punctuation.definition.tag.end.html
224224
set:
225225
- - include: style-close-tag
226-
- - match: '{{style_content_begin}}'
226+
- - embed_scope: source.stylus.embedded.html
227227
escape_captures:
228228
1: source.stylus.embedded.html
229229
2: comment.block.html punctuation.definition.comment.end.html
230230
3: source.stylus.embedded.html
231231
4: comment.block.html punctuation.definition.comment.end.html
232-
embed_scope: source.stylus.embedded.html
232+
match: '{{style_content_begin}}'
233233
captures:
234234
1: comment.block.html punctuation.definition.comment.begin.html
235235
pop: 1
@@ -239,19 +239,19 @@ contexts:
239239
- tag-generic-attribute-value
240240
- match: (?i)(?=postcss\?parser=sugarss{{unquoted_attribute_break}}|\'postcss\?parser=sugarss\'|"postcss\?parser=sugarss")
241241
set:
242-
- - meta_content_scope: meta.tag.style.begin.html
242+
- - meta_scope: meta.tag.style.begin.html
243243
- include: style-common
244244
- match: '>'
245245
scope: punctuation.definition.tag.end.html
246246
set:
247247
- - include: style-close-tag
248-
- - match: '{{style_content_begin}}'
248+
- - embed_scope: source.sss.embedded.html
249249
escape_captures:
250250
1: source.sss.embedded.html
251251
2: comment.block.html punctuation.definition.comment.end.html
252252
3: source.sss.embedded.html
253253
4: comment.block.html punctuation.definition.comment.end.html
254-
embed_scope: source.sss.embedded.html
254+
match: '{{style_content_begin}}'
255255
captures:
256256
1: comment.block.html punctuation.definition.comment.begin.html
257257
pop: 1
@@ -261,19 +261,19 @@ contexts:
261261
- tag-generic-attribute-value
262262
- match: (?i)(?=postcss{{unquoted_attribute_break}}|\'postcss\'|"postcss")
263263
set:
264-
- - meta_content_scope: meta.tag.style.begin.html
264+
- - meta_scope: meta.tag.style.begin.html
265265
- include: style-common
266266
- match: '>'
267267
scope: punctuation.definition.tag.end.html
268268
set:
269269
- - include: style-close-tag
270-
- - match: '{{style_content_begin}}'
270+
- - embed_scope: source.postcss.embedded.html
271271
escape_captures:
272272
1: source.postcss.embedded.html
273273
2: comment.block.html punctuation.definition.comment.end.html
274274
3: source.postcss.embedded.html
275275
4: comment.block.html punctuation.definition.comment.end.html
276-
embed_scope: source.postcss.embedded.html
276+
match: '{{style_content_begin}}'
277277
captures:
278278
1: comment.block.html punctuation.definition.comment.begin.html
279279
pop: 1
@@ -283,19 +283,19 @@ contexts:
283283
- tag-generic-attribute-value
284284
- match: (?i)(?=less{{unquoted_attribute_break}}|\'less\'|"less")
285285
set:
286-
- - meta_content_scope: meta.tag.style.begin.html
286+
- - meta_scope: meta.tag.style.begin.html
287287
- include: style-common
288288
- match: '>'
289289
scope: punctuation.definition.tag.end.html
290290
set:
291291
- - include: style-close-tag
292-
- - match: '{{style_content_begin}}'
292+
- - embed_scope: source.less.embedded.html
293293
escape_captures:
294294
1: source.less.embedded.html
295295
2: comment.block.html punctuation.definition.comment.end.html
296296
3: source.less.embedded.html
297297
4: comment.block.html punctuation.definition.comment.end.html
298-
embed_scope: source.less.embedded.html
298+
match: '{{style_content_begin}}'
299299
captures:
300300
1: comment.block.html punctuation.definition.comment.begin.html
301301
pop: 1
@@ -357,27 +357,27 @@ contexts:
357357
- match: =
358358
scope: punctuation.separator.key-value.html
359359
set:
360-
- meta_content_scope: meta.tag.script.begin.html meta.attribute-with-value.html
360+
- meta_scope: meta.tag.script.begin.html meta.attribute-with-value.html
361361
- include: script-lang-decider
362362
- match: (?=\S)
363363
set: script-javascript
364364

365365
script-lang-decider:
366366
- match: (?i)(?=coffee{{unquoted_attribute_break}}|\'coffee\'|"coffee")
367367
set:
368-
- - meta_content_scope: meta.tag.script.begin.html
368+
- - meta_scope: meta.tag.script.begin.html
369369
- include: script-common
370370
- match: '>'
371371
scope: punctuation.definition.tag.end.html
372372
set:
373373
- - include: script-close-tag
374-
- - match: '{{script_content_begin}}'
374+
- - embed_scope: source.coffee.embedded.html
375375
escape_captures:
376376
1: source.coffee.embedded.html
377377
2: comment.block.html punctuation.definition.comment.end.html
378378
3: source.coffee.embedded.html
379379
4: comment.block.html punctuation.definition.comment.end.html
380-
embed_scope: source.coffee.embedded.html
380+
match: '{{script_content_begin}}'
381381
captures:
382382
1: comment.block.html punctuation.definition.comment.begin.html
383383
pop: 1
@@ -387,19 +387,19 @@ contexts:
387387
- tag-generic-attribute-value
388388
- match: (?i)(?=livescript{{unquoted_attribute_break}}|\'livescript\'|"livescript")
389389
set:
390-
- - meta_content_scope: meta.tag.script.begin.html
390+
- - meta_scope: meta.tag.script.begin.html
391391
- include: script-common
392392
- match: '>'
393393
scope: punctuation.definition.tag.end.html
394394
set:
395395
- - include: script-close-tag
396-
- - match: '{{script_content_begin}}'
396+
- - embed_scope: source.livescript.embedded.html
397397
escape_captures:
398398
1: source.livescript.embedded.html
399399
2: comment.block.html punctuation.definition.comment.end.html
400400
3: source.livescript.embedded.html
401401
4: comment.block.html punctuation.definition.comment.end.html
402-
embed_scope: source.livescript.embedded.html
402+
match: '{{script_content_begin}}'
403403
captures:
404404
1: comment.block.html punctuation.definition.comment.begin.html
405405
pop: 1
@@ -409,19 +409,19 @@ contexts:
409409
- tag-generic-attribute-value
410410
- match: (?i)(?=ts{{unquoted_attribute_break}}|\'ts\'|"ts")
411411
set:
412-
- - meta_content_scope: meta.tag.script.begin.html
412+
- - meta_scope: meta.tag.script.begin.html
413413
- include: script-common
414414
- match: '>'
415415
scope: punctuation.definition.tag.end.html
416416
set:
417417
- - include: script-close-tag
418-
- - match: '{{script_content_begin}}'
418+
- - embed_scope: source.ts.embedded.html
419419
escape_captures:
420420
1: source.ts.embedded.html
421421
2: comment.block.html punctuation.definition.comment.end.html
422422
3: source.ts.embedded.html
423423
4: comment.block.html punctuation.definition.comment.end.html
424-
embed_scope: source.ts.embedded.html
424+
match: '{{script_content_begin}}'
425425
captures:
426426
1: comment.block.html punctuation.definition.comment.begin.html
427427
pop: 1
@@ -469,27 +469,27 @@ contexts:
469469
- match: =
470470
scope: punctuation.separator.key-value.html
471471
set:
472-
- meta_content_scope: meta.tag.template.begin.html meta.attribute-with-value.html
472+
- meta_scope: meta.tag.template.begin.html meta.attribute-with-value.html
473473
- include: template-lang-decider
474474
- match: (?=\S)
475475
set: template-mustache
476476

477477
template-lang-decider:
478478
- match: (?i)(?=jade{{unquoted_attribute_break}}|\'jade\'|"jade")
479479
set:
480-
- - meta_content_scope: meta.tag.template.begin.html
480+
- - meta_scope: meta.tag.template.begin.html
481481
- include: template-common
482482
- match: '>'
483483
scope: punctuation.definition.tag.end.html
484484
set:
485485
- - include: template-close-tag
486-
- - match: '{{template_content_begin}}'
486+
- - embed_scope: text.jade.embedded.html
487487
escape_captures:
488488
1: text.jade.embedded.html
489489
2: comment.block.html punctuation.definition.comment.end.html
490490
3: text.jade.embedded.html
491491
4: comment.block.html punctuation.definition.comment.end.html
492-
embed_scope: text.jade.embedded.html
492+
match: '{{template_content_begin}}'
493493
captures:
494494
1: comment.block.html punctuation.definition.comment.begin.html
495495
pop: 1
@@ -499,19 +499,19 @@ contexts:
499499
- tag-generic-attribute-value
500500
- match: (?i)(?=pug{{unquoted_attribute_break}}|\'pug\'|"pug")
501501
set:
502-
- - meta_content_scope: meta.tag.template.begin.html
502+
- - meta_scope: meta.tag.template.begin.html
503503
- include: template-common
504504
- match: '>'
505505
scope: punctuation.definition.tag.end.html
506506
set:
507507
- - include: template-close-tag
508-
- - match: '{{template_content_begin}}'
508+
- - embed_scope: text.pug.embedded.html
509509
escape_captures:
510510
1: text.pug.embedded.html
511511
2: comment.block.html punctuation.definition.comment.end.html
512512
3: text.pug.embedded.html
513513
4: comment.block.html punctuation.definition.comment.end.html
514-
embed_scope: text.pug.embedded.html
514+
match: '{{template_content_begin}}'
515515
captures:
516516
1: comment.block.html punctuation.definition.comment.begin.html
517517
pop: 1
@@ -521,19 +521,19 @@ contexts:
521521
- tag-generic-attribute-value
522522
- match: (?i)(?=slm{{unquoted_attribute_break}}|\'slm\'|"slm")
523523
set:
524-
- - meta_content_scope: meta.tag.template.begin.html
524+
- - meta_scope: meta.tag.template.begin.html
525525
- include: template-common
526526
- match: '>'
527527
scope: punctuation.definition.tag.end.html
528528
set:
529529
- - include: template-close-tag
530-
- - match: '{{template_content_begin}}'
530+
- - embed_scope: text.slm.embedded.html
531531
escape_captures:
532532
1: text.slm.embedded.html
533533
2: comment.block.html punctuation.definition.comment.end.html
534534
3: text.slm.embedded.html
535535
4: comment.block.html punctuation.definition.comment.end.html
536-
embed_scope: text.slm.embedded.html
536+
match: '{{template_content_begin}}'
537537
captures:
538538
1: comment.block.html punctuation.definition.comment.begin.html
539539
pop: 1

Vue Component.sublime-syntax.yaml-macros

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ contexts:
174174
- match: =
175175
scope: punctuation.separator.key-value.html
176176
set:
177-
- meta_content_scope: meta.tag.style.begin.html meta.attribute-with-value.html
177+
- meta_scope: meta.tag.style.begin.html meta.attribute-with-value.html
178178
- include: style-lang-decider
179179
- match: (?=\S)
180180
set: style-css
@@ -240,7 +240,7 @@ contexts:
240240
- match: =
241241
scope: punctuation.separator.key-value.html
242242
set:
243-
- meta_content_scope: meta.tag.script.begin.html meta.attribute-with-value.html
243+
- meta_scope: meta.tag.script.begin.html meta.attribute-with-value.html
244244
- include: script-lang-decider
245245
- match: (?=\S)
246246
set: script-javascript
@@ -289,7 +289,7 @@ contexts:
289289
- match: =
290290
scope: punctuation.separator.key-value.html
291291
set:
292-
- meta_content_scope: meta.tag.template.begin.html meta.attribute-with-value.html
292+
- meta_scope: meta.tag.template.begin.html meta.attribute-with-value.html
293293
- include: template-lang-decider
294294
- match: (?=\S)
295295
set: template-mustache

src/macros.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def embed_language_in_tag(tag, match, embed):
1414
match=r'(?i)(?={0}{{{{unquoted_attribute_break}}}}|\'{0}\'|"{0}")'.format(match),
1515
set=[
1616
[
17-
_rule(meta_content_scope='meta.tag.%s.begin.html' % tag),
17+
_rule(meta_scope='meta.tag.%s.begin.html' % tag),
1818
_rule(include='%s-common' % tag),
1919
_rule(
2020
match='>',

tests/syntax_test_script.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@
131131
// ^^^^^^^^^ meta.tag - source
132132

133133

134+
<script lang="coffee"> </script>
135+
// ^^^^^^^^^^^^^^^^^^^^^^ meta.tag - meta.tag meta.tag - source
136+
// ^^^^^^^^^^^^^ meta.attribute-with-value.html - meta.attribute-with-value meta.attribute-with-value
137+
// ^^ source.coffee.embedded.html - meta.tag
138+
// ^^^^^^^^^ meta.tag - source
139+
134140
<script lang="coffee">
135141

136142
// <- source.coffee.embedded.html - source source

tests/syntax_test_style.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@
125125
// ^^^^^^^^ meta.tag - source
126126
127127
128+
<style lang="less"> </style>
129+
// ^^^^^^^^^^^^^^^^^^^ meta.tag - meta.tag meta.tag - source
130+
// ^^^^^^^^^^^ meta.attribute-with-value.html - meta.attribute-with-value meta.attribute-with-value
131+
// ^^ source.less.embedded.html - meta.tag
132+
// ^^^^^^^^ meta.tag - source
133+
134+
128135
<style lang="less">
129136
130137
// <- source.less.embedded.html - source source

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