Some information (like name of package) are in menu field, not abbr. Here's screenshot with example config
Steps to reproduce
Setup cmp with lspkind and newest pyright.
Expected behavior
Information would be in abbr field.
Actual behavior
It's in menu, which doesn't get truncated by maxwidth, making some windows half-screen wide.
Additional context
I noticed it also happens in clangd 17.0.3 I have installed by mason. (This one sometimes takes full screen by function parameters after [LSP])
Like this one
But in clangd 16.0.6 installed from my system package manager this doesn't happen
This was screen wide in version 17, but in 16 function parameters are in abbr field and get truncated
I also managed to hack function parameters in menu field like this (inspired by some example from wiki)
formatting = {
fields = { "abbr", "kind", "menu" },
format = function(entry, vim_item)
local menu_length = 0
if vim_item.menu ~= nil then
menu_length = string.len(vim_item.menu)
end
local kind = require("lspkind").cmp_format({
preset = 'default',
mode = 'symbol_text',
maxwidth = 50,
ellipsis_char = '...',
menu = {
buffer = '[Buffer]',
nvim_lsp = '[LSP]',
luasnip = '[LuaSnip]',
nvim_lua = '[Lua]',
latex_symbols = '[Latex]',
},
})(entry, vim_item)
if vim_item.menu ~= nil then
local new_menu_length = string.len(vim_item.menu)
kind.menu = string.sub(vim_item.menu, 1, new_menu_length - menu_length)
end
return kind
end,
},
This is not a issue of cmp.
If you want to truncate menu field, you can implement it with formatting.format option.
(or lspkind.nvim has option for it. You can use before option. see
FAQ
Announcement
Minimal reproducible full config
Description
Some information (like name of package) are in menu field, not abbr. Here's screenshot with example config
Steps to reproduce
Setup cmp with lspkind and newest pyright.
Expected behavior
Information would be in abbr field.
Actual behavior
It's in menu, which doesn't get truncated by maxwidth, making some windows half-screen wide.
Additional context
I noticed it also happens in clangd 17.0.3 I have installed by mason. (This one sometimes takes full screen by function parameters after [LSP]) Like this one
But in clangd 16.0.6 installed from my system package manager this doesn't happen This was screen wide in version 17, but in 16 function parameters are in abbr field and get truncated
I also managed to hack function parameters in menu field like this (inspired by some example from wiki)