Closed WizardStark closed 3 months ago
Can this be reproduced without lazy?
I moved the config around to ftplugin/java.lua as per the README and it worked as expected. This was strange to me as ftplugin just uses a ft autocmd under the hood. Turns out the autocmd that I used to trigger start_or_attach() was at fault, this check broke it.
vim.api.nvim_create_autocmd("Filetype", {
pattern = "java",
callback = function()
local start_opts = resolve_opts()
-> if start_opts.root_dir and start_opts.root_dir ~= "" then
require("jdtls").start_or_attach(start_opts)
end
end,
})
After removing that it functioned as expected. Sorry for the unnecessary issue!
LSP client configuration
Eclipse.jdt.ls version
1.31.0
Steps to Reproduce
In a maven project (in this case, https://github.com/OpenAPITools/openapi-generator), call
vim.lsp.buf.definition
on a library class (either a class in a maven dependency or the Java standard library).In this case the standard
java.util.Arrays
class.Expected Result
Open relevant class file
Actual Result
I get the following error:
This seems to be very similar to #59, so I performed the steps in that issue,
The autocmd appears to be registered correctly:
When manually calling
require('jdtls').open_classfile("jdt://contents/java.base...api%5C/=/=/maven.pomderived=/true=/%3Cjava.util(Arrays.class")
the current buffer content is replaced with the appropriate Array class content.From some further debugging I identified that the bufnr set here is different than that when calling
vim.api.nvim_get_current_buf
in the current buffer, resulting inclient
being nil as no lsp is attached to this other bufnr.All other functionality of jdtls appears to work (go to definition of classes in the project, signature help, rename etc.).
Any help in this regard would be greatly appreciated