Skip to content

Commit

Permalink
bug: prevent "' from being a valid region (which is not)
Browse files Browse the repository at this point in the history
  • Loading branch information
vhoyer committed Aug 17, 2020
1 parent 4112c06 commit ba05250
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions syntax/vue.vim
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,19 @@ syn match htmlArg "[@#v:a-z][-:.0-9_a-z]*\>" contained
" Prevent 0 lenght vue dynamic attributes from (:id="") from overflowing from
" the area described by two quotes ("" or '') this works because syntax
" defined earlier in the file have priority.
syn match htmlString /\(\([@#:]\|v-\)[-:.0-9_a-z]*=\)\@<=["']\{2\}/ containedin=ALLBUT,htmlComment
syn match htmlString /\(\([@#:]\|v-\)[-:.0-9_a-z]*=\)\@<=""/ containedin=ALLBUT,htmlComment
syn match htmlString /\(\([@#:]\|v-\)[-:.0-9_a-z]*=\)\@<=''/ containedin=ALLBUT,htmlComment

" Actually provide the JavaScript syntax highlighting.
syn region vueJavascriptInTemplate start=/\(\([@#:]\|v-\)[-:.0-9_a-z]*=\)\@<=["']/ms=e+1 keepend end=/["']/me=s-1 contains=@jsAll containedin=ALL

" for mustaches quotes (`{{` and `}}`)
syn region vueJavascriptInTemplate matchgroup=htmlSpecialChar start=/{{/ keepend end=/}}/ contains=@jsAll containedin=ALLBUT,htmlComment
" for double quotes (") and for single quotes (')
syn region vueJavascriptInTemplate start=/\(\([@#:]\|v-\)[-:.0-9_a-z]*=\)\@<="/ms=e+1 keepend end=/"/me=s-1 contains=@jsAll containedin=ALL
syn region vueJavascriptInTemplate start=/\(\([@#:]\|v-\)[-:.0-9_a-z]*=\)\@<='/ms=e+1 keepend end=/'/me=s-1 contains=@jsAll containedin=ALL
" It's necessary to have both because we can't start a region with double
" quotes and it with a single quote, and removing `keepend` would result in
" side effects.

syntax sync fromstart

Expand Down

0 comments on commit ba05250

Please sign in to comment.