feat: make menu fixed size
This commit is contained in:
parent
403925def9
commit
b3dbc8eddf
@ -76,9 +76,17 @@ function M.config()
|
||||
ghost_text = true,
|
||||
},
|
||||
formatting = {
|
||||
fields = { 'menu', 'abbr', 'kind' },
|
||||
format = function(_, item)
|
||||
fields = { 'abbr', 'kind', 'menu' },
|
||||
format = function(entry, item)
|
||||
local ELLIPSIS_CHAR = '…'
|
||||
local MAX_LABEL_WIDTH = 20
|
||||
item.kind = string.format('%s %s', kind_icons[item.kind], item.kind) -- This concatonates the icons with the name of the item kind
|
||||
|
||||
local label = item.abbr
|
||||
local truncated_label = vim.fn.strcharpart(label, 0, MAX_LABEL_WIDTH)
|
||||
if truncated_label ~= label then
|
||||
item.abbr = truncated_label .. ELLIPSIS_CHAR
|
||||
end
|
||||
return item
|
||||
end,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user