Skip to content

Commit dbe9f0a

Browse files
deathaxeskyronic
authored andcommitted
Fix meta scopes of template tags
This commit... 1. fixes duplicated meta.tag scopes in `<template>` tags 2. fixes missing meta.tag scope at the closing `>` in `<template>` tags 3. adds syntax tests for template tags
1 parent 37a98cf commit dbe9f0a

File tree

3 files changed

+105
-10
lines changed

3 files changed

+105
-10
lines changed

Vue Component.sublime-syntax

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,6 @@ contexts:
448448
template-tag:
449449
- match: (<)((?i:template)){{tag_name_break}}
450450
captures:
451-
0: meta.tag.template.begin.html
452451
1: punctuation.definition.tag.begin.html
453452
2: entity.name.tag.template.html
454453
push: template-mustache
@@ -465,12 +464,10 @@ contexts:
465464
template-common:
466465
- include: template-lang-attribute
467466
- include: tag-attributes
468-
- match: />
469-
scope: punctuation.definition.tag.end.html
470-
pop: true
467+
- include: tag-end-self-closing
471468

472469
template-mustache:
473-
- meta_content_scope: meta.tag.template.begin.html
470+
- meta_scope: meta.tag.template.begin.html
474471
- include: template-common
475472
- match: '>'
476473
scope: punctuation.definition.tag.end.html

Vue Component.sublime-syntax.yaml-macros

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ contexts:
268268
template-tag:
269269
- match: (<)((?i:template)){{tag_name_break}}
270270
captures:
271-
0: meta.tag.template.begin.html
272271
1: punctuation.definition.tag.begin.html
273272
2: entity.name.tag.template.html
274273
push: template-mustache
@@ -285,12 +284,10 @@ contexts:
285284
template-common:
286285
- include: template-lang-attribute
287286
- include: tag-attributes
288-
- match: '/>'
289-
scope: punctuation.definition.tag.end.html
290-
pop: true
287+
- include: tag-end-self-closing
291288

292289
template-mustache:
293-
- meta_content_scope: meta.tag.template.begin.html
290+
- meta_scope: meta.tag.template.begin.html
294291
- include: template-common
295292
- match: '>'
296293
scope: punctuation.definition.tag.end.html

tests/syntax_test_template.vue

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// SYNTAX TEST "Vue Component.sublime-syntax"
2+
3+
4+
<template lang="jade"> foo </template>
5+
// ^^^^^^^^^^^^^^^^^^^^^^ meta.tag - source
6+
// ^^^^^ text.jade.embedded.html - meta.tag
7+
// ^^^^^^^^^^^ meta.tag - source
8+
9+
<template lang="jade"> foo --> </template>
10+
// ^^^^^^^^^^^^^^^^^^^^^^ meta.tag - source
11+
// ^^^^^ text.jade.embedded.html - meta.tag
12+
// ^^^^ - meta.tag - source
13+
// ^^^ comment.block.html punctuation.definition.comment.end.html
14+
// ^^^^^^^^^^^ meta.tag - source
15+
16+
<template lang="jade"> <!-- foo </template>
17+
// ^^^^^^^^^^^^^^^^^^^^^^ meta.tag - source
18+
// ^^^^^ - meta.tag - source
19+
// ^^^^ punctuation.definition.comment.begin.html
20+
// ^^^^^ text.jade.embedded.html - meta.tag
21+
// ^^^^^^^^^^^ meta.tag - source
22+
23+
<template lang="jade"> <!-- foo --> </template>
24+
// ^^^^^^^^^^^^^^^^^^^^^^ meta.tag - source
25+
// ^^^^^ - meta.tag - source
26+
// ^^^^ punctuation.definition.comment.begin.html
27+
// ^^^^^ text.jade.embedded.html - meta.tag
28+
// ^^^^ - meta.tag - source
29+
// ^^^ comment.block.html punctuation.definition.comment.end.html
30+
// ^^^^^^^^^^^ meta.tag - source
31+
32+
33+
<template lang="jade">
34+
35+
// <- text.jade.embedded.html
36+
37+
</template>
38+
// <- text.jade.embedded.html
39+
//^^ text.jade.embedded.html
40+
// ^^^^^^^^^^^ meta.tag - meta.tag meta.tag - text.jade
41+
42+
43+
<template lang="jade">
44+
// ^^^^^^^^^^ meta.tag - meta.tag meta.tag - meta.attribute-with-value
45+
// ^^^^^^^^^^^ meta.tag meta.attribute-with-value.html - meta.tag meta.tag
46+
// ^ meta.tag.template.begin.html - meta.tag meta.tag
47+
// ^ punctuation.definition.tag.begin.html
48+
// ^^^^^^^^ entity.name.tag.template.html
49+
// ^^^^ entity.other.attribute-name.html
50+
// ^ punctuation.separator.key-value.html
51+
// ^ punctuation.definition.tag.end.html
52+
// ^ - text.jade
53+
54+
// <- text.jade.embedded.html
55+
</template>
56+
// <- text.jade.embedded.html
57+
//^^ text.jade.embedded.html
58+
// ^^^^^^^^^^^ meta.tag - meta.tag meta.tag - text.jade
59+
// ^^ punctuation.definition.tag.begin.html
60+
// ^^^^^^^^ entity.name.tag.template.html
61+
// ^ punctuation.definition.tag.end.html
62+
63+
<template lang="pug">
64+
// ^^^^^^^^^^ meta.tag - meta.tag meta.tag - meta.attribute-with-value
65+
// ^^^^^^^^^^ meta.tag meta.attribute-with-value.html - meta.tag meta.tag
66+
// ^ meta.tag.template.begin.html - meta.tag meta.tag
67+
// ^ punctuation.definition.tag.begin.html
68+
// ^^^^^^^^ entity.name.tag.template.html
69+
// ^^^^ entity.other.attribute-name.html
70+
// ^ punctuation.separator.key-value.html
71+
// ^ punctuation.definition.tag.end.html
72+
// ^ - text.pug
73+
74+
// <- text.pug.embedded.html
75+
</template>
76+
// <- text.pug.embedded.html
77+
//^^ text.pug.embedded.html
78+
// ^^^^^^^^^^^ meta.tag - meta.tag meta.tag - text.pug
79+
// ^^ punctuation.definition.tag.begin.html
80+
// ^^^^^^^^ entity.name.tag.template.html
81+
// ^ punctuation.definition.tag.end.html
82+
83+
<template lang="slm">
84+
// ^^^^^^^^^^ meta.tag - meta.tag meta.tag - meta.attribute-with-value
85+
// ^^^^^^^^^^ meta.tag meta.attribute-with-value.html - meta.tag meta.tag
86+
// ^ meta.tag.template.begin.html - meta.tag meta.tag
87+
// ^ punctuation.definition.tag.begin.html
88+
// ^^^^^^^^ entity.name.tag.template.html
89+
// ^^^^ entity.other.attribute-name.html
90+
// ^ punctuation.separator.key-value.html
91+
// ^ punctuation.definition.tag.end.html
92+
// ^ - text.slm
93+
94+
// <- text.slm.embedded.html
95+
</template>
96+
// <- text.slm.embedded.html
97+
//^^ text.slm.embedded.html
98+
// ^^^^^^^^^^^ meta.tag - meta.tag meta.tag - text.slm
99+
// ^^ punctuation.definition.tag.begin.html
100+
// ^^^^^^^^ entity.name.tag.template.html
101+
// ^ punctuation.definition.tag.end.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