aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig
diff options
context:
space:
mode:
authorHirokazu Hata <h.hata.ai.t@gmail.com>2020-12-09 23:07:26 +0900
committerGitHub <noreply@github.com>2020-12-09 23:07:26 +0900
commit28f7d819947f4e8634260dd29fda47a23d8f0a98 (patch)
tree6a843cd5d8bffde409521577e05babbb17364707 /lua/lspconfig
parentMerge pull request #439 from benawas/master (diff)
parentadded comment (diff)
downloadnvim-lspconfig-28f7d819947f4e8634260dd29fda47a23d8f0a98.tar
nvim-lspconfig-28f7d819947f4e8634260dd29fda47a23d8f0a98.tar.gz
nvim-lspconfig-28f7d819947f4e8634260dd29fda47a23d8f0a98.tar.bz2
nvim-lspconfig-28f7d819947f4e8634260dd29fda47a23d8f0a98.tar.lz
nvim-lspconfig-28f7d819947f4e8634260dd29fda47a23d8f0a98.tar.xz
nvim-lspconfig-28f7d819947f4e8634260dd29fda47a23d8f0a98.tar.zst
nvim-lspconfig-28f7d819947f4e8634260dd29fda47a23d8f0a98.zip
Merge pull request #429 from jerrywang1981/master
Diffstat (limited to 'lua/lspconfig')
-rw-r--r--lua/lspconfig/jdtls.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/lua/lspconfig/jdtls.lua b/lua/lspconfig/jdtls.lua
index a71e634f..0c900593 100644
--- a/lua/lspconfig/jdtls.lua
+++ b/lua/lspconfig/jdtls.lua
@@ -105,11 +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.edit or action.command.arguments[1]
end
end