Closed sariyamelody closed 9 years ago
I'm not sure if you are describing the exact thing that I am experiencing or not, but basically I find that mxw/vim-jsx completely destroys javascript indentation behavior whenever inside jsx files. It has to be a recent change because I used it happily in our react project for a while.
So I have now removed this plugin.
Edit: Actually I may have spoke too soon. I have to test more combinations... @skyhighwings Do you use http://github.com/jelera/vim-javascript-syntax by any chance?
Edit 2: Nope, looks like vim-jsx is just screwed up on my system
@unphased—The behavior of vim-jsx is not tested with Javascript syntax files that are not the file by @pangloss mentioned in the README. Is that the one you're using? If not, or if there are other JS syntax files, vim-jsx probably breaks in all sorts of weird ways.
If you're only using pangloss/vim-javascript for your JS, it's possible a recent update there has broken something here; let me know the git hash of your HEAD and I can test locally. Also, make sure you're enabling vim-jsx according to one of the documented methods; this behavior has changed with (somewhat) recent commits.
@mxw Looks like you support pangloss/vim-javascript but not jelera/vim-javascript-syntax. jelera's syntax highlighting is way better as it supports '(' and '{'. But vim-jsx doesn't play perfectly with it. Actually, it works great except for '{'. Any chance you're interested in supporting that library as well? Either way, it's worth checking out.
Thanks for making an awesome jsx syntax highlighter.
I have no plans to support it, though I'm open to nonintrusive pull requests that implement support.
I actually find jelera's package to be worse than the pangloss for the very reason you find it better—I think over-highlighting is about (though not quite) as bad as under-highlighting, because then instead of the important stuff standing out, everything stands out, just in different colors... I intentionally depend on the pangloss package because I can comfortably recommend it.
Fair call. Thanks for the thoughtful response.
In general your point is well taken, though highlighted curly brackets in particular help me visual section the code.
If I get around to making an edit, I'll send you a pull request, but I'll probably just follow your advice.
For some reason, when this plugin is included, the rest of vim-javascript's syntax highlighting is effectively broken in the .jsx file. Functions, globals, etc all lose their highlighting.
I have noticed that this is fixed when changing https://github.com/mxw/vim-jsx/blob/master/after/syntax/javascript.vim#L30 to include
@jsAll
instead of the other Javascript syntax types, but this may not be desired for some reason or another.