Skip to content

Commit f073c11

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

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

syntax/vue.vim

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,16 @@ syn match htmlArg "[@#v:a-z][-:.0-9_a-z]*\>" contained
7979
syn match htmlString /\(\([@#:]\|v-\)[-:.0-9_a-z]*=\)\@<=["']\{2\}/ containedin=ALLBUT,htmlComment
8080

8181
" 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
82+
83+
" for mustaches quotes (`{{` and `}}`)
8384
syn region vueJavascriptInTemplate matchgroup=htmlSpecialChar start=/{{/ keepend end=/}}/ contains=@jsAll containedin=ALLBUT,htmlComment
85+
" for double quotes (")
86+
syn region vueJavascriptInTemplate start=/\(\([@#:]\|v-\)[-:.0-9_a-z]*=\)\@<="/ms=e+1 keepend end=/"/me=s-1 contains=@jsAll containedin=ALL
87+
" for single quotes (')
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)