luochen1990 / rainbow

Rainbow Parentheses Improved, shorter code, no level limit, smooth and fast, powerful configuration.
Apache License 2.0
1.78k stars 95 forks source link

[Bug] 如果存在插件nvim-treesitter,那么rainbow将无效 #151

Closed fgheng closed 4 years ago

fgheng commented 4 years ago

Describe the bug

你好,我最近尝试了插件nvim-treesitter,但是安装完这个插件之后发现rainbow没有了,不太清楚是什么原因,可以看一下么。

luochen1990 commented 4 years ago

可能有语法规则重叠了,具体排查可以看一下 readme 的 troubleshooting 部分

anstadnik commented 4 years ago

This fixed an issue for me.

fgheng commented 4 years ago

This fixed an issue for me.

thank you, it helps.

    require "nvim-treesitter.highlight"
    -- use below replace  local hlmap = vim.treesitter.TSHighlighter.hl_map 
    local hlmap = vim.treesitter.highlighter.hl_map 

    --Misc
    hlmap.error = nil
    hlmap["punctuation.delimiter"] = "Delimiter"
    hlmap["punctuation.bracket"] = nil
jackcogdill commented 1 year ago

It seems that after https://github.com/nvim-treesitter/nvim-treesitter/commit/1baf751fb0b03015c4c9883a87923cc4a7a4812e the above fix no longer works.

Now I'm using the following:

autocmd vimrc BufEnter * hi clear TSPunctBracket
luochen1990 commented 1 year ago

@jackcogdill Dost “TS” in ”TSPunctBracket" here means TypeScript? Hoping for a PR if there is any generic (fits for all languages) solution.

jackcogdill commented 1 year ago

No, TS refers to treesitter.

I also tested this on a different machine, and it needed to use the old fix despite updating nvim-treesitter. Then after I updated Neovim from 0.7 -> 0.8 the new fix was necessary.

Perhaps we could make a PR if we can pin down the exact conditions where it's necessary (e.g. Neovim version >= X.Y.Z).