fix: LSP code actions not working for some language servers (#1381)

This commit is contained in:
klausweiss
2021-11-13 13:11:08 +00:00
committed by GitHub
parent 3309526566
commit b2f16c788e

View File

@@ -258,16 +258,15 @@ lsp.code_actions = function(opts)
local transform_action = opts.transform_action local transform_action = opts.transform_action
or function(action) or function(action)
-- Remove 0 -version from LSP codeaction request payload. -- Remove 0 -version from LSP codeaction request payload.
-- Is only run on lsp codeactions which contain a comand or a arguments field -- Is only run on the "java.apply.workspaceEdit" codeaction.
-- Fixed Java/jdtls compatibility with Telescope -- Fixed Java/jdtls compatibility with Telescope
-- See fix_zero_version commentary for more information -- See fix_zero_version commentary for more information
if (action.command and action.command.arguments) or action.arguments then local command = (action.command and action.command.command) or action.command
if action.command.command then if not (command == "java.apply.workspaceEdit") then
action.edit = fix_zero_version(action.command.arguments[1]) return action
else
action.edit = fix_zero_version(action.arguments[1])
end
end end
local arguments = (action.command and action.command.arguments) or action.arguments
action.edit = fix_zero_version(arguments[1])
return action return action
end end