Skip to content

fix: inline html comment pattern in Vue syntax definition #5327

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

Merged
merged 2 commits into from
Apr 19, 2025
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
13 changes: 10 additions & 3 deletions extensions/vscode/syntaxes/vue.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
{
"include": "#vue-comments"
},
{
"include": "text.html.basic#comment"
},
{
"include": "#self-closing-tag"
},
Expand Down Expand Up @@ -1286,6 +1283,16 @@
"patterns": [
{
"include": "#vue-comments-key-value"
},
{
"begin": "<!--",
"captures": {
"0": {
"name": "punctuation.definition.comment.vue"
}
},
"end": "-->",
"name": "comment.block.vue"
}
]
},
Expand Down
87 changes: 45 additions & 42 deletions extensions/vscode/tests/__snapshots__/grammar.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -134,68 +134,71 @@ exports[`grammar > directives.vue 1`] = `
>
#^ source.vue
><!-- TODO -->
#^ source.vue punctuation.definition.tag.begin.html.vue
# ^ source.vue
# ^^ source.vue entity.name.tag.--.html.vue
# ^^^^^^^^ source.vue meta.tag-stuff
# ^ source.vue meta.tag-stuff punctuation.definition.tag.end.html.vue
#^^^^ source.vue comment.block.vue punctuation.definition.comment.vue
# ^^^^^^ source.vue comment.block.vue
# ^^^ source.vue comment.block.vue punctuation.definition.comment.vue
><template lang="html">
#^^^^^^^^^^^^^^^^^^^^^^^ source.vue text
#^ source.vue punctuation.definition.tag.begin.html.vue
# ^^^^^^^^ source.vue entity.name.tag.template.html.vue
# ^^^^^^^^^^^^ source.vue meta.tag-stuff
# ^ source.vue meta.tag-stuff punctuation.definition.tag.end.html.vue
> <div @click></div>
#^^^^^^^^^^^^^ source.vue text
# ^^^^^^^ source.vue text
#^^^^^^^^^^^^^ source.vue text.html.derivative
# ^^^^^^^ source.vue text.html.derivative
> <div @click="{}"></div>
#^^^^^^^^^^^^^^^^^^ source.vue text
# ^^^^^^^ source.vue text
#^^^^^^^^^^^^^^^^^^ source.vue text.html.derivative
# ^^^^^^^ source.vue text.html.derivative
> <div @click="log('hello'); log('world');"></div>
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.vue text
# ^^^^^^^ source.vue text
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.vue text.html.derivative
# ^^^^^^^ source.vue text.html.derivative
> <div #default></div>
#^^^^^^^^^^^^^^^ source.vue text
# ^^^^^^^ source.vue text
#^^^^^^^^^^^^^^^ source.vue text.html.derivative
# ^^^^^^^ source.vue text.html.derivative
> <div #default="args"></div>
#^^^^^^^^^^^^^^^^^^^^^^ source.vue text
# ^^^^^^^ source.vue text
#^^^^^^^^^^^^^^^^^^^^^^ source.vue text.html.derivative
# ^^^^^^^ source.vue text.html.derivative
> <div #></div>
#^^^^^^^^ source.vue text
# ^^^^^^^ source.vue text
#^^^^^^^^ source.vue text.html.derivative
# ^^^^^^^ source.vue text.html.derivative
> <div #="args"></div>
#^^^^^^^^^^^^^^^ source.vue text
# ^^^^^^^ source.vue text
#^^^^^^^^^^^^^^^ source.vue text.html.derivative
# ^^^^^^^ source.vue text.html.derivative
> <div :key></div>
#^^^^^^^^^^^ source.vue text
# ^^^^^^^ source.vue text
#^^^^^^^^^^^ source.vue text.html.derivative
# ^^^^^^^ source.vue text.html.derivative
> <div :key="{}"></div>
#^^^^^^^^^^^^^^^^ source.vue text
# ^^^^^^^ source.vue text
#^^^^^^^^^^^^^^^^ source.vue text.html.derivative
# ^^^^^^^ source.vue text.html.derivative
> <div v-if="true"></div>
#^^^^^^^^^^^^^^^^^^ source.vue text
# ^^^^^^^ source.vue text
#^^^^^^^^^^^^^^^^^^ source.vue text.html.derivative
# ^^^^^^^ source.vue text.html.derivative
> <div v-else-if="true"></div>
#^^^^^^^^^^^^^^^^^^^^^^^ source.vue text
# ^^^^^^^ source.vue text
#^^^^^^^^^^^^^^^^^^^^^^^ source.vue text.html.derivative
# ^^^^^^^ source.vue text.html.derivative
> <div v-else></div>
#^^^^^^^^^^^^^ source.vue text
# ^^^^^^^ source.vue text
#^^^^^^^^^^^^^ source.vue text.html.derivative
# ^^^^^^^ source.vue text.html.derivative
> <div v-for="n in []"></div>
#^^^^^^^^^^^^^^^^^^^^^^ source.vue text
# ^^^^^^^ source.vue text
#^^^^^^^^^^^^^^^^^^^^^^ source.vue text.html.derivative
# ^^^^^^^ source.vue text.html.derivative
> <div v-if="true" v-else-if="true" v-else></div>
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.vue text
# ^^^^^^^ source.vue text
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.vue text.html.derivative
# ^^^^^^^ source.vue text.html.derivative
> <div :foo="':foo=123'"></div>
#^^^^^^^^^^^^^^^^^^^^^^^^ source.vue text
# ^^^^^^^ source.vue text
#^^^^^^^^^^^^^^^^^^^^^^^^ source.vue text.html.derivative
# ^^^^^^^ source.vue text.html.derivative
> <div :foo="[{ bar: []}]"></div>
#^^^^^^^^^^^^^^^^^^^^^^^^^^ source.vue text
# ^^^^^^^ source.vue text
#^^^^^^^^^^^^^^^^^^^^^^^^^^ source.vue text.html.derivative
# ^^^^^^^ source.vue text.html.derivative
> <div .prop="[1, 2]"></div>
#^^^^^^^^^^^^^^^^^^^^^ source.vue text
# ^^^^^^^ source.vue text
#^^^^^^^^^^^^^^^^^^^^^ source.vue text.html.derivative
# ^^^^^^^ source.vue text.html.derivative
></template>
#^^^^^^^^^^^ source.vue
#^^ source.vue punctuation.definition.tag.begin.html.vue
# ^^^^^^^^ source.vue entity.name.tag.template.html.vue
# ^ source.vue punctuation.definition.tag.end.html.vue
>
#^ source.vue text"
#^ source.vue"
`;

exports[`grammar > generic.vue 1`] = `
Expand Down