mxw / vim-jsx

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

Erroneous highlight matching #48

Closed dhruvarora closed 9 years ago

dhruvarora commented 9 years ago

image

For the above fragment, the <div> and its corresponding </div> around the Hello World string don't match.

mxw commented 9 years ago

Unable to repro. Please verify that you (a) have installed all the dependencies required; (b) either have the (deprecated) JSX pragma at the top of your file or have named your file with the .jsx extension; and (c) are not hitting any conflicts with other vim packages (you can test this by just unincluding them and seeing the resultant behavior).

dhruvarora commented 9 years ago

Unable to resolve unfortunately-- could you tell me what Vim theme you're using? It might be a color scheme issue!

mxw commented 9 years ago

I'm using solarized, but I doubt that's the issue. If you want to send me links to a gist of the most trimmed-down ~/.vimrc you tested that still fails, as well as a gist of the full file where the failure is occurring (with the appropriate filename), I can try to help you debug further.

dhruvarora commented 9 years ago

vimrc: here code : here

Thanks so much for this! You're awesome!

mxw commented 9 years ago

The issue is almost certainly that you're using two conflicting JS syntax packages... vim-jsx is only known to function with pangloss/vim-javascript at this time. If you comment out the jelera plugin, do things work?

dhruvarora commented 9 years ago

Unfortunately they don't. I've left in only pangloss/vim-javascript and vim-jsx and I end up with the same issue. I'm not using any highlighting packages which is what makes this issue rather confusing.

mxw commented 9 years ago

Oh, strange...

Apologies in advance if I don't get to solving this very quickly, but...

What plugin manager are you using? It doesn't look like pathogen or Vundle, which are the only ones I'm familiar with. I'm also not sure what things like syntastic or emmet-vim do. What happens if you comment out literally everything from your ~/.vimrc except the lines of code that include the plugins and the ones that turn syntax on? (I don't see a call to syntax enable anywhere... maybe your plugin manager handles it? But what happens if you add that line after the plugin init sequence?)

dhruvarora commented 9 years ago

That's okay -- It's not a major issue just a bit annoying to look at tags.

I use vim-plug which is pretty much identical to vundle -- just more lightweight.

Syntastic is a syntax checking plugin that runs code through an external syntax checkers.

I've commented everything out but this plugin and pangloss but I still get the same error. I've additionally changed themes but still get the same error.

I think I accidentally deleted syntax enable when I moved the file to gist. It's definitely in my .vimrc. Sorry about that.

lionelB commented 9 years ago

Hi! Glad to see I'm not alone since I've exactly the same issue. Did you manage to get the same color match for opening and closing tag ? For instance, I 'm using a base16 theme for both vim and Terminal.app (theme a generated using the base16-builder

lionelB commented 9 years ago

I've made a quick test using this vimrc file on macVim

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'pangloss/vim-javascript'
Plugin 'mxw/vim-jsx'

call vundle#end()   
filetype plugin indent on

:set regexpengine=1
:syntax enable
let g:jsx_ext_required = 0

syntax on
set background=dark
colorscheme base16-default

the colorscheme is on gist

Here is screen capture from macVim capture d ecran 2015-10-05 a 16 16 44

mxw commented 9 years ago

What happens when you set let g:jsx_ext_required = 1? This is working fine for me, both with and without JSX support enabled; if you can repro with vim-jsx disabled, then maybe your pangloss/javascript version is too old.

It's also weird to me that your and

tags are mishighlighted. They're fine for me—although, oddly, the closing brace for the HomePage class is highlighted like "export" for me, and deleting "export" fixes it...

Surprisingly enough, I am actually not a JS developer and am totally out of the loop on ES6, so I pretty much have no idea what is happening in that file and how it "ought" to highlight :\

lionelB commented 9 years ago

Hello, thanks to take time on my odd problem. doing let g:jsx_ext_required = 1 and openning jsx fil (I use js extension) turn jsx coloring off (except for "quoted string")

I can't figure if it come from the colorscheme or from vim-jsx :/ Can I ask you which color scheme you have, to check if I have the correct output ?