mxw / vim-jsx

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

Don't attempt to JSX highlight HTML files. #32

Closed keithpitt closed 9 years ago

keithpitt commented 9 years ago

I was having an issue where vim-jsx was interfering with my eruby syntax highlighting (filename was index.html.erb). It would highlight <%= @usern.name %> as JSX.

I made a change so it will only attempt to highlight js files if jsx files have been disallowed.

I also rearranged the file structure as per the other pull request, because that seemed to be having an effect on the problem as well.

mxw commented 9 years ago

JSX highlighting should work fine when embedded in HTML files. I'm not sure if eruby has its own syntax highlighting, or if eruby files are just recognized as plain HTML and highlighted as such.

Also, the directory restructuring doesn't work; see the other pull request for why.

Perhaps the right solution here is to add a buffer-local variable which allows you to disable JSX highlighting completely—then you can add an ftdetect for eruby that short-circuits JSX highlighting. Alternatively, why not just set the global variable that requires the .jsx extension for the syntax file to be loaded? Do you use other extensions for your JSX files?

mxw commented 9 years ago

Closing; let me know if you would like the suggested support, or you can implement it in a separate PR.