mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	fix(lsp): fix dynamic registration of code actions (#23826)
This commit is contained in:
		| @@ -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) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Folke Lemaitre
					Folke Lemaitre