Skip to content

Commit 7ec7638

Browse files
author
deathaxe
authored
Merge pull request #32 from SublimeText/fix/tweak-directive-scopes
Tweak vue directive meta scopes
2 parents 6ba9c03 + f3b777e commit 7ec7638

3 files changed

+240
-268
lines changed

Vue Component.sublime-syntax

+50-60
Original file line numberDiff line numberDiff line change
@@ -648,75 +648,45 @@ contexts:
648648
vue-directive:
649649
# https://vuejs.org/guide/essentials/list.html#list-rendering
650650
- match: (?i:v-for){{vue_directive_break}}
651-
scope: entity.other.attribute-name.html keyword.control.loop.for.vue
652-
push:
653-
- vue-directive-meta
654-
- vue-directive-assignment
651+
scope: meta.directive.vue keyword.control.loop.for.vue
652+
push: vue-directive-assignment
655653
# https://vuejs.org/guide/essentials/conditional.html#conditional-rendering
656654
- match: (?i:v-if){{vue_directive_break}}
657-
scope: entity.other.attribute-name.html keyword.control.conditional.if.vue
658-
push:
659-
- vue-directive-meta
660-
- vue-directive-assignment
655+
scope: meta.directive.vue keyword.control.conditional.if.vue
656+
push: vue-directive-assignment
661657
- match: (?i:v-else-if){{vue_directive_break}}
662-
scope: entity.other.attribute-name.html keyword.control.conditional.elseif.vue
663-
push:
664-
- vue-directive-meta
665-
- vue-directive-assignment
658+
scope: meta.directive.vue keyword.control.conditional.elseif.vue
659+
push: vue-directive-assignment
666660
- match: (?i:v-else){{vue_directive_break}}
667-
scope:
668-
meta.attribute-with-value.directive.html
669-
entity.other.attribute-name.html keyword.control.conditional.else.vue
661+
scope: meta.directive.vue keyword.control.conditional.else.vue
670662
- match: (?i:v-show){{vue_directive_break}}
671-
scope: entity.other.attribute-name.html keyword.control.conditional.show.vue
672-
push:
673-
- vue-directive-meta
674-
- vue-directive-assignment
663+
scope: meta.directive.vue keyword.control.conditional.show.vue
664+
push: vue-directive-assignment
675665
# https://vuejs.org/guide/essentials/template-syntax.html#directives
676666
- match: (?i:v-{{vue_directive_char}}+){{vue_directive_break}}
677-
scope: keyword.other.directive.vue
678-
push:
679-
- vue-directive-meta
680-
- vue-directive-assignment
681-
- vue-directive-modifiers
682-
- vue-directive-parameter
667+
scope: meta.directive.vue keyword.other.directive.vue
668+
push: vue-directive-parameter
683669
# `@event` is short hand form of `v-on:event`
684670
# `:attr` is short hand form of `v-bind:attr`
685671
# `#attr` is short hand form of `??`
686672
- match: '[@:#]'
687-
scope: keyword.other.directive.vue
688-
push:
689-
- vue-directive-meta
690-
- vue-directive-assignment
691-
- vue-directive-modifiers
692-
- vue-directive-parameter-name
693-
694-
vue-directive-meta:
695-
- meta_include_prototype: false
696-
- meta_scope: meta.attribute-with-value.directive.html
697-
- include: immediately-pop
698-
699-
vue-directive-modifiers:
700-
# https://vuejs.org/guide/essentials/event-handling.html#event-modifiers
701-
- meta_scope: entity.other.attribute-name.html
702-
- match: (\.)({{vue_directive_char}}+{{vue_directive_break}})?
703-
captures:
704-
1: punctuation.separator.vue
705-
2: storage.modifier.vue
706-
- include: immediately-pop
673+
scope: meta.directive.vue keyword.other.directive.vue
674+
push: vue-directive-parameter-name
707675

708676
vue-directive-parameter:
677+
- meta_include_prototype: false
709678
# https://vuejs.org/guide/essentials/template-syntax.html#arguments
710679
- match: ':'
711-
scope: punctuation.separator.vue
680+
scope: meta.directive.vue punctuation.separator.vue
712681
set: vue-directive-parameter-name
713-
- include: immediately-pop
682+
- match: ''
683+
set: vue-directive-assignment
714684

715685
vue-directive-parameter-name:
716686
- meta_include_prototype: false
717687
# https://vuejs.org/guide/essentials/template-syntax.html#dynamic-arguments
718688
- match: \[
719-
scope: meta.interpolation.vue punctuation.section.interpolation.begin.vue
689+
scope: punctuation.section.interpolation.begin.vue
720690
set:
721691
- vue-dynamic-parameter-name-end
722692
- scope:source.js#expression
@@ -725,42 +695,62 @@ contexts:
725695

726696
vue-dynamic-parameter-name-end:
727697
- meta_include_prototype: false
728-
- meta_content_scope: meta.interpolation.vue source.js.embedded.vue
698+
- meta_scope: meta.directive.parameter.vue meta.interpolation.vue
699+
- meta_content_scope: source.js.embedded.vue
729700
- match: \]
730-
scope: meta.interpolation.vue punctuation.section.interpolation.end.vue
731-
pop: 1
701+
scope: punctuation.section.interpolation.end.vue
702+
set: vue-directive-modifiers
732703

733704
vue-static-parameter-name:
705+
- meta_scope: meta.directive.parameter.vue entity.other.attribute-name.vue
734706
- match: '{{vue_parameter_break}}'
735-
pop: 1
707+
set: vue-directive-modifiers
736708
- match: '["''`<]'
737-
scope: invalid.illegal.attribute-name.html
709+
scope: invalid.illegal.attribute-name.vue
710+
711+
vue-directive-modifiers:
712+
# https://vuejs.org/guide/essentials/event-handling.html#event-modifiers
713+
- meta_content_scope: meta.directive.modifiers.vue
714+
- match: (\.)({{vue_directive_char}}+{{vue_directive_break}})?
715+
captures:
716+
1: punctuation.separator.vue
717+
2: storage.modifier.vue
718+
- match: ''
719+
set: vue-directive-assignment
738720

739721
vue-directive-assignment:
722+
- meta_content_scope: meta.directive.vue
740723
- match: =
741-
scope: punctuation.separator.key-value.html
724+
scope: meta.directive.vue punctuation.separator.key-value.vue
742725
set: vue-directive-value
743726
- include: else-pop
744727

745728
vue-directive-value:
729+
- meta_content_scope: meta.directive.vue
746730
- match: \"
747-
scope: meta.string.html string.quoted.double.html punctuation.definition.string.begin.html
731+
scope: string.quoted.double.vue punctuation.definition.string.begin.vue
748732
set:
749733
- vue-directive-double-quoted-value-end
750734
- scope:source.js#expression
751735
- match: \'
752-
scope: meta.string.html string.quoted.single.html punctuation.definition.string.begin.html
736+
scope: string.quoted.single.vue punctuation.definition.string.begin.vue
753737
set:
754738
- vue-directive-single-quoted-value-end
755739
- scope:source.js#expression
756740
- include: else-pop
757741

758742
vue-directive-double-quoted-value-end:
759743
- meta_include_prototype: false
760-
- meta_content_scope: meta.string.html meta.interpolation.vue source.js.embedded.vue
761-
- include: strings-double-quoted-end
744+
- meta_scope: meta.directive.value.vue meta.string.vue
745+
- meta_content_scope: meta.interpolation.vue source.js.embedded.vue
746+
- match: \"
747+
scope: string.quoted.double.vue punctuation.definition.string.end.vue
748+
pop: 1
762749

763750
vue-directive-single-quoted-value-end:
764751
- meta_include_prototype: false
765-
- meta_content_scope: meta.string.html meta.interpolation.vue source.js.embedded.vue
766-
- include: strings-single-quoted-end
752+
- meta_scope: meta.directive.value.vue meta.string.vue
753+
- meta_content_scope: meta.interpolation.vue source.js.embedded.vue
754+
- match: \'
755+
scope: string.quoted.single.vue punctuation.definition.string.end.vue
756+
pop: 1

0 commit comments

Comments
 (0)