From 500e513f8aa57582259e906c78212b5b9aee590f Mon Sep 17 00:00:00 2001 From: FichteFoll Date: Tue, 13 Nov 2018 04:44:13 +0100 Subject: [PATCH 1/2] Add embed_scope to JavaScript embeds Allows to exclude vue embeds from linting, for example, using `source.js - source.js.embedded.vue`. --- Vue Component.sublime-syntax | 3 +++ Vue Component.sublime-syntax.yaml-macros | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Vue Component.sublime-syntax b/Vue Component.sublime-syntax index f377e4e..9e659d5 100644 --- a/Vue Component.sublime-syntax +++ b/Vue Component.sublime-syntax @@ -642,6 +642,7 @@ contexts: - match: '{{' scope: punctuation.definition.template.begin.html embed: scope:source.js + embed_scope: source.js.embedded.vue escape: '}}' escape_captures: 0: punctuation.definition.template.end.html @@ -674,12 +675,14 @@ contexts: - match: '"' scope: punctuation.definition.string.begin.html embed: scope:source.js + embed_scope: source.js.embedded.vue escape: '"' escape_captures: 0: punctuation.definition.string.end.html - match: "'" scope: punctuation.definition.string.begin.html embed: scope:source.js + embed_scope: source.js.embedded.vue escape: "'" escape_captures: 0: punctuation.definition.string.end.html diff --git a/Vue Component.sublime-syntax.yaml-macros b/Vue Component.sublime-syntax.yaml-macros index 0a7c879..ed167e8 100644 --- a/Vue Component.sublime-syntax.yaml-macros +++ b/Vue Component.sublime-syntax.yaml-macros @@ -17,6 +17,7 @@ contexts: !merge - match: '{{' scope: punctuation.definition.template.begin.html embed: scope:source.js + embed_scope: source.js.embedded.vue escape: '}}' escape_captures: 0: punctuation.definition.template.end.html @@ -52,12 +53,14 @@ contexts: !merge - match: '"' scope: punctuation.definition.string.begin.html embed: scope:source.js + embed_scope: source.js.embedded.vue escape: '"' escape_captures: 0: punctuation.definition.string.end.html - match: "'" scope: punctuation.definition.string.begin.html embed: scope:source.js + embed_scope: source.js.embedded.vue escape: "'" escape_captures: 0: punctuation.definition.string.end.html From 7d8b7765b8737527a9e25d8370b3dba2214a7dac Mon Sep 17 00:00:00 2001 From: FichteFoll Date: Tue, 13 Nov 2018 04:49:24 +0100 Subject: [PATCH 2/2] Add meta.template scope for mustache expressions --- Vue Component.sublime-syntax | 19 ++++++++++++------- Vue Component.sublime-syntax.yaml-macros | 19 ++++++++++++------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/Vue Component.sublime-syntax b/Vue Component.sublime-syntax index 9e659d5..2e564c2 100644 --- a/Vue Component.sublime-syntax +++ b/Vue Component.sublime-syntax @@ -639,13 +639,18 @@ contexts: - include: tag-event-attribute - include: tag-generic-attribute mustache-expression: - - match: '{{' - scope: punctuation.definition.template.begin.html - embed: scope:source.js - embed_scope: source.js.embedded.vue - escape: '}}' - escape_captures: - 0: punctuation.definition.template.end.html + - match: (?={{) + set: + - meta_scope: meta.template.vue + - match: '{{' + scope: punctuation.definition.template.begin.html + embed: scope:source.js + embed_scope: source.js.embedded.vue + escape: '}}' + escape_captures: + 0: meta.template.vue punctuation.definition.template.end.html + - match: '' + pop: true template-tag: - match: (<)((?i:template))\b diff --git a/Vue Component.sublime-syntax.yaml-macros b/Vue Component.sublime-syntax.yaml-macros index ed167e8..7e1b127 100644 --- a/Vue Component.sublime-syntax.yaml-macros +++ b/Vue Component.sublime-syntax.yaml-macros @@ -14,13 +14,18 @@ contexts: !merge - include: mustache-expression mustache-expression: - - match: '{{' - scope: punctuation.definition.template.begin.html - embed: scope:source.js - embed_scope: source.js.embedded.vue - escape: '}}' - escape_captures: - 0: punctuation.definition.template.end.html + - match: '(?={{)' + set: + - meta_scope: meta.template.vue + - match: '{{' + scope: punctuation.definition.template.begin.html + embed: scope:source.js + embed_scope: source.js.embedded.vue + escape: '}}' + escape_captures: + 0: meta.template.vue punctuation.definition.template.end.html + - match: '' + pop: true tag-attributes: !prepend - include: vue-directive