diff --git a/Vue Component.sublime-syntax b/Vue Component.sublime-syntax index a234cb2..41c14f4 100644 --- a/Vue Component.sublime-syntax +++ b/Vue Component.sublime-syntax @@ -12,6 +12,9 @@ file_extensions: - wpy variables: + # CSS specific variables + # ====================== + # Embedded script and style syntaxes may be wrapped into html comments for # historical reasons. The following patterns match them, while maintaining # correct boundaries of embedded source scopes. That's required to enable @@ -44,14 +47,12 @@ variables: # or standalone html comment end punctuation in a line | ^ (\s*) (-->) \s* $ ) - template_content_begin: '{{script_content_begin}}' - template_content_end: |- - (?x: - # optional html comment end punctuation followed by tag - (?: (\s*) (-->) \s* )? (?=) \s* $ - ) + + # Vue specific variables + # ====================== + + template_content_begin: ^|(?=[{{ascii_space}}]*\S) + template_content_end: (?=(?:^\s*)? -// <- source.js.embedded.html - source source -// ^ source.js.embedded.html - source source // ^^^^^^^^^ meta.tag - source @@ -47,13 +45,11 @@ -//^^ source.js.embedded.html - meta.tag - comment -// ^^^^ - source - meta.tag -// ^^^ comment.block.html punctuation.definition.comment.end.html +// ^^^ comment.block.html punctuation.definition.comment.end.html - source +// ^ - comment - source var i = 0; // ^^^^^^^^^^^^ - source @@ -68,7 +64,6 @@ // ^ punctuation.definition.tag.end.html // ^ - meta.tag - comment // ^^^^ comment.block.html punctuation.definition.comment.begin.html -// ^ source.js.embedded.html - source source var foo = 100; // <- source.js.embedded.html - source source @@ -77,12 +72,9 @@ // ^^^ source.js.embedded.html keyword.operator - comment --> -// ^ source.js.embedded.html - source source -// ^^^^^^^^^^^^^^ - source -// ^ - meta.tag - comment -// ^^^^^^^^^ meta.tag -// ^ - meta.tag -// ^^^ comment.block.html punctuation.definition.comment.end.html +// ^^^ comment.block.html punctuation.definition.comment.end.html - source +// ^ - comment - meta.tag - source +// ^^^^^^^^^ meta.tag - comment - source // ^^ punctuation.definition.tag.begin.html // ^^^^^^ entity.name.tag // ^ punctuation.definition.tag.end.html @@ -98,7 +90,6 @@ // ^ punctuation.separator.key-value.html // ^^^^^^^^^^^^^^^^^ string.quoted.double.html // ^^^^ comment.block.html punctuation.definition.comment.begin.html -// ^ source.js.embedded.html var foo = 100; // <- source.js.embedded.html - source source @@ -107,12 +98,9 @@ // ^^^ source.js.embedded.html keyword.operator - comment --> -// ^ source.js.embedded.html - source source -// ^^^^^^^^^^^^^^ - source -// ^ - meta.tag - comment -// ^^^^^^^^^ meta.tag -// ^ - meta.tag -// ^^^ comment.block.html punctuation.definition.comment.end.html +// ^^^ comment.block.html punctuation.definition.comment.end.html - source +// ^ - comment - meta.tag - source +// ^^^^^^^^^ meta.tag - comment - source // ^^ punctuation.definition.tag.begin.html // ^^^^^^ entity.name.tag // ^ punctuation.definition.tag.end.html @@ -128,10 +116,13 @@ // <- source.js.embedded.html - source source // ^^^^^^^^^^^^^^^^ source.js.embedded.html - source source -// <- source.js.embedded.html - source source -// ^ source.js.embedded.html - source source // ^^^^^^^^^ meta.tag - source + + + // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag - meta.tag meta.tag - source // ^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.lang.html - meta.attribute-with-value meta.attribute-with-value @@ -148,109 +139,118 @@ // <- source.coffee.embedded.html - source source -// <- source.coffee.embedded.html - source source -//^^ source.coffee.embedded.html - source source // ^^^^^^^^^ meta.tag - source -// <- - source - comment - meta.tag -//^^ - source - comment - meta.tag // ^^^^^^^^^ meta.tag - source + + + -// <- source.jsx.embedded.html - source source -//^^ source.jsx.embedded.html - source source // ^^^^^^^^^ meta.tag - source -// <- - source - comment - meta.tag -//^^ - source - comment - meta.tag // ^^^^^^^^^ meta.tag - source + + + -// <- source.livescript.embedded.html - source source -//^^ source.livescript.embedded.html - source source // ^^^^^^^^^ meta.tag - source -// <- - source - comment - meta.tag -//^^ - source - comment - meta.tag // ^^^^^^^^^ meta.tag - source + + -// <- source.ts.embedded.html - source source -//^^ source.ts.embedded.html - source source // ^^^^^^^^^ meta.tag - source -// <- - source - comment - meta.tag -//^^ - source - comment - meta.tag // ^^^^^^^^^ meta.tag - source + + + -// <- source.tsx.embedded.html - source source -//^^ source.tsx.embedded.html - source source // ^^^^^^^^^ meta.tag - source -// <- - source - comment - meta.tag -//^^ - source - comment - meta.tag // ^^^^^^^^^ meta.tag - source diff --git a/tests/syntax_test_style.vue b/tests/syntax_test_style.vue index 54de7e8..36a3fac 100644 --- a/tests/syntax_test_style.vue +++ b/tests/syntax_test_style.vue @@ -37,24 +37,20 @@ // <- source.css.embedded.html -// <- source.css.embedded.html - source source -// ^ source.css.embedded.html - source source // ^^^^^^^^ meta.tag - source // ^^^^^^^^ meta.tag - source @@ -67,18 +63,16 @@ // ^ punctuation.definition.tag.end.html // ^ - meta.tag - comment // ^^^^ comment.block.html punctuation.definition.comment.begin.html -// ^ source.css.embedded.html - source source h1 {} // <- source.css.embedded.html - source source --> -// ^ source.css.embedded.html - source source -// ^^^^^^^^^^^^^ - source -// ^ - meta.tag - comment -// ^^^^^^^^ meta.tag -// ^ - meta.tag -// ^^^ comment.block.html punctuation.definition.comment.end.html +// <- - comment +//^^ - comment +// ^^^ comment.block.html punctuation.definition.comment.end.html - source +// ^ - comment - meta.tag - source +// ^^^^^^^^ meta.tag - comment - source // ^^ punctuation.definition.tag.begin.html // ^^^^^ entity.name.tag // ^ punctuation.definition.tag.end.html @@ -94,18 +88,16 @@ // ^ punctuation.separator.key-value.html // ^^^^^^^^^^ string.quoted.double.html // ^^^^ comment.block.html punctuation.definition.comment.begin.html -// ^ source.css.embedded.html h1 {} // <- source.css.embedded.html - source source --> -// ^ source.css.embedded.html - source source -// ^^^^^^^^^^^^^ - source -// ^ - meta.tag - comment -// ^^^^^^^^ meta.tag -// ^ - meta.tag -// ^^^ comment.block.html punctuation.definition.comment.end.html +// <- - comment +//^^ - comment +// ^^^ comment.block.html punctuation.definition.comment.end.html - source +// ^ - comment - meta.tag - source +// ^^^^^^^^ meta.tag - comment - source // ^^ punctuation.definition.tag.begin.html // ^^^^^ entity.name.tag // ^ punctuation.definition.tag.end.html @@ -122,11 +114,13 @@ // <- source.css.embedded.html - source source -// <- source.css.embedded.html - source source -// ^ source.css.embedded.html - source source // ^^^^^^^^ meta.tag - source + + // ^^^^^^^^^^^^^^^^^^^ meta.tag - source // ^^^^^^^^^^^ meta.attribute-with-value.lang.html - meta.attribute-with-value meta.attribute-with-value @@ -138,112 +132,151 @@ // <- source.less.embedded.html - source source -// <- source.less.embedded.html - source source -//^^ source.less.embedded.html - source source // ^^^^^^^^ meta.tag - source + // <- - source - comment - meta.tag //^^ - source - comment - meta.tag // ^^^^^^^^ meta.tag - source + + -// <- source.postcss.embedded.html -//^^ source.postcss.embedded.html // ^^^^^^^^ meta.tag - source + -// <- - source - comment - meta.tag -//^^ - source - comment - meta.tag // ^^^^^^^^ meta.tag - source + + -// <- source.sss.embedded.html - source source -//^^ source.sss.embedded.html - source source // ^^^^^^^^ meta.tag - source + -// <- - source - comment - meta.tag -//^^ - source - comment - meta.tag // ^^^^^^^^ meta.tag - source + + -// <- source.sass.embedded.html - source source -//^^ source.sass.embedded.html - source source // ^^^^^^^^ meta.tag - source + -// <- - source - comment - meta.tag -//^^ - source - comment - meta.tag // ^^^^^^^^ meta.tag - source + + -// <- source.scss.embedded.html - source source -//^^ source.scss.embedded.html - source source // ^^^^^^^^ meta.tag - source + +// ^^^^^^^^ meta.tag - source + + + + + +// ^^^^^^^^ meta.tag - source + + + -// <- - source - comment - meta.tag -//^^ - source - comment - meta.tag // ^^^^^^^^ meta.tag - source diff --git a/tests/syntax_test_template.vue b/tests/syntax_test_template.vue index c725b3a..b2998d4 100644 --- a/tests/syntax_test_template.vue +++ b/tests/syntax_test_template.vue @@ -19,25 +19,17 @@ // ^^^^^^^^^^^^^^^^^^^^^^ meta.tag - source -// ^^^^^ text.jade.embedded.html - meta.tag -// ^^^^ - meta.tag - source -// ^^^ comment.block.html punctuation.definition.comment.end.html +// ^^^^^^^^^ text.jade.embedded.html - meta.tag - comment // ^^^^^^^^^^^ meta.tag - source // ^^^^^^^^^^^^^^^^^^^^^^ meta.tag - source -// ^^^^^ - meta.tag - source -// ^^^^ punctuation.definition.comment.begin.html -// ^^^^^ text.jade.embedded.html - meta.tag -// ^^^^ - meta.tag - source -// ^^^ comment.block.html punctuation.definition.comment.end.html +// ^^^^^^^^^^^^^^ text.jade.embedded.html - meta.tag - comment // ^^^^^^^^^^^ meta.tag - source @@ -46,8 +38,6 @@ // <- text.jade.embedded.html -// <- text.jade.embedded.html -//^^ text.jade.embedded.html // ^^^^^^^^^^^ meta.tag - meta.tag meta.tag - text.jade @@ -60,12 +50,9 @@ // ^^^^ entity.other.attribute-name.html // ^ punctuation.separator.key-value.html // ^ punctuation.definition.tag.end.html -// ^ - text.jade // <- text.jade.embedded.html -// <- text.jade.embedded.html -//^^ text.jade.embedded.html // ^^^^^^^^^^^ meta.tag - meta.tag meta.tag - text.jade // ^^ punctuation.definition.tag.begin.html // ^^^^^^^^ entity.name.tag.template.html @@ -80,12 +67,9 @@ // ^^^^ entity.other.attribute-name.html // ^ punctuation.separator.key-value.html // ^ punctuation.definition.tag.end.html -// ^ - text.pug // <- text.pug.embedded.html -// <- text.pug.embedded.html -//^^ text.pug.embedded.html // ^^^^^^^^^^^ meta.tag - meta.tag meta.tag - text.pug // ^^ punctuation.definition.tag.begin.html // ^^^^^^^^ entity.name.tag.template.html @@ -100,12 +84,9 @@ // ^^^^ entity.other.attribute-name.html // ^ punctuation.separator.key-value.html // ^ punctuation.definition.tag.end.html -// ^ - text.slim // <- text.slim.embedded.html -// <- text.slim.embedded.html -//^^ text.slim.embedded.html // ^^^^^^^^^^^ meta.tag - meta.tag meta.tag - text.slm // ^^ punctuation.definition.tag.begin.html // ^^^^^^^^ entity.name.tag.template.html