styled-components / vim-styled-components

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

Syntax Highlighting Not Showing Up #52

Closed mulholo closed 5 years ago

mulholo commented 5 years ago

I can't seem to get the highlighting working and styled components are just showing up as regular template literals:

screenshot 2018-11-02 at 10 05 53

I apologise for the vague issue, but I can't think of any other relevant details. I am using neovim (although I saw that hadn't been an issue for other users).

You can find my .vimrc here: https://github.com/mulholio/dot-files/blob/master/vim/.vimrc

mulholo commented 5 years ago

I have disabled coloresque, indentLine, delimitMate and vim-polygot and none of them seem to be causing the issue.

fleischie commented 5 years ago

Hey @mulholio

I saw your issue and I will check it out as soon as I can.

I glimpsed, that you used yats. Is the above example a typescript file? Just so I know what to look for?

Edit: Looking at it much more in detail, it seems that I misinterpreted yajs with yats. :stuck_out_tongue:

fleischie commented 5 years ago

Hey @mulholio again.

Could you please elaborate why you are using sheerun/vim-polyglot as well as othree/yajs.vim?

I have to admit, this plugin was exclusively written using pangloss/vim-javascript respectively vim-polyglot (which uses the former). Thus it makes sense that using different syntax highlighting plugins are not supported out of the box, yet.

I might be able to support other javascript syntax highlighting plugins, but this unfortunately takes time and effort. So there is no easy quickfix for you that I could recommend right now besides disabling the yajs plugin.

Again, I'd appreciate a short description of what made you use yajs so maybe I get an incentive to look at it.

mulholo commented 5 years ago

I use vim-polygot to give blanket support for many languages in vim. I use yajs because it works best with my favourite colour scheme, oceanic-next. A little to use js syntax in two places, but it works.

I disabled yajs to see whta the effects would be, and it removed more highlighting across the rest of my js file than I was happy with. For the time being, therefore, I'll live with lesser support for styled-components as a trade off for a nicer colour scheme and highlighting. Hope that helps!

fleischie commented 5 years ago

@mulholio I can take a look at othree/yajs.vim, as there might be others that prefer it over sheerun/vim-polyglot or thus pangloss/vim-javascript.

I keep you updated on the progress.

fleischie commented 5 years ago

@mulholio I now took a few hours to look at how othree/yajs classifies the base javascript syntax items to hook into it/extend it/operate on it. If you could check out the develop-branch I'd appreciate some feedback. :smile:

If you don't know how, it's:

Plug 'styled-components/vim-styled-components', { 'branch': 'develop' }

in your vimrc file where you would normally do { 'branch': 'main' }.

mulholo commented 5 years ago

Thank you for the speedy response!

Still appears to be reluctant to highlight.

screenshot 2018-11-26 at 14 47 30

It appears to have done something as my consts are now a different colour, but this doesn't seem to be affecting the styled components highlighting

fleischie commented 5 years ago

@mulholio Hmm... I have to admit I merely switched out sheerun/polyglot with othree/yajs.vim in my personal .vimrc. I will check out your .vimrc directly tomorrow, and see whether I can reproduce your results with it.

mulholo commented 5 years ago

Hopefully, it's not some other random plugin causing the issue.

Thank you once again.

fleischie commented 5 years ago

@mulholio I checkout out your vimrc from above, did change to { 'branch': 'develop' } and then :PlugInstall (I saw that you use junegunn/vim-plug).

It did not actually change the branch in the plugin-path. So either run :PlugUpdate (this seems to update the branch, if it changed in the vimrc) or alternatively remove the line, run :PlugClean, add it again, and run :PlugInstall.

Let me know, if this changes anything.

NOTE: A "clean" install with { 'branch': 'develop' } (i.e. no previous plugged directory) works like a charm.

mulholo commented 5 years ago

Badabing! Working now.

I had previously called :PlugUpdate which I assumed updated to the correct branch. Might have only updated the main branch though as this didn't seem to fix the issue.

Commenting out the plugin completely, calling :PlugClean, then :PlugInstall got things working for me.