summaryrefslogtreecommitdiffstats
path: root/after/syntax/jsx.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2016-05-02 10:42:37 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2016-05-02 10:42:37 +0200
commit5dd1a7e83966c92d220073185f1738dfe441f59e (patch)
tree9c4bee389a51a9bb111dcc894c9db0f6d1809d81 /after/syntax/jsx.vim
parentbc098370c1bb81840734f5764f431dee270e75ce (diff)
downloadvim-polyglot-5dd1a7e83966c92d220073185f1738dfe441f59e.tar.gz
vim-polyglot-5dd1a7e83966c92d220073185f1738dfe441f59e.zip
Update
Diffstat (limited to 'after/syntax/jsx.vim')
-rw-r--r--after/syntax/jsx.vim17
1 files changed, 12 insertions, 5 deletions
diff --git a/after/syntax/jsx.vim b/after/syntax/jsx.vim
index 0aafca12..de544a37 100644
--- a/after/syntax/jsx.vim
+++ b/after/syntax/jsx.vim
@@ -32,12 +32,23 @@ endif
" - othree/yajs.vim: javascriptNoReserved
+" JSX attributes should color as JS. Note the trivial end pattern; we let
+" jsBlock take care of ending the region.
+syn region xmlString contained start=+{+ end=++ contains=jsBlock,javascriptBlock
+
+" JSX child blocks behave just like JSX attributes, except that (a) they are
+" syntactically distinct, and (b) they need the syn-extend argument, or else
+" nested XML end-tag patterns may end the outer jsxRegion.
+syn region jsxChild contained start=+{+ end=++ contains=jsBlock,javascriptBlock
+ \ extend
+
" Highlight JSX regions as XML; recursively match.
"
" Note that we prohibit JSX tags from having a < or word character immediately
" preceding it, to avoid conflicts with, respectively, the left shift operator
" and generic Flow type annotations (http://flowtype.org/).
-syn region jsxRegion contains=@XMLSyntax,jsxRegion,jsBlock,javascriptBlock
+syn region jsxRegion
+ \ contains=@XMLSyntax,jsxRegion,jsxChild,jsBlock,javascriptBlock
\ start=+\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\)+
\ skip=+<!--\_.\{-}-->+
\ end=+</\z1\_\s\{-}>+
@@ -45,10 +56,6 @@ syn region jsxRegion contains=@XMLSyntax,jsxRegion,jsBlock,javascriptBlock
\ keepend
\ extend
-" JSX attributes should color as JS. Note the trivial end pattern; we let
-" jsBlock take care of ending the region.
-syn region xmlString contained start=+{+ end=++ contains=jsBlock,javascriptBlock
-
" Add jsxRegion to the lowest-level JS syntax cluster.
syn cluster jsExpression add=jsxRegion