mxw / vim-jsx

React JSX syntax highlighting and indenting for vim.
1.59k stars 95 forks source link

Some code is XMLified when it shouldn't be #137

Closed kirjavascript closed 7 years ago

kirjavascript commented 7 years ago

using vim-plug and pangloss/vim-javascript

correct formatting;

correct

here's the issue, the text variable is turned into an XML tag;

issue

alternative colours;

alt

minimal .vimrc;

call plug#begin('~/.vim/plugged')

Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'

call plug#end()

let g:jsx_ext_required = 0
mxw commented 7 years ago

This is a known issue. Syntax detection in vim is done via regular expressions, so it'll never be able to capture the full grammar of any sufficiently complex language. In the case of JSX, we have to detect strings like <this as the start of an XML tag in order to switch into XML mode to highlight attributes and such, which means that certain whitespace choices are forbidden.

Some might consider this a feature, not a bug ;)