mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(lsp): fix dynamic registration of code actions (#23826)
This commit is contained in:
parent
f215a2aeaa
commit
dd3fa64573
@ -681,9 +681,16 @@ local function on_code_action_results(results, ctx, options)
|
|||||||
-- command: string
|
-- command: string
|
||||||
-- arguments?: any[]
|
-- arguments?: any[]
|
||||||
--
|
--
|
||||||
|
---@type lsp.Client
|
||||||
local client = vim.lsp.get_client_by_id(action_tuple[1])
|
local client = vim.lsp.get_client_by_id(action_tuple[1])
|
||||||
local action = action_tuple[2]
|
local action = action_tuple[2]
|
||||||
if not action.edit and client and client.supports_method('codeAction/resolve') then
|
|
||||||
|
local reg = client.dynamic_capabilities:get('textDocument/codeAction', { bufnr = ctx.bufnr })
|
||||||
|
|
||||||
|
local supports_resolve = vim.tbl_get(reg or {}, 'registerOptions', 'resolveProvider')
|
||||||
|
or client.supports_method('codeAction/resolve')
|
||||||
|
|
||||||
|
if not action.edit and client and supports_resolve then
|
||||||
client.request('codeAction/resolve', action, function(err, resolved_action)
|
client.request('codeAction/resolve', action, function(err, resolved_action)
|
||||||
if err then
|
if err then
|
||||||
vim.notify(err.code .. ': ' .. err.message, vim.log.levels.ERROR)
|
vim.notify(err.code .. ': ' .. err.message, vim.log.levels.ERROR)
|
||||||
|
Loading…
Reference in New Issue
Block a user