Skip to content

Commit

Permalink
fix(vscode): correct highlighting on tag starting with template (#4770
Browse files Browse the repository at this point in the history
)
  • Loading branch information
KazariEX authored Aug 31, 2024
1 parent 69be985 commit 923f835
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 4 deletions.
8 changes: 4 additions & 4 deletions extensions/vscode/syntaxes/vue.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@
]
},
"template-tag-1": {
"begin": "(<)(template)\\b(>)",
"begin": "(<)(template[a-zA-Z0-9:-]*)\\b(>)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html.vue"
Expand All @@ -878,7 +878,7 @@
"patterns": [
{
"begin": "\\G",
"end": "(?=/>)|((</)(template)\\b)",
"end": "(?=/>)|((</)(template[a-zA-Z0-9:-]*)\\b)",
"endCaptures": {
"2": {
"name": "punctuation.definition.tag.begin.html.vue"
Expand All @@ -897,7 +897,7 @@
]
},
"template-tag-2": {
"begin": "(<)(template)\\b",
"begin": "(<)(template[a-zA-Z0-9:-]*)\\b",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html.vue"
Expand All @@ -916,7 +916,7 @@
"patterns": [
{
"begin": "\\G",
"end": "(?=/>)|((</)(template)\\b)",
"end": "(?=/>)|((</)(template[a-zA-Z0-9:-]*)\\b)",
"endCaptures": {
"2": {
"name": "punctuation.definition.tag.begin.html.vue"
Expand Down
39 changes: 39 additions & 0 deletions extensions/vscode/tests/__snapshots__/grammar.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,45 @@ exports[`grammar > script-tag-in-script.vue 1`] = `
#^ source.vue"
`;
exports[`grammar > tag-starts-with-template.vue 1`] = `
"><template>
#^ source.vue punctuation.definition.tag.begin.html.vue
# ^^^^^^^^ source.vue entity.name.tag.template.html.vue
# ^ source.vue meta.tag-stuff punctuation.definition.tag.end.html.vue
> <template-foo></template-foo>
#^ source.vue text.html.derivative
# ^ source.vue text.html.derivative meta.template-tag.start punctuation.definition.tag.begin.html.vue
# ^^^^^^^^^^^^ source.vue text.html.derivative meta.template-tag.start entity.name.tag.template-foo.html.vue
# ^ source.vue text.html.derivative meta.template-tag.start punctuation.definition.tag.end.html.vue
# ^^ source.vue text.html.derivative meta.template-tag.start meta.template-tag.end punctuation.definition.tag.begin.html.vue
# ^^^^^^^^^^^^ source.vue text.html.derivative meta.template-tag.start meta.template-tag.end entity.name.tag.template-foo.html.vue
# ^ source.vue text.html.derivative meta.template-tag.start punctuation.definition.tag.end.html.vue
> <template:bar></template:bar>
#^ source.vue text.html.derivative
# ^ source.vue text.html.derivative meta.template-tag.start punctuation.definition.tag.begin.html.vue
# ^^^^^^^^^^^^ source.vue text.html.derivative meta.template-tag.start entity.name.tag.template:bar.html.vue
# ^ source.vue text.html.derivative meta.template-tag.start punctuation.definition.tag.end.html.vue
# ^^ source.vue text.html.derivative meta.template-tag.start meta.template-tag.end punctuation.definition.tag.begin.html.vue
# ^^^^^^^^^^^^ source.vue text.html.derivative meta.template-tag.start meta.template-tag.end entity.name.tag.template:bar.html.vue
# ^ source.vue text.html.derivative meta.template-tag.start punctuation.definition.tag.end.html.vue
> <template-foo />
#^ source.vue text.html.derivative
# ^ source.vue text.html.derivative meta.template-tag.start punctuation.definition.tag.begin.html.vue
# ^^^^^^^^^^^^ source.vue text.html.derivative meta.template-tag.start entity.name.tag.template-foo.html.vue
# ^ source.vue text.html.derivative meta.template-tag.start meta.template-tag.end meta.tag-stuff
# ^^ source.vue text.html.derivative meta.template-tag.start punctuation.definition.tag.end.html.vue
> <template:bar />
#^ source.vue text.html.derivative
# ^ source.vue text.html.derivative meta.template-tag.start punctuation.definition.tag.begin.html.vue
# ^^^^^^^^^^^^ source.vue text.html.derivative meta.template-tag.start entity.name.tag.template:bar.html.vue
# ^ source.vue text.html.derivative meta.template-tag.start meta.template-tag.end meta.tag-stuff
# ^^ source.vue text.html.derivative meta.template-tag.start punctuation.definition.tag.end.html.vue
></template>
#^^ source.vue punctuation.definition.tag.begin.html.vue
# ^^^^^^^^ source.vue entity.name.tag.template.html.vue
# ^ source.vue punctuation.definition.tag.end.html.vue"
`;
exports[`grammar > template-expression.vue 1`] = `
"><template>
#^ source.vue punctuation.definition.tag.begin.html.vue
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<template>
<template-foo></template-foo>
<template:bar></template:bar>
<template-foo />
<template:bar />
</template>

0 comments on commit 923f835

Please sign in to comment.