aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/buf.lua
diff options
context:
space:
mode:
authorFolke Lemaitre <folke.lemaitre@gmail.com>2023-05-30 19:15:07 +0200
committerGitHub <noreply@github.com>2023-05-30 19:15:07 +0200
commitdd3fa645735539c75b72dc1b0114278b5fa57f7f (patch)
treee6b9abca35002d1cb4951b6c8205d8a6a26ab131 /runtime/lua/vim/lsp/buf.lua
parentf215a2aeaacb9635232cfad82de9a9674a86969c (diff)
downloadrneovim-dd3fa645735539c75b72dc1b0114278b5fa57f7f.tar.gz
rneovim-dd3fa645735539c75b72dc1b0114278b5fa57f7f.tar.bz2
rneovim-dd3fa645735539c75b72dc1b0114278b5fa57f7f.zip
fix(lsp): fix dynamic registration of code actions (#23826)
Diffstat (limited to 'runtime/lua/vim/lsp/buf.lua')
-rw-r--r--runtime/lua/vim/lsp/buf.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua
index b2f202c4ba..bb3ca0e6d6 100644
--- a/runtime/lua/vim/lsp/buf.lua
+++ b/runtime/lua/vim/lsp/buf.lua
@@ -681,9 +681,16 @@ local function on_code_action_results(results, ctx, options)
-- command: string
-- arguments?: any[]
--
+ ---@type lsp.Client
local client = vim.lsp.get_client_by_id(action_tuple[1])
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)
if err then
vim.notify(err.code .. ': ' .. err.message, vim.log.levels.ERROR)