Skip to content

Commit 6a7241c

Browse files
FichteFollskyronic
authored andcommitted
Add support for "dynamic arguments"
1 parent 65d7b1e commit 6a7241c

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

Vue Component.sublime-syntax

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,3 +614,20 @@ contexts:
614614
0: meta.attribute-with-value.directive.html meta.string.html string.quoted.single.html
615615
punctuation.definition.string.end.html
616616
- include: else-pop
617+
618+
tag-generic-attribute-name:
619+
- meta_prepend: true
620+
# https://vuejs.org/guide/essentials/template-syntax.html#dynamic-arguments
621+
- match: (?=\[)
622+
push: vue-dynamic-attribute-name
623+
624+
vue-dynamic-attribute-name:
625+
- clear_scopes: 1 # clear `entity.other.attribute-name`
626+
- match: \[
627+
scope: punctuation.section.interpolation.begin.vue
628+
embed: scope:source.js#expression-statement
629+
embed_scope: meta.interpolation.vue source.js.embedded.vue
630+
escape: \]
631+
escape_captures:
632+
0: punctuation.definition.string.end.html
633+
- include: else-pop

Vue Component.sublime-syntax.yaml-macros

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,3 +387,20 @@ contexts:
387387
meta.string.html string.quoted.single.html
388388
punctuation.definition.string.end.html
389389
- include: else-pop
390+
391+
tag-generic-attribute-name:
392+
- meta_prepend: true
393+
# https://vuejs.org/guide/essentials/template-syntax.html#dynamic-arguments
394+
- match: (?=\[)
395+
push: vue-dynamic-attribute-name
396+
397+
vue-dynamic-attribute-name:
398+
- clear_scopes: 1 # clear `entity.other.attribute-name`
399+
- match: \[
400+
scope: punctuation.section.interpolation.begin.vue
401+
embed: scope:source.js#expression-statement
402+
embed_scope: meta.interpolation.vue source.js.embedded.vue
403+
escape: \]
404+
escape_captures:
405+
0: punctuation.definition.string.end.html
406+
- include: else-pop

tests/syntax_tests_mustage.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,22 @@
125125
// ^ meta.tag - meta.attribute-with-value
126126
// ^ - meta.tag
127127

128+
<template #[`content-${variable}`]>
129+
// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag meta.attribute-with-value.directive.html
130+
// ^ entity.other.attribute-name.html
131+
// ^ punctuation.section.interpolation.begin.vue
132+
// ^^^^^^^^^^^^^^^^^^^^^ meta.interpolation.vue source.js.embedded.vue - entity.other.attribute-name.html
133+
// ^ punctuation.definition.string.end.html
134+
// ^ meta.tag - meta.attribute-with-value
135+
// ^ - meta.tag
136+
137+
<template v-slot:[`content-${variable}`]>
138+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag meta.attribute-with-value.directive.html
139+
// ^^^^^^^ entity.other.attribute-name.html
140+
// ^ punctuation.section.interpolation.begin.vue
141+
// ^^^^^^^^^^^^^^^^^^^^^ meta.interpolation.vue source.js.embedded.vue - entity.other.attribute-name.html
142+
// ^ punctuation.definition.string.end.html
143+
// ^ meta.tag - meta.attribute-with-value
144+
// ^ - meta.tag
145+
128146
</html>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy