Skip to content
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
7 changes: 7 additions & 0 deletions extensions/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@
"text.pug"
]
},
{
"scopeName": "vue.sfc.script.leading-operator-fix",
"path": "./syntaxes/vue-sfc-script-leading-operator-fix.json",
"injectTo": [
"source.vue"
]
},
{
"scopeName": "vue.sfc.style.variable.injection",
"path": "./syntaxes/vue-sfc-style-variable-injection.json",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"fileTypes": [],
"injectionSelector": "L:source.vue source.js, L:source.vue source.js.jsx, L:source.vue source.tsx",
"patterns": [
{
"match": "^\\s*(<)(?=\\s+[_$[:alpha:]])",
"captures": {
"1": {
"name": "keyword.operator.relational.js"
}
}
}
],
"scopeName": "vue.sfc.script.leading-operator-fix"
}
119 changes: 119 additions & 0 deletions extensions/vscode/tests/__snapshots__/grammar.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,125 @@ exports[`grammar > jsx.vue 1`] = `
#^ source.vue"
`;

exports[`grammar > leading-operator.vue 1`] = `
"><script>
#^ source.vue punctuation.definition.tag.begin.html.vue
# ^^^^^^ source.vue entity.name.tag.script.html.vue
# ^ source.vue meta.tag-stuff punctuation.definition.tag.end.html.vue
>if (false
#^^^^^^^^^^ source.vue
>< true
#^^^^^^^ source.vue
>) { }
#^^^^^^ source.vue
>(
#^^ source.vue
><br />
#^^^^^^^ source.vue
>);
#^^^ source.vue
></script>
#^^ source.vue punctuation.definition.tag.begin.html.vue
# ^^^^^^ source.vue entity.name.tag.script.html.vue
# ^ source.vue punctuation.definition.tag.end.html.vue
>
#^ source.vue
><script lang="js">
#^ source.vue punctuation.definition.tag.begin.html.vue
# ^^^^^^ source.vue entity.name.tag.script.html.vue
# ^^^^^^^^^^ source.vue meta.tag-stuff
# ^ source.vue meta.tag-stuff punctuation.definition.tag.end.html.vue
>if (false
#^^^^^^^^^^ source.vue
>< true
#^^^^^^^ source.vue
>) {}
#^^^^^ source.vue
>(
#^^ source.vue
><br />
#^^^^^^^ source.vue
>);
#^^^ source.vue
></script>
#^^ source.vue punctuation.definition.tag.begin.html.vue
# ^^^^^^ source.vue entity.name.tag.script.html.vue
# ^ source.vue punctuation.definition.tag.end.html.vue
>
#^ source.vue
><script lang="jsx">
#^ source.vue punctuation.definition.tag.begin.html.vue
# ^^^^^^ source.vue entity.name.tag.script.html.vue
# ^^^^^^^^^^^ source.vue meta.tag-stuff
# ^ source.vue meta.tag-stuff punctuation.definition.tag.end.html.vue
>if (false
#^^^^^^^^^^ source.vue
>< true
#^^^^^^^ source.vue
>) {}
#^^^^^ source.vue
>(
#^^ source.vue
><br />
#^^^^^^^ source.vue
>);
#^^^ source.vue
></script>
#^^ source.vue punctuation.definition.tag.begin.html.vue
# ^^^^^^ source.vue entity.name.tag.script.html.vue
# ^ source.vue punctuation.definition.tag.end.html.vue
>
#^ source.vue
><script lang="ts">
#^ source.vue punctuation.definition.tag.begin.html.vue
# ^^^^^^ source.vue entity.name.tag.script.html.vue
# ^^^^^^^^^^ source.vue meta.tag-stuff
# ^ source.vue meta.tag-stuff punctuation.definition.tag.end.html.vue
>if (false
#^^^^^^^^^^ source.vue
>< true
#^^^^^^^ source.vue
>) {}
#^^^^^ source.vue
>interface Foo
#^^^^^^^^^^^^^^ source.vue
><T> { value: T; }
#^^^^^^^^^^^^^^^^^^ source.vue
></script>
#^^ source.vue punctuation.definition.tag.begin.html.vue
# ^^^^^^ source.vue entity.name.tag.script.html.vue
# ^ source.vue punctuation.definition.tag.end.html.vue
>
#^ source.vue
><script lang="tsx">
#^ source.vue punctuation.definition.tag.begin.html.vue
# ^^^^^^ source.vue entity.name.tag.script.html.vue
# ^^^^^^^^^^^ source.vue meta.tag-stuff
# ^ source.vue meta.tag-stuff punctuation.definition.tag.end.html.vue
>if (false
#^^^^^^^^^^ source.vue
>< true
#^^^^^^^ source.vue
>) {}
#^^^^^ source.vue
>interface Foo
#^^^^^^^^^^^^^^ source.vue
><T> { value: T; }
#^^^^^^^^^^^^^^^^^^ source.vue
>(
#^^ source.vue
><br />
#^^^^^^^ source.vue
>);
#^^^ source.vue
></script>
#^^ source.vue punctuation.definition.tag.begin.html.vue
# ^^^^^^ source.vue entity.name.tag.script.html.vue
# ^ source.vue punctuation.definition.tag.end.html.vue
>
#^ source.vue"
`;

exports[`grammar > namespaced.vue 1`] = `
"><script setup lang="ts">
#^ source.vue punctuation.definition.tag.begin.html.vue
Expand Down
45 changes: 45 additions & 0 deletions extensions/vscode/tests/grammarFixtures/leading-operator.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<script>
if (false
< true
) { }
(
<br />
);
</script>

<script lang="js">
if (false
< true
) {}
(
<br />
);
</script>

<script lang="jsx">
if (false
< true
) {}
(
<br />
);
</script>

<script lang="ts">
if (false
< true
) {}
interface Foo
<T> { value: T; }
</script>

<script lang="tsx">
if (false
< true
) {}
interface Foo
<T> { value: T; }
(
<br />
);
</script>