From bed186cde514521a86087fa0f2cae733a3f17196 Mon Sep 17 00:00:00 2001 From: Amadeus Demarzi Date: Tue, 19 Feb 2019 11:49:09 +0900 Subject: [PATCH] Fragment shorthand support --- after/syntax/jsx.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/after/syntax/jsx.vim b/after/syntax/jsx.vim index 9423266..c39ea91 100644 --- a/after/syntax/jsx.vim +++ b/after/syntax/jsx.vim @@ -58,6 +58,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