mxw / vim-jsx

React JSX syntax highlighting and indenting for vim.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support Fragment Syntax

clemmy opened this issue · comments

Fragment syntax has been added to JSX which looks something like

<>I'm a fragment!</>

The spec PR is here: facebook/jsx#93.

I have started looking at it, but I'm not a Vimscript buff. The start of jsxRegion must be altered so that The contents are optional

Changing this:

  \ start=+\%(<\|\w\)\@<!<\z([a-zA-Z_][a-zA-Z0-9:\-.]*\>[:,]\@!\)\([^>]*>(\)\@!+

to this:

  \ start=+\%(<\(\|\w\)\@<!<\z([a-zA-Z_][a-zA-Z0-9:\-.]*\>[:,]\@!\)\([^>]*\)\?>(\)\@!+

is a start. But it triggers xmlError in the syntax.

This other Vim jsx plugin added support for this recently: neoclide/vim-jsx-improve#40

Not sure if their implementation would help or not. Would be great to have this feature added

Anyone on this atm? The syntax highlighting becomes pretty freaky as soon as React Fragment are present.

I have a fix for this. PR incoming.

Since this repo appears abandoned, I have forked it and fixed this issue:

amadeus/vim-jsx

I've also merged in a few of the open PRs from here. Feel free to give it a try.

@amadeus Awesome, thanks!

@amadeus Starred and installed! :)

Thank you @amadeus - Starred and installed.

@amadeus Thank you very much (y)