Closed CharlesChiuGit closed 1 year ago
Hi there! I do have it working with cmp.
Your error message seems a bit strange, what are you trying to concatenate on line 86 exactly? Could it be a lazy loading issue? I'm pretty sure this plugin needs to be available by the time cmp is loaded.
Aha! That's probably why, thanks for the hint!
In my cmp.lua
line 86, it's formatting cmp sources like so:
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
local kind = lspkind.cmp_format({
mode = "symbol_text",
maxwidth = 50,
symbol_map = vim.tbl_deep_extend("force", icons.kind, icons.type, icons.cmp),
})(entry, vim_item)
local strings = vim.split(kind.kind, "%s", { trimempty = true })
kind.kind = " " .. strings[1] .. " "
kind.menu = " (" .. strings[2] .. ")"
return kind
end,
},
Maybe I just need to add a codeium icon for lspkind to display.
That sounds like it should fix it :tada:
For reference, I use a much more boring approach where my format
function looks like:
format = function(entry, item)
-- Icons
item.kind = string.format("%s", require("plugins.completion.icons")[item.kind])
-- Sources Labels
item.menu = ({
nvim_lsp = "[L]",
codeium = "IA",
buffer = "[B]",
path = "[P]",
luasnip = "[S]",
emoji = "[E]",
})[entry.source.name]
return item
end,
And the icons are just a dumb table (Suggestion is the one for Codeium):
return {
Text = "₸",
Method = "m",
Function = "⨍",
Constructor = "🛠",
Field = "",
Variable = "",
Class = "🖧",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "⚿",
Snippet = "",
Color = "",
File = "🖹",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "ℇ",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "ナ",
Suggestion = "✨",
}
I would suggest you mess around with the format function to figure out why strings[2]
is coming out nil
.
Can't really be any more specific since I don't use lspkind
so I'm missing context there :stuck_out_tongue:
Good luck!
Tks! Will try after I got home.
fixed with PR #25
Below error happened when I enable
codeium
as a cmp source. I think it might related to the callbacks from codeium server not fitting cmp's format. This makes it unusable as a cmp source.My codeium setup:
require("codeium").setup({})
OS: Ubuntu 22.04 with all the required tools installed.