mirror of
https://github.com/neovim/neovim.git
synced 2026-08-29 18:41:48 +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:
@@ -187,6 +187,21 @@ describe('vim.lsp.completion: item conversion', function()
|
||||
eq({ { word = 'text-red-300', kind_hlgroup = '@lsp.color.fca5a5', kind = '■' } }, result)
|
||||
end)
|
||||
|
||||
it('uses labelDetails for abbr and menu', function()
|
||||
local completion_list = {
|
||||
{
|
||||
label = 'printf',
|
||||
kind = 3,
|
||||
detail = 'int',
|
||||
labelDetails = { detail = '(const char *restrict, ...)', description = 'stdio.h' },
|
||||
},
|
||||
}
|
||||
local result = complete('|', completion_list)
|
||||
local item = result.items[1]
|
||||
eq('printf(const char *restrict, ...)', item.abbr)
|
||||
eq('stdio.h', item.menu)
|
||||
end)
|
||||
|
||||
---@param prefix string
|
||||
---@param items lsp.CompletionItem[]
|
||||
---@param expected table[]
|
||||
|
||||
Reference in New Issue
Block a user