diff options
Diffstat (limited to '')
| -rw-r--r-- | lua/plugins/completion.lua | 21 |
1 files changed, 21 insertions, 0 deletions
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. |
