feat: make menu fixed size
This commit is contained in:
parent
403925def9
commit
b3dbc8eddf
@ -76,9 +76,17 @@ function M.config()
|
|||||||
ghost_text = true,
|
ghost_text = true,
|
||||||
},
|
},
|
||||||
formatting = {
|
formatting = {
|
||||||
fields = { 'menu', 'abbr', 'kind' },
|
fields = { 'abbr', 'kind', 'menu' },
|
||||||
format = function(_, item)
|
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
|
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
|
return item
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user