feat(lsp): add support for completionItem.command resolving

`command` was already resolved via a `completionItem/resolve` request
but only if `additionalTextEdits` were also present, and the
`resolveSupport` capability wasn't listed.

Closes https://github.com/neovim/neovim/issues/32406
This commit is contained in:
Mathias Fussenegger
2025-02-14 14:06:47 +01:00
committed by Mathias Fußenegger
parent c091bc3b9a
commit f20335a54c
3 changed files with 69 additions and 9 deletions

View File

@@ -610,13 +610,14 @@ local function on_complete_done()
clear_word()
if err then
vim.notify_once(err.message, vim.log.levels.WARN)
elseif result and result.additionalTextEdits then
lsp.util.apply_text_edits(result.additionalTextEdits, bufnr, position_encoding)
elseif result then
if result.additionalTextEdits then
lsp.util.apply_text_edits(result.additionalTextEdits, bufnr, position_encoding)
end
if result.command then
completion_item.command = result.command
end
end
apply_snippet_and_command()
end, bufnr)
else