From 1f5bcc7c4ed7a68ae4e23933aee04c50b4df8bb5 Mon Sep 17 00:00:00 2001 From: glepnir Date: Fri, 23 Aug 2024 03:42:27 +0800 Subject: 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. --- runtime/doc/lsp.txt | 3 +++ runtime/doc/news.txt | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'runtime/doc') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 32d414e9a7..05734c3ac1 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -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()* diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 7c842f42dd..1d1e87fd0b 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -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 -- cgit