Closed dibalikpohon closed 10 months ago
I had the same issue, but seems I just places the config in the wrong file. After moving the config to $HOME/.config/nvim/ftplugin/java.lua it worked as expected. I guess the plugin is looking for this file and then overwriting your config related to jdtls if you place it else where
Same issue here. Just remove require("lvim.lsp").on_attach(client, bufnr)
and It works.
I guess the plugin is looking for this file and then overwriting your config related to jdtls if you place it else where
As the readme explains the ftplugin/
location is important. Read :help filetype-plugin
to learn more on why.
Realizing that the latest commit already called add_commands() function inside start_or_attach()
Yes, but it does so only if your on_attach
doesn't raise any errors.
Try with an empty on_attach
, or wrap more of the calls in pcall
to ensure they don't fail. E.g.:
config.on_attach = function(client, bufnr)
pcall(require("lvim.lsp").on_attach, client, bufnr)
end
Calling add_commands
or setup_dap
shouldn't be necessary anymore on the latest nvim-jdtls version.
Awesome!
I've moved entire 'on_attach' function body to another function and called it with pcall. As a result the error in on_attach_delegate became visible. Now everything works!
local function on_attach_delegate(_, bufnr)
-- actual on_attach body
end
config.on_attach = function(client, bufnr)
local res, err = pcall(on_attach_delegate, client, bufnr)
if not res then
vim.notify("Error: " .. err)
end
end
It seems that start_or_attach silently swallows the errors. I suggest to add similar handler to the start_or_attach() function.
LSP client configuration
Eclipse.jdt.ls version
v1.26.0
Steps to Reproduce
google-java-format
ServiceReady
:Jdt
then TABWhat have I done
I am having the similar issue as #393 but with different error log, followed the solution by adding
require('jdtls.setup').add_commands()
but nothing changed. Realizing that the latest commit already calledadd_commands()
function insidestart_or_attach()
Expected Result
Editor commands, such as
JdtCompile
,JdtSetRuntime
,JdtUpdateConfig
,JdtBytecode
,JdtJol
,JdtShell
,JdtRestart
are availableActual Result
JdtShowLogs
,JdtWipeDataAndRestart
are exists.jdtls-workspace
project loglsp.log
on nvimUpdate
I can run command
lua require('jdtls').*
from the editor and it works. It seems like the commandsJdtUpdateConfig
and the others gets deleted somewhere probably in my config (i'm not good at lua, so just guessing)