From 3aaadde81319f9bc71ad66fa46d1872ace7f1533 Mon Sep 17 00:00:00 2001 From: Jerry Wang Date: Tue, 1 Dec 2020 18:11:13 +0800 Subject: bugfix for code action not working sometimes tested on my local. --- lua/lspconfig/jdtls.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lua') diff --git a/lua/lspconfig/jdtls.lua b/lua/lspconfig/jdtls.lua index a71e634f..d83903b7 100644 --- a/lua/lspconfig/jdtls.lua +++ b/lua/lspconfig/jdtls.lua @@ -110,6 +110,8 @@ configs[server_name] = { -- TODO: (steelsojka) Handle more than one edit? if action.command == 'java.apply.workspaceEdit' then action.edit = action.arguments[1] + elseif type(action.command) == 'table' and action.command.command == 'java.apply.workspaceEdit' then + action.edit = action.command.arguments[1] end end -- cgit v1.2.3-70-g09d2 From 4f63ec78d20aa7d62e37ac3a03de8235ff17a5af Mon Sep 17 00:00:00 2001 From: Jerry Wang Date: Tue, 8 Dec 2020 20:38:52 +0800 Subject: added comment --- lua/lspconfig/jdtls.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lua') diff --git a/lua/lspconfig/jdtls.lua b/lua/lspconfig/jdtls.lua index d83903b7..0c900593 100644 --- a/lua/lspconfig/jdtls.lua +++ b/lua/lspconfig/jdtls.lua @@ -105,13 +105,21 @@ configs[server_name] = { -- Due to an invalid protocol implementation in the jdtls we have to -- conform these to be spec compliant. -- https://github.com/eclipse/eclipse.jdt.ls/issues/376 + -- Command in org.eclipse.lsp5j -> https://github.com/eclipse/lsp4j/blob/master/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/Command.java + -- CodeAction in org.eclipse.lsp4j -> https://github.com/eclipse/lsp4j/blob/master/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/CodeAction.java + -- Command in LSP -> https://microsoft.github.io/language-server-protocol/specification#command + -- CodeAction in LSP -> https://microsoft.github.io/language-server-protocol/specification#textDocument_codeAction ['textDocument/codeAction'] = function(a, b, actions) for _,action in ipairs(actions) do -- TODO: (steelsojka) Handle more than one edit? + -- if command is string, then 'ation' is Command in java format, + -- then we add 'edit' property to change to CodeAction in LSP and 'edit' will be executed first if action.command == 'java.apply.workspaceEdit' then - action.edit = action.arguments[1] + action.edit = action.edit or action.arguments[1] + -- if command is table, then 'action' is CodeAction in java format + -- then we add 'edit' property to change to CodeAction in LSP and 'edit' will be executed first elseif type(action.command) == 'table' and action.command.command == 'java.apply.workspaceEdit' then - action.edit = action.command.arguments[1] + action.edit = action.edit or action.command.arguments[1] end end -- cgit v1.2.3-70-g09d2