From f87459fc1bf26a4b8e50e232757d4682892c971d Mon Sep 17 00:00:00 2001 From: James Harris Date: Tue, 30 May 2017 06:29:46 +0100 Subject: [PATCH 01/10] Prevent mixing single & double quotes (#92) * feat: allow double or single quote for lang/type TODO: Update capture ranges to reflex changes * fix: correct pattern match * fix: revert unneeded javascript pattern * chore: generate tmLanguage * chore: re-add case-insensitivity * chore: generate tmLanguage --- vue.YAML-tmLanguage | 20 ++++++++++---------- vue.tmLanguage | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/vue.YAML-tmLanguage b/vue.YAML-tmLanguage index 2a622a8..940a1c7 100644 --- a/vue.YAML-tmLanguage +++ b/vue.YAML-tmLanguage @@ -64,7 +64,7 @@ patterns: match: (\s*)(?!--|>)\S(\s*) - name: text.slm.embedded.html - begin: (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=['"]slm(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=(['"])slm\1?) end: ()(?:\s*\n)? captures: '1': {name: punctuation.definition.tag.begin.html} @@ -80,7 +80,7 @@ patterns: - include: text.slm - name: text.jade.embedded.html - begin: (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=['"]jade(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=(['"])jade\1?) end: ()(?:\s*\n)? captures: '1': {name: punctuation.definition.tag.begin.html} @@ -96,7 +96,7 @@ patterns: - include: text.jade - name: text.pug.embedded.html - begin: (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=['"]pug(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=(['"])pug\1?) end: ()(?:\s*\n)? captures: '1': {name: punctuation.definition.tag.begin.html} @@ -113,7 +113,7 @@ patterns: - name: source.stylus.embedded.html - begin: (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=['"]stylus(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])stylus\1?) end: ()(?:\s*\n)? captures: '1': {name: punctuation.definition.tag.begin.html} @@ -129,7 +129,7 @@ patterns: - include: source.stylus - name: source.postcss.embedded.html - begin: (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=['"]postcss(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])postcss\1?) end: ()(?:\s*\n)? captures: '1': {name: punctuation.definition.tag.begin.html} @@ -145,7 +145,7 @@ patterns: - include: source.postcss - name: source.sass.embedded.html - begin: (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=['"](?:sass)(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])sass\1?) end: ()(?:\s*\n)? captures: '1': {name: punctuation.definition.tag.begin.html} @@ -162,7 +162,7 @@ patterns: - include: source.scss - name: source.scss.embedded.html - begin: (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=['"](?:scss)(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])scss\1?) end: ()(?:\s*\n)? captures: '1': {name: punctuation.definition.tag.begin.html} @@ -180,7 +180,7 @@ patterns: - name: source.less.embedded.html - begin: (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=['"]less(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])less\1?) end: ()(?:\s*\n)? captures: '1': {name: punctuation.definition.tag.begin.html} @@ -212,7 +212,7 @@ patterns: - include: source.css - name: source.coffee.embedded.html - begin: (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=['"]coffee(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=(['"])coffee\1?) beginCaptures: '1': {name: punctuation.definition.tag.begin.html} '2': {name: entity.name.tag.script.html} @@ -230,7 +230,7 @@ patterns: - include: source.coffee - name: source.livescript.embedded.html - begin: (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=['"]livescript(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=(['"])livescript\1?) beginCaptures: '1': {name: punctuation.definition.tag.begin.html} '2': {name: entity.name.tag.script.html} diff --git a/vue.tmLanguage b/vue.tmLanguage index 7bc2850..42f5f60 100644 --- a/vue.tmLanguage +++ b/vue.tmLanguage @@ -211,7 +211,7 @@ begin - (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=['"]slm(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=(['"])slm\1?) captures 1 @@ -265,7 +265,7 @@ begin - (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=['"]jade(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=(['"])jade\1?) captures 1 @@ -319,7 +319,7 @@ begin - (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=['"]pug(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=(['"])pug\1?) captures 1 @@ -373,7 +373,7 @@ begin - (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=['"]stylus(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])stylus\1?) captures 1 @@ -427,7 +427,7 @@ begin - (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=['"]postcss(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])postcss\1?) captures 1 @@ -481,7 +481,7 @@ begin - (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=['"](?:sass)(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])sass\1?) captures 1 @@ -539,7 +539,7 @@ begin - (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=['"](?:scss)(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])scss\1?) captures 1 @@ -597,7 +597,7 @@ begin - (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=['"]less(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])less\1?) captures 1 @@ -705,7 +705,7 @@ begin - (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=['"]coffee(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=(['"])coffee\1?) beginCaptures 1 @@ -767,7 +767,7 @@ begin - (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=['"]livescript(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=(['"])livescript\1?) beginCaptures 1 From 52a41f4074135f92ad52d93aad008b7d59d20894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B0=8F=E6=87=92?= Date: Tue, 3 Oct 2017 20:22:17 -0500 Subject: [PATCH 02/10] add support for script tag type text/ecmascript (#100) --- vue.YAML-tmLanguage | 2 +- vue.tmLanguage | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vue.YAML-tmLanguage b/vue.YAML-tmLanguage index 940a1c7..7582aef 100644 --- a/vue.YAML-tmLanguage +++ b/vue.YAML-tmLanguage @@ -248,7 +248,7 @@ patterns: - include: source.livescript - name: source.js.embedded.html - begin: (<)((?i:script))\b(?![^>]*/>)(?![^>]*(?i:type.?=.?text/((?!javascript|babel).*))) + begin: (<)((?i:script))\b(?![^>]*/>)(?![^>]*(?i:type.?=.?text/((?!javascript|babel|ecmascript).*))) beginCaptures: '1': {name: punctuation.definition.tag.begin.html} '2': {name: entity.name.tag.script.html} diff --git a/vue.tmLanguage b/vue.tmLanguage index 42f5f60..b8f67f4 100644 --- a/vue.tmLanguage +++ b/vue.tmLanguage @@ -829,7 +829,7 @@ begin - (<)((?i:script))\b(?![^>]*/>)(?![^>]*(?i:type.?=.?text/((?!javascript|babel).*))) + (<)((?i:script))\b(?![^>]*/>)(?![^>]*(?i:type.?=.?text/((?!javascript|babel|ecmascript).*))) beginCaptures 1 From de58cf865217c5b4d0af72d03c3f427fda031470 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 13 Nov 2017 11:13:42 -0500 Subject: [PATCH 03/10] add samples --- .gitignore | 1 - samples/arrow.vue | 8 ++++++++ samples/basic.vue | 33 +++++++++++++++++++++++++++++++++ samples/langs.vue | 28 ++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 samples/arrow.vue create mode 100644 samples/basic.vue create mode 100644 samples/langs.vue diff --git a/.gitignore b/.gitignore index fc2bb20..e43b0f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ .DS_Store -sample.vue diff --git a/samples/arrow.vue b/samples/arrow.vue new file mode 100644 index 0000000..29d0a6b --- /dev/null +++ b/samples/arrow.vue @@ -0,0 +1,8 @@ + + + diff --git a/samples/basic.vue b/samples/basic.vue new file mode 100644 index 0000000..d192aa0 --- /dev/null +++ b/samples/basic.vue @@ -0,0 +1,33 @@ + + + + + + + diff --git a/samples/langs.vue b/samples/langs.vue new file mode 100644 index 0000000..bb6d2bc --- /dev/null +++ b/samples/langs.vue @@ -0,0 +1,28 @@ + + + + + + + From 473fb79450f08349b822de5d4a8ed53301875a25 Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 26 Jan 2018 13:24:58 -0500 Subject: [PATCH 04/10] readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index e49c74e..577d8bc 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # Vue Syntax Highlight +**Note:** The `master` branch hosts the `tmLanguage` based implementation that is distributed to Sublime Text build < 3153. It is also used to power GitHub's syntax highlight of `*.vue` files in [linguist](https://github.com/github/linguist). + +For a newer implementation of the syntax that is distributed to build >=3153, See the [new](https://github.com/vuejs/vue-syntax-highlight/tree/new) branch. + +--- + Sublime Text Syntax highlighting for single-file [Vue.js](http://vuejs.org) components (enabled by [vue-loader](https://github.com/vuejs/vue-loader) or [vueify](https://github.com/vuejs/vueify)). ![screenshot](https://cloud.githubusercontent.com/assets/499550/11458853/99ed23aa-9696-11e5-9bf6-43c706487aee.png) From 5c2b5afbb3e71c87aca1eda626edbb4506571072 Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 26 Jan 2018 13:26:22 -0500 Subject: [PATCH 05/10] use newer screenshot --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 577d8bc..57b07ad 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ For a newer implementation of the syntax that is distributed to build >=3153, Se Sublime Text Syntax highlighting for single-file [Vue.js](http://vuejs.org) components (enabled by [vue-loader](https://github.com/vuejs/vue-loader) or [vueify](https://github.com/vuejs/vueify)). -![screenshot](https://cloud.githubusercontent.com/assets/499550/11458853/99ed23aa-9696-11e5-9bf6-43c706487aee.png) +![screenshot](https://raw.githubusercontent.com/vuejs/vue-syntax-highlight/new/samples/screenshot.png) ### Install From 496004255cc43a3c0c8fc8a041e5ff1cc66bac01 Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 28 Feb 2018 09:37:03 -0500 Subject: [PATCH 06/10] fix scss highlight (close #52) --- samples/basic.vue | 3 ++- samples/langs.vue | 13 +++++++++++++ vue.YAML-tmLanguage | 3 --- vue.tmLanguage | 8 -------- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/samples/basic.vue b/samples/basic.vue index d192aa0..3c7d521 100644 --- a/samples/basic.vue +++ b/samples/basic.vue @@ -12,7 +12,8 @@ Things to verify: + @click="onClick('hello')" + @click.prevent="onClick('hello')"> Hello diff --git a/samples/langs.vue b/samples/langs.vue index bb6d2bc..b96fc7c 100644 --- a/samples/langs.vue +++ b/samples/langs.vue @@ -14,6 +14,19 @@ body color primary-color + + + +