summaryrefslogtreecommitdiffstats
path: root/after/syntax/jsx.vim
diff options
context:
space:
mode:
Diffstat (limited to 'after/syntax/jsx.vim')
-rw-r--r--after/syntax/jsx.vim14
1 files changed, 14 insertions, 0 deletions
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