nvim-ts-rainbow
nvim-ts-rainbow copied to clipboard
Overwriting colors not getting applied
Describe the bug if you try to overwrite the colures use in the rainbow part of the treessitter config the now colors will not get applied Steps to reproduce Steps to reproduce the behavior. use this as your treesiter configuration
local parsers = require("nvim-treesitter.parsers")
local enabled_list = {"clojure", "fennel","racket"}
require'nvim-treesitter.configs'.setup {
ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
highlight = {
enable = true, -- false will disable the whole extension
disable = { "c", "rust" }, -- list of language that will be disabled
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
rainbow = {
enable = true,
colors = {
"#E06C75",
"#E5C07B",
"#98C379",
"#56B6C2",
"#61AFEF",
"#C678DD",
"#E06C75"
},
extended_mode = true,
max_file_lines = nil,
disable = vim.tbl_filter(
function(p)
local disable = true
for _, lang in pairs(enabled_list) do
if p==lang then disable = false end
end
return disable
end, parsers.available_parsers()
)
}
}
Expected behavior
I expected the the ()
, []
, and {}
to have the colors above not the definition grouvbox colors
what happens if you add print(vim.inspect(colors))
after this line?
https://github.com/p00f/nvim-ts-rainbow/blob/54ee09f540935c604c9a3d4aed83b7f5314f2caa/lua/rainbow/internal.lua#L20
@p00f no differences I can see. sourceing the file and opening a clj file still shows the grouvbox colors
I now have
local parsers = require("nvim-treesitter.parsers")
local enabled_list = {"clojure", "fennel","racket"}
require'nvim-treesitter.configs'.setup {
ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
highlight = {
enable = true, -- false will disable the whole extension
disable = { "c", "rust" }, -- list of language that will be disabled
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
rainbow = {
enable = true,
colors = {
"#E06C75",
"#E5C07B",
"#98C379",
"#56B6C2",
"#61AFEF",
"#C678DD",
"#E06C75"
},
extended_mode = true,
print(vim.inspect(colors))
max_file_lines = nil,
disable = vim.tbl_filter(
function(p)
local disable = true
for _, lang in pairs(enabled_list) do
if p==lang then disable = false end
end
return disable
end, parsers.available_parsers()
)
}
}
no i mean the print statement should echo something to the message area, what does it echo?
I get nil
if I do :lua print(vim.inspect(colors))
what happens if you add
print(vim.inspect(colors))
after this line?https://github.com/p00f/nvim-ts-rainbow/blob/54ee09f540935c604c9a3d4aed83b7f5314f2caa/lua/rainbow/internal.lua#L20
add it after this line
ok put under that line but nothing. Not even nil
when I relaunch nvim
what happens if you add
print(vim.inspect(colors))
after this line? https://github.com/p00f/nvim-ts-rainbow/blob/54ee09f540935c604c9a3d4aed83b7f5314f2caa/lua/rainbow/internal.lua#L20add it after this line
Hm, I'm experiencing the same. I can only apply colors using vim.cmd as show in the readme, but the table I define inside treesitter is completely ignored.
The code changed quite a bit since this suggestion. Any more ideas for debugging or where to put the print statement @p00f ???
While it doesn't solve the root issue, I have this workaround in my config:
local rainbow = { "#CC8888", "#CCCC88", "#88CC88", "#88CCCC", "#8888CC", "#CC88CC" }
require "nvim-treesitter.configs".setup {
rainbow = { colors = rainbow, termcolors = rainbow }
}
for i, c in ipairs(rainbow) do -- p00f/rainbow#81
vim.cmd(("hi rainbowcol%d guifg=%s"):format(i, c))
end