From 923f835edb0119c0e85d6af388788c5c08e03a02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=B1=E5=90=B9=E8=89=B2=E5=BE=A1=E5=AE=88?= <85992002+KazariEX@users.noreply.github.com> Date: Sat, 31 Aug 2024 16:44:57 +0800 Subject: [PATCH] fix(vscode): correct highlighting on tag starting with `template` (#4770) --- .../vscode/syntaxes/vue.tmLanguage.json | 8 ++-- .../tests/__snapshots__/grammar.spec.ts.snap | 39 +++++++++++++++++++ .../tag-starts-with-template.vue | 6 +++ 3 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 extensions/vscode/tests/grammarFixtures/tag-starts-with-template.vue diff --git a/extensions/vscode/syntaxes/vue.tmLanguage.json b/extensions/vscode/syntaxes/vue.tmLanguage.json index 71109bc144..fbe30285e2 100644 --- a/extensions/vscode/syntaxes/vue.tmLanguage.json +++ b/extensions/vscode/syntaxes/vue.tmLanguage.json @@ -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" @@ -878,7 +878,7 @@ "patterns": [ { "begin": "\\G", - "end": "(?=/>)|(()|(()|(()|(( script-tag-in-script.vue 1`] = ` #^ source.vue" `; +exports[`grammar > tag-starts-with-template.vue 1`] = ` +"> +#^^ 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`] = ` ">