fix(nvim): fill in icons for missing ones in lspkind for cmp

This commit is contained in:
Price Hiller 2023-03-15 20:39:41 -05:00
parent df1e59de2b
commit b694b4bb05
Signed by: Price
SSH Key Fingerprint: SHA256:Y4S9ZzYphRn1W1kbJerJFO6GGsfu9O70VaBSxJO7dF8

View File

@ -27,6 +27,10 @@ cmp.setup({
spell = { symbol = "", name = "Spell", hl_group = "Spell" }, spell = { symbol = "", name = "Spell", hl_group = "Spell" },
} }
local extra_kind_icons = {
TypeParameter = ""
}
local selection = selections[entry.source.name] local selection = selections[entry.source.name]
if not selection then if not selection then
local kind = require("lspkind").cmp_format({ local kind = require("lspkind").cmp_format({
@ -34,8 +38,12 @@ cmp.setup({
maxwidth = 50, maxwidth = 50,
})(entry, vim_item) })(entry, vim_item)
local strings = vim.split(kind.kind, "%s", { trimempty = true }) local strings = vim.split(kind.kind, "%s", { trimempty = true })
if not strings[2] then
strings[2] = strings[1]
strings[1] = extra_kind_icons[strings[1]] or ""
end
kind.kind = " " .. strings[1] .. " " kind.kind = " " .. strings[1] .. " "
vim_item.menu = strings[1] .. " " .. strings[2] vim_item.menu = (strings[1] or "") .. " " .. (strings[2] or "")
return kind return kind
else else
local word = entry:get_insert_text() local word = entry:get_insert_text()