rainbow icon indicating copy to clipboard operation
rainbow copied to clipboard

`function` keyword in javascript breaks highlighting the the succeeding paranthesis

Open Nader-gator opened this issue 6 years ago • 8 comments

The plugin works fine in all languages, but when I load javascript, none of the parenthesis inside a function definition are color. i use polyglot and when I disable javascript syntax highlighting(let g:polyglot_disabled = ['javascript'] ) and use the default neovim syntax mode it works fine. so I suspect this language pack that polyglot uses is the culprit but I can't figure out how to fix this. could it possibly be that the language pack is highlighting over the rainbow with its own rules? Screen Shot 2019-04-21 at 1 24 16 PM Screen Shot 2019-04-21 at 1 24 37 PM

edit: forgot to add, the same exact problem happens with ()=>{} syntax as well

Nader-gator avatar Apr 21 '19 17:04 Nader-gator

@Nader-gator will the branch fix-js-dft be helpful?

luochen1990 avatar Apr 25 '19 08:04 luochen1990

it fixed some but not all of the parenthesis and brackets. I fixed this issue myself by disabling some of the parenthesis syntax rules in vim polyglot that was preventing rainbow from highlighting the parentheses. I see that in your new commit you only added jsFuncBlock which fixes this issue with functions, but I believe to fix this issue across everything in JavaScript you need to add a lot more rules for the things that use brackets and parentheses (if statement, switch statement, etc.). regardless, I think the issue is more with the syntax rules from polyglot than it is with rainbow plugin

Nader-gator avatar May 02 '19 01:05 Nader-gator

same issue with vim-polyglot

docoder avatar May 08 '19 02:05 docoder

Could you please follow this doc to try to solve this confliction?

luochen1990 avatar May 08 '19 03:05 luochen1990

I've made some modifications but theres still some bugs. I'll make a PR when its done probably in a couple of weeks

Nader-gator avatar May 10 '19 04:05 Nader-gator

@Nader-gator will the branch fix-js-dft be helpful?

How do we add this in our vimrc?

nikinbaidar avatar Sep 13 '20 08:09 nikinbaidar

I have had the same issue. when you use the function keyword, the highlighting just don't work

nikinbaidar avatar Sep 13 '20 09:09 nikinbaidar

a workaround for me was switching from vim-javascript to https://github.com/jelera/vim-javascript-syntax

mirsella avatar Jan 03 '21 11:01 mirsella