luochen1990/rainbow

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

fgheng opened this issue · 6 comments

Describe the bug

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

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

This fixed an issue for me.

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

It seems that after nvim-treesitter/nvim-treesitter@1baf751 the above fix no longer works.

Now I'm using the following:

autocmd vimrc BufEnter * hi clear TSPunctBracket

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

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).