diff options
Diffstat (limited to 'after/syntax/jsx.vim')
-rw-r--r-- | after/syntax/jsx.vim | 17 |
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 |