aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/util.lua
diff options
context:
space:
mode:
authorRaphael <glepnir@neovim.pro>2023-06-05 13:17:38 +0800
committerGitHub <noreply@github.com>2023-06-05 07:17:38 +0200
commit3c6d971e5488dc75b7db07c14d01f87827f28a67 (patch)
tree97b4b2dfb8898dc30a54d4ec44bc6213c5569531 /runtime/lua/vim/lsp/util.lua
parentcc41697775b0ea4a41a4f82a9e466123d4a2d77f (diff)
downloadrneovim-3c6d971e5488dc75b7db07c14d01f87827f28a67.tar.gz
rneovim-3c6d971e5488dc75b7db07c14d01f87827f28a67.tar.bz2
rneovim-3c6d971e5488dc75b7db07c14d01f87827f28a67.zip
fix(lsp): set extra info only when it has a value (#23868)
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r--runtime/lua/vim/lsp/util.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index ba8c72128e..e36014d07d 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -716,15 +716,18 @@ function M.text_document_completion_list_to_complete_items(result, prefix)
local matches = {}
for _, completion_item in ipairs(items) do
- local info = ' '
+ local info = ''
local documentation = completion_item.documentation
if documentation then
if type(documentation) == 'string' and documentation ~= '' then
info = documentation
elseif type(documentation) == 'table' and type(documentation.value) == 'string' then
info = documentation.value
- -- else
- -- TODO(ashkan) Validation handling here?
+ else
+ vim.notify(
+ ('invalid documentation value %s'):format(vim.inspect(documentation)),
+ vim.log.levels.WARN
+ )
end
end
@@ -734,7 +737,7 @@ function M.text_document_completion_list_to_complete_items(result, prefix)
abbr = completion_item.label,
kind = M._get_completion_item_kind_name(completion_item.kind),
menu = completion_item.detail or '',
- info = info,
+ info = #info > 0 and info or nil,
icase = 1,
dup = 1,
empty = 1,