feat(lsp): completion opts support custom item conversion (#30060)

Problem: Some items of completion results include function signatures that can
cause the pum to be very long when a function has many params, because pum
scales with the longest word/abbr.

Solution: add custom covert function that can customise abbr to remove params.
This commit is contained in:
glepnir
2024-08-23 03:42:27 +08:00
committed by GitHub
parent e48179f31e
commit 1f5bcc7c4e
4 changed files with 38 additions and 6 deletions

View File

@@ -1630,6 +1630,9 @@ Lua module: vim.lsp.completion *lsp-completion*
Fields: ~
• {autotrigger}? (`boolean`) Whether to trigger completion
automatically. Default: false
• {convert}? (`fun(item: lsp.CompletionItem): table`) An optional
function used to customize the transformation of an
LSP CompletionItem to |complete-items|.
*vim.lsp.completion.enable()*

View File

@@ -65,7 +65,9 @@ EVENTS
LSP
TODO
Add convert field in |vim.lsp.completion.BufferOpts| of
|vim.lsp.completion.enable()| an optional function used to customize the
transformation of an Lsp CompletionItem to |complete-items|.
LUA