aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorJerry Wang <WangJianJun@gmail.com>2020-12-08 20:38:52 +0800
committerJerry Wang <WangJianJun@gmail.com>2020-12-08 20:38:52 +0800
commit4f63ec78d20aa7d62e37ac3a03de8235ff17a5af (patch)
tree7cf5728261f014079b9f881d8d05cc7e5fdf4b04 /lua
parentbugfix for code action not working sometimes (diff)
downloadnvim-lspconfig-4f63ec78d20aa7d62e37ac3a03de8235ff17a5af.tar
nvim-lspconfig-4f63ec78d20aa7d62e37ac3a03de8235ff17a5af.tar.gz
nvim-lspconfig-4f63ec78d20aa7d62e37ac3a03de8235ff17a5af.tar.bz2
nvim-lspconfig-4f63ec78d20aa7d62e37ac3a03de8235ff17a5af.tar.lz
nvim-lspconfig-4f63ec78d20aa7d62e37ac3a03de8235ff17a5af.tar.xz
nvim-lspconfig-4f63ec78d20aa7d62e37ac3a03de8235ff17a5af.tar.zst
nvim-lspconfig-4f63ec78d20aa7d62e37ac3a03de8235ff17a5af.zip
added comment
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/jdtls.lua12
1 files changed, 10 insertions, 2 deletions
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