Closed adoyle-h closed 2 years ago
@p00f Would you please review this PR?
You haven't addressed the comments from the first review yet
You haven't addressed the comments from the first review yet
I haven't seen any comments. Where is it?
Sorry, it only shows part of the comments when mouse hover. Click this link but nothing shows up. Can you post a screenshot of first review comments?
@p00f Thanks. The difference is that highlight default rainbowcol guifg=#FFFFFF ctermfg=nil
will throw error when termcolors[i]
is nil
.
No need complex termcolors[(i % termcolors == 0) and #termcolors or (i % termcolors)]
. Just use vim.api.nvim_set_hl
, it handles the nil
values.
It "handles" nil values by doing nothing, which is not what I want. When something is wrong, an error is better than silently doing the wrong thing
@p00f It still has problem when user set config like that,
{
colors = {
'#005f87', '#d75f00', '#87ff5f',
},
termcolors = {},
}
termcolors[(i % #termcolors == 0) and #termcolors or (i % #termcolors)]
is nil
. When user run nvim in gui, he may set termcolors = {}
.
When something is wrong, an error is better than silently doing the wrong thing
It's hard to debug the error for user. The error message shows loop or previous error loading module 'rainbow.internal'
which is no relation about termcolors = {}
. User will be confused.
https://github.com/p00f/nvim-ts-rainbow/commit/fad8badcd9baa4deb2cf2a5376ab412a1ba41797
This should be fixed now
It's hard to debug the error for user. The error message shows loop or previous error loading module 'rainbow.internal' which is no relation about termcolors = {}. User will be confused.
The user can open an issue
If you defined
{colors = { "#cc241d", "#a89984" }, termcolors = {}}
, you can't reproduce the issue. Because there are seven colors and termcolors in default config.If you defined colors more than seven,
Or colors' length more than termcolors',
then the issue can be reproduced.
close #120