Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vscode): correct highlighting on tag starting with template #4770

Merged
merged 3 commits into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>