fix(nvim): only trigger cmp colors when string is received
This commit is contained in:
parent
cb18ae3666
commit
82aab57df8
@ -174,21 +174,24 @@ return {
|
|||||||
convertNumHex(blue))
|
convertNumHex(blue))
|
||||||
end
|
end
|
||||||
|
|
||||||
local s, _, red, green, blue = string.find(hl, "rgb.*%((%d+), (%d+), (%d+).*%)")
|
if type(hl) == string then
|
||||||
if s ~= nil then
|
local s, _, red, green, blue = string.find(hl, "rgb.*%((%d+), (%d+), (%d+).*%)")
|
||||||
hl = rgbToHex(red, green, blue)
|
if s ~= nil then
|
||||||
end
|
hl = rgbToHex(red, green, blue)
|
||||||
|
end
|
||||||
|
|
||||||
local start, _, hue, saturation, lightness = hl:find(
|
local start, _, hue, saturation, lightness = hl:find(
|
||||||
"hsl.*%((%d+), (%d+)%%, (%d+)%%.*%)")
|
"hsl.*%((%d+), (%d+)%%, (%d+)%%.*%)")
|
||||||
if start ~= nil then
|
if start ~= nil then
|
||||||
red, green, blue = hslToRgb(tonumber(hue), tonumber(saturation), tonumber(lightness))
|
red, green, blue = hslToRgb(tonumber(hue), tonumber(saturation),
|
||||||
hl = rgbToHex(red, green, blue)
|
tonumber(lightness))
|
||||||
end
|
hl = rgbToHex(red, green, blue)
|
||||||
|
end
|
||||||
|
|
||||||
if hl:match("^#?%x%x%x%x%x%x$") ~= nil then
|
if hl:match("^#?%x%x%x%x%x%x$") ~= nil then
|
||||||
kind.kind_hl_group = handle_color_hl(hl)
|
kind.kind_hl_group = handle_color_hl(hl)
|
||||||
kind.kind = " Color"
|
kind.kind = " Color"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user