diff options
| author | Adam Stankiewicz <sheerun@sher.pl> | 2019-03-04 10:46:19 +0100 | 
|---|---|---|
| committer | Adam Stankiewicz <sheerun@sher.pl> | 2019-03-04 10:46:19 +0100 | 
| commit | 2c59360e0168334f2772d2afc7c52320bbd286bd (patch) | |
| tree | 1808e98515caf038bc54d51d412404bbe9a2c721 /after | |
| parent | 4f0bde6d67160df91875be29abae7f87587771a2 (diff) | |
| download | vim-polyglot-2c59360e0168334f2772d2afc7c52320bbd286bd.tar.gz vim-polyglot-2c59360e0168334f2772d2afc7c52320bbd286bd.zip | |
Switch jsx provider to amadeus, closes #364
Diffstat (limited to 'after')
| -rw-r--r-- | after/ftplugin/jsx.vim | 18 | ||||
| -rw-r--r-- | after/syntax/jsx.vim | 14 | 
2 files changed, 27 insertions, 5 deletions
| diff --git a/after/ftplugin/jsx.vim b/after/ftplugin/jsx.vim index 12173822..e1d689aa 100644 --- a/after/ftplugin/jsx.vim +++ b/after/ftplugin/jsx.vim @@ -13,11 +13,19 @@ endif  " modified from html.vim  if exists("loaded_matchit")    let b:match_ignorecase = 0 -  let s:jsx_match_words = '(:),\[:\],{:},<:>,' . -        \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(/\@<!>\|$\):<\@<=/\1>' -  let b:match_words = exists('b:match_words') -    \ ? b:match_words . ',' . s:jsx_match_words -    \ : s:jsx_match_words +  let s:jsx_match_words = '<\([a-zA-Z0-9.]\+\)\(>\|$\|\s\):<\/\1>' + +  if !exists('b:loaded_jsx_match_words') +    let b:loaded_jsx_match_words = 0 +  endif + +  if b:loaded_jsx_match_words == 0 +    let b:match_words = exists('b:match_words') +      \ ? b:match_words . ',' . s:jsx_match_words +      \ : s:jsx_match_words +  endif + +  let b:loaded_jsx_match_words = 1  endif  setlocal suffixesadd+=.jsx diff --git a/after/syntax/jsx.vim b/after/syntax/jsx.vim index 79911848..ac4dd616 100644 --- a/after/syntax/jsx.vim +++ b/after/syntax/jsx.vim @@ -62,6 +62,20 @@ syn region jsxRegion    \ keepend    \ extend +" Shorthand fragment support +" +" Note that since the main jsxRegion contains @XMLSyntax, we cannot simply +" adjust the regex above since @XMLSyntax will highlight the opening `<` as an +" XMLError. Instead we create a new group with the same name that does not +" include @XMLSyntax and instead uses matchgroup to get the same highlighting. +syn region jsxRegion +  \ contains=@Spell,jsxRegion,jsxChild,jsBlock,javascriptBlock +  \ matchgroup=xmlTag +  \ start=/<>/ +  \ end=/<\/>/ +  \ keepend +  \ extend +  " Add jsxRegion to the lowest-level JS syntax cluster.  syn cluster jsExpression add=jsxRegion | 
