From cd33fbfe915d2f9f86d9e6206105a1766649de1e Mon Sep 17 00:00:00 2001 From: Brahmajit Das Date: Fri, 6 Feb 2026 06:33:46 +0530 Subject: lua: plugins: completion: lspkind configuration Signed-off-by: Brahmajit Das --- lua/plugins/completion.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lua/plugins/completion.lua') diff --git a/lua/plugins/completion.lua b/lua/plugins/completion.lua index 0fec879..5b45c39 100644 --- a/lua/plugins/completion.lua +++ b/lua/plugins/completion.lua @@ -30,6 +30,27 @@ return { local lspkind = require('lspkind') cmp.setup { + formatting = { + fields = { 'abbr', 'icon', 'kind', 'menu' }, + format = lspkind.cmp_format({ + maxwidth = { + -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) + -- can also be a function to dynamically calculate max width such as + -- menu = function() return math.floor(0.45 * vim.o.columns) end, + menu = 70, -- leading text (labelDetails) + abbr = 70, -- actual suggestion item + }, + ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) + show_labelDetails = true, -- show labelDetails in menu. Disabled by default + + -- The function below will be called before any actual modifications from lspkind + -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) + before = function(entry, vim_item) + -- ... + return vim_item + end + }) + }, snippet = { expand = function(args) require('luasnip').lsp_expand(args.body) -- For `luasnip` users. -- cgit v1.2.3