fix(nvim): only trigger cmp colors when string is received
This commit is contained in:
parent
cb18ae3666
commit
82aab57df8
@ -174,6 +174,7 @@ return {
|
|||||||
convertNumHex(blue))
|
convertNumHex(blue))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if type(hl) == string then
|
||||||
local s, _, red, green, blue = string.find(hl, "rgb.*%((%d+), (%d+), (%d+).*%)")
|
local s, _, red, green, blue = string.find(hl, "rgb.*%((%d+), (%d+), (%d+).*%)")
|
||||||
if s ~= nil then
|
if s ~= nil then
|
||||||
hl = rgbToHex(red, green, blue)
|
hl = rgbToHex(red, green, blue)
|
||||||
@ -182,7 +183,8 @@ return {
|
|||||||
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),
|
||||||
|
tonumber(lightness))
|
||||||
hl = rgbToHex(red, green, blue)
|
hl = rgbToHex(red, green, blue)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -191,6 +193,7 @@ return {
|
|||||||
kind.kind = " Color"
|
kind.kind = " Color"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local strings = vim.split(kind.kind, "%s", { trimempty = true })
|
local strings = vim.split(kind.kind, "%s", { trimempty = true })
|
||||||
if not strings[2] then
|
if not strings[2] then
|
||||||
|
Loading…
Reference in New Issue
Block a user