-
Hello, i am quite sure something is wrong with my config, hence I wont open a new issue, but I cannot seem to solve this by myself Overall, nvim-java works just fine with me, however I cannot go to definitions of library/external classes and methods, which is a deal breaker.
localjava_setup=require("java")java_setup.setup({java_test= {enable=false, },-- load java debugger pluginsjava_debug_adapter= {enable=false, },spring_boot_tools= {enable=false, },-- Use Java 21 for jdtls (required for Gradle 9.1.0 and Fabric Loom)jdtls= {settings= {java= {eclipse= {downloadSources=true },maven= {downloadSources=true },configuration= {runtimes= { {name="JavaSE-21",path="/usr/lib/jvm/java-21-openjdk",default=true, }, }, }, }, }, },})
require("mason").setup()locallsp_installer=load_plugin("mason-lspconfig")ifnotlsp_installerthenreturnendlocallsp_signature=load_plugin("lsp_signature")ifnotlsp_signaturethenreturnendlocallspconfig=require("lspconfig")localhandlers= { ["textDocument/hover"]=vim.lsp.with(vim.lsp.handlers.hover, {border="rounded"}), ["textDocument/signatureHelp"]=vim.lsp.with(vim.lsp.handlers.signature_help, {border="rounded"}),}localcapabilities=require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())localworkspace= {didChangeWatchedFiles= {dynamicRegistration=false, },}capabilities.workspace=workspace-- buffer = 0 : current bufferlocalon_attach=function(_,bufnr)vim.keymap.set("n","K",vim.lsp.buf.hover, {buffer=0 })vim.keymap.set("n","R",vim.lsp.buf.rename, {buffer=0 })vim.keymap.set("n","sk",vim.diagnostic.goto_prev)vim.keymap.set("n","sj",vim.diagnostic.goto_next)vim.keymap.set("n","sdb",vim.lsp.buf.definition)vim.keymap.set("n","sa",vim.lsp.buf.code_action, {buffer=0 })lsp_signature.on_attach({toggle_key="<C-h>",doc_lines=0,hint_enable=false,bind=true,handler_opts= {border="rounded", }, },bufnr)endlspconfig.jdtls.setup({on_attach=on_attach,capabilities=capabilities,handlers=handlers,}) I was hoping the comment here#398 (comment) would fix my issues, however it did not work. I am using nvim v11 and java 21 on arch linux machine |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 2 comments 7 replies
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I've found out that adding jdtls configuration somehow messes the LSP functionality. I don't know how, I don't know why. Also I don't think this is necessary. If Java 21 is your default JDK that runs when you issue Also this doesn't change what JDK jdtls runs with. It only changes the source compatibility level. What really determines what java jdtls runs with is the java version that's in your PATH. Unfortunately I don't have any time to put into nvim-java right now. Otherwise I'd go deeper in the code and try to fix all the issues users are complaining for. |
BetaWas this translation helpful?Give feedback.
All reactions
-
By adding jdtls configuration, do you mean any configuration whatsoever? Or just jdk-specific configuration? If so would u suggest not using the Also I tried setting the JDK version this way, as a last ditch effort, its just one of the many permutations of configurations I tried, but to no avail. Btw completely understandable that you don't have time right now. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Unfortunately it doesn't. I've spent a little time on this and haven't found any clues. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
After all it does seem like this is a project specific issue. This is the repo in question:https://github.com/FabricMC/fabric-example-mod Edit: I tried with barebone LazyVim distribution and the same issue is present, so most likely not a problem with my config |
BetaWas this translation helpful?Give feedback.
All reactions
-
I'm sorry to disappoint you that my Neovim configuration is not currently in a state to test things and get conclusive results due to attempts to migrate nvim-java to using the new vim.lsp API and ditch neovim-lspconfig. However I remember I had other discussions on the subject, I in some issues, some of them might be already closed, where I had posted configuration that downloaded sources for the dependencies and showed the definitions. Maybe if you show me your complete Neovim configuration I can help. At this point I've developer a laser vision for potential issues concerning nvim-java. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Understandable. Amd yes, i have went thourgh every issue or discussion in this repo (and other lol) that might point me to a solution. I think the fix you are mentioning is this one#398 (comment) howerever that did not work for me. As I said, I just tested with brand new LazyVim and its the same issue. This leads me to the conclusion that the project is setup up in a way thatneovim, or rather nvim-java/jdtls does not support, but intellij and vscode do |
BetaWas this translation helpful?Give feedback.
All reactions
-
Yes, that must be it.
I looked at the project you linked above but unfortunately it's gradle. I'm not too familiar with it. |
BetaWas this translation helpful?Give feedback.