Skip to content

Commit ba05250

Browse files
committed
bug: prevent "' from being a valid region (which is not)
1 parent 4112c06 commit ba05250

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

syntax/vue.vim

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,19 @@ syn match htmlArg "[@#v:a-z][-:.0-9_a-z]*\>" contained
7676
" Prevent 0 lenght vue dynamic attributes from (:id="") from overflowing from
7777
" the area described by two quotes ("" or '') this works because syntax
7878
" defined earlier in the file have priority.
79-
syn match htmlString /\(\([@#:]\|v-\)[-:.0-9_a-z]*=\)\@<=["']\{2\}/ containedin=ALLBUT,htmlComment
79+
syn match htmlString /\(\([@#:]\|v-\)[-:.0-9_a-z]*=\)\@<=""/ containedin=ALLBUT,htmlComment
80+
syn match htmlString /\(\([@#:]\|v-\)[-:.0-9_a-z]*=\)\@<=''/ containedin=ALLBUT,htmlComment
8081

8182
" Actually provide the JavaScript syntax highlighting.
82-
syn region vueJavascriptInTemplate start=/\(\([@#:]\|v-\)[-:.0-9_a-z]*=\)\@<=["']/ms=e+1 keepend end=/["']/me=s-1 contains=@jsAll containedin=ALL
83+
84+
" for mustaches quotes (`{{` and `}}`)
8385
syn region vueJavascriptInTemplate matchgroup=htmlSpecialChar start=/{{/ keepend end=/}}/ contains=@jsAll containedin=ALLBUT,htmlComment
86+
" for double quotes (") and for single quotes (')
87+
syn region vueJavascriptInTemplate start=/\(\([@#:]\|v-\)[-:.0-9_a-z]*=\)\@<="/ms=e+1 keepend end=/"/me=s-1 contains=@jsAll containedin=ALL
88+
syn region vueJavascriptInTemplate start=/\(\([@#:]\|v-\)[-:.0-9_a-z]*=\)\@<='/ms=e+1 keepend end=/'/me=s-1 contains=@jsAll containedin=ALL
89+
" It's necessary to have both because we can't start a region with double
90+
" quotes and it with a single quote, and removing `keepend` would result in
91+
" side effects.
8492

8593
syntax sync fromstart
8694

0 commit comments

Comments
 (0)