mirror of
https://github.com/neovim/neovim.git
synced 2026-03-28 03:12:00 +00:00
feat(lsp): support CompletionItem.labelDetails #38403
Problem: CompletionItem.labelDetails is ignored, losing function signatures and module info in the completion menu. Solution: Append labelDetails.detail to abbr and use labelDetails.description for menu with fallback to item.detail. https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionItemLabelDetails
This commit is contained in:
@@ -443,9 +443,9 @@ function M._lsp_to_complete_items(
|
||||
local kind, kind_hlgroup = generate_kind(item)
|
||||
local completion_item = {
|
||||
word = word,
|
||||
abbr = item.label,
|
||||
abbr = ('%s%s'):format(item.label, vim.tbl_get(item, 'labelDetails', 'detail') or ''),
|
||||
kind = kind,
|
||||
menu = item.detail or '',
|
||||
menu = vim.tbl_get(item, 'labelDetails', 'description') or item.detail or '',
|
||||
info = get_doc(item),
|
||||
icase = 1,
|
||||
dup = 1,
|
||||
|
||||
Reference in New Issue
Block a user