styled-components / vim-styled-components

Vim bundle for http://styled-components.com based javascript files.
300 stars 24 forks source link

Syntax issue during linting #36

Closed sQVe closed 6 years ago

sQVe commented 6 years ago

screenfetch-2018-02-28_14-20-50

I noticed some strange syntax highlights when running vim-styled-components together with Ale today. Note above that I have two linting errors in the image above but the ) is also marked red. These marks are at times persistent and sometimes disappears after scrolling.

The issue is not there after you uninstall vim-styled-components. I'm running neovim @ 0.2.2-3.

fleischie commented 6 years ago

Can you provide me with a minimum working .vimrc or .config/nvim/init.vim, that has the above issues. And also maybe an example file, that produces the above screenshotted errors.

I'll do my best to support all the edge cases. 👍

sQVe commented 6 years ago

@fleischie I tried to make time for this but didn't manage to. I'll try to do it as soon as possible. :+1:

fleischie commented 6 years ago

No worries. I know the troubles of being overloaded with work/life. ☺️

Whenever you can make time. ✌️

sQVe commented 6 years ago

I was able to shake some time out today and I've found a config that consistently has issues in nvim. With the following config:

call plug#begin('$HOME/.local/share/nvim/plugged')
Plug 'fleischie/vim-styled-components'
Plug 'luochen1990/rainbow'
Plug 'pangloss/vim-javascript'
call plug#end()
let g:rainbow_active = 1

You can try it out against this content (the last parenthesis should be marked red):

describe('<Button>', () => {
  it('', () => {});
});

Highly worth noting is that I only see this issues if I include and enable all these plugins together. They seem to not play nicely together. Let me know if you need any further information.

fleischie commented 6 years ago

OK, cool. I will test this out first thing tomorrow and report back, as soon as I find something incriminating. Thanks for your effort so far. ✌️

sQVe commented 6 years ago

@fleischie I did some further research and rainbow is well known to, at times, not play well with different syntax highlighters. An example is that it highlights else in bash with a red color, which it shouldn't.

There are some issues that touch specifically on rainbow and vim-javascript but I have not noticed any problems with running those plugins alone. Currently rainbow adds more value for me compared to vim-styled-components, but I guess I'll have to drop rainbow as soon as this plugin adds more functionality.

fleischie commented 6 years ago

@sQVe I tried to replicate the above-mentioned errors with your given vimrc.

Unfortunately I wasn't able to reproduce any of these. Both the very first screenshot as well as the second described issue was apparent in my setup (resp. in your described minimal working example).

From my limit understanding of luochen1990/rainbow this particular plugin injects the syntax rules dynamically to extend the existing syntax rules (I can be completely wrong, though). So I really cannot give you any hints/pointers to what you should be doing.

I would of course appreciate it, if you visit once or twice in your future. But at the current time, I cannot really help you on this matter. 😭

P.S.: It seems the original issue was regarding ALE incorrectly complaining about document and console, but this might be because of the linting setup (e.g. es-lint-no-console, or maybe document plainly is undefined in this context). I don't know, whether we want to create a new issue with the rainbow-interaction directly or not. What do you think @sQVe ?

sQVe commented 6 years ago

@fleischie Are you using vim or neovim. I'm using neovim and it might very well only be visible on there.

I think we should create a new issue and just link back to this one for history. I think the main culprit here is https://github.com/luochen1990/rainbow. This is a classic case of too many chefs though.