diff options
| author | klausweiss <mbiel@mailbox.org> | 2021-11-13 13:11:08 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-13 14:11:08 +0100 |
| commit | b2f16c788ec0f1c72a500c67f5ad93d08a646b30 (patch) | |
| tree | 20c8fec241ba07f5e6c69f329113dc23af03a49d /lua | |
| parent | 33095265665db92246165fa44db34a326e06db64 (diff) | |
fix: LSP code actions not working for some language servers (#1381)
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/telescope/builtin/lsp.lua | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lua/telescope/builtin/lsp.lua b/lua/telescope/builtin/lsp.lua index 298ef69..9b40913 100644 --- a/lua/telescope/builtin/lsp.lua +++ b/lua/telescope/builtin/lsp.lua @@ -258,16 +258,15 @@ lsp.code_actions = function(opts) local transform_action = opts.transform_action or function(action) -- 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 -- See fix_zero_version commentary for more information - if (action.command and action.command.arguments) or action.arguments then - if action.command.command then - action.edit = fix_zero_version(action.command.arguments[1]) - else - action.edit = fix_zero_version(action.arguments[1]) - end + local command = (action.command and action.command.command) or action.command + if not (command == "java.apply.workspaceEdit") then + return action end + local arguments = (action.command and action.command.arguments) or action.arguments + action.edit = fix_zero_version(arguments[1]) return action end |
