Skip to content

bug: Lsp References do not work #398

Closed

Description

@IoannisLafiotis

Did you check docs and existing issues?

  • I have read all the plugin docs
  • I have searched the existing issues
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.11.2 Build type: Release LuaJIT 2.1.1748459687

Operating system/version

MacOs Monterey 12.7.5

Describe the bug

I tried to integrate the nvim-java plugin in my nvim config.
Before that I tried also to make it work with nvim-jdtls

The result is almost the same though I do prefer the nvim java plugin because it is much cleaner.
Outside from some exception I could not get the lsp references and definition to work.
Not even the telescope plugin with its search capabilities while it works for other lsp f.e Vtls for javascript or for go

I am not sure if it has to do with my operating system or the java version. (21 correto )
https://github.com/IoannisLafiotis/Config

I also tried the lean version from the devcontainer image without any other package installed and still could not get it to work at its full potential.
Let me know If I can provide more information about it because I really want to work with nvim instead of other IDEs.

Steps To Reproduce

Try to add the root markers in the jdtls to initiate it,
Check if the lsp references or the telescope works.
Check if the Java commands work

Expected Behavior

No editor command Lsp References or no references found.
Java commands do not work.
That means that the lsp gets deattached.

Activity

  1. logrusx commented on Jul 1, 2025

    @logrusx
    Collaborator

    See the last comment in #284

  2. IoannisLafiotis commented on Jul 1, 2025

    @IoannisLafiotis
    Author

    See the last comment in #284

    I tried it. Cleaned and rebuilt the workspace. Still cannot get lsp references to work or daclarations nor the telescope functionality. Message I get back is no references found although I can check with grep that there are other files with that word!!

  3. logrusx commented on Jul 1, 2025

    @logrusx
    Collaborator

    It's actuary #384, sorry about that

  4. logrusx commented on Jul 2, 2025

    @logrusx
    Collaborator

    Hey, it's not the place to seek support in the issue, please delete your comment there and open a discussion and I'll try to help you as much as I can.

  5. IoannisLafiotis commented on Jul 2, 2025

    @IoannisLafiotis
    Author

    Hey, it's not the place to seek support in the issue, please delete your comment there and open a discussion and I'll try to help you as much as I can.

    Accidentally I posted the config on the other side.
    Still tried the solution at the 384 but could not get it to work.
    Any suggestions?

  6. logrusx commented on Jul 3, 2025

    @logrusx
    Collaborator

    One suggestion is to see the kickstart starter project and try to set it up the same way.
    The other is to upload your .config/nvim and a sample project in your repo and I'll see what I can do.

  7. IoannisLafiotis commented on Jul 4, 2025

    @IoannisLafiotis
    Author

    I have right now the latest mason versions from V1. Maybe you could share the working version from your side?

  8. logrusx commented on Jul 5, 2025

    @logrusx
    Collaborator

    Earlier I wrote another replay but then figured out my mistake and I deleted it. If you got the contents with the email notification, disregard it.

    This is my working configuration:
    https://gist.github.com/logrusx/ff0b7c600278fa96eed5208a6ffa63f2

    There are other files as well but I don't think they are essential for your case. Go To Definition and LSP References work, at least inside the project itself.

    However it didn't start installing and running the language servers out of the box, I had re restart a few times, start neovim inside a java project and open a java file, things like that. Then it cycled through versions of one and the same thing several times. Once it stops opening mason and installing stuff on its own, don't update the related mason packages(jdtls, spring-boot-tools, java-*), although update availability is indicated. Nvim-java seem to be fragile and requires specific versions from its own mason registry.

  9. IoannisLafiotis commented on Jul 5, 2025

    @IoannisLafiotis
    Author

    I implemented the changes.
    Results were no references found
    Or no LSP found.

    Java language server spins up.
    I will try to implicit the java version.
    I will double try to restart a couple of times nvim to see if it starts properly!

  10. logrusx commented on Jul 5, 2025

    @logrusx
    Collaborator

    Can you create a project from scratch, put a few classes and confirm if this is project setup related issue?

  11. logrusx commented on Aug 6, 2025

    @logrusx
    Collaborator

    I believe this is either a configuration issue or it should be fixed with #384 (or combination of both)

  12. logrusx commented on Aug 8, 2025

    @logrusx
    Collaborator

    Hello @IoannisLafiotis, after taking a look at your configuration, I believe this is a duplicate of #293

  13. pndesu commented on Aug 29, 2025

    @pndesu

    Hi, I'm having a problem that I can go to definition for methods defined in the project but can't go to the definition of the methods from external dependencies. Is this the same with the issue raised in this one? Thanks!

  14. logrusx commented on Aug 29, 2025

    @logrusx
    Collaborator

    I don't think it's the same problem. If by external dependencies you mean jar files, then this needs additional implementation which utilizes decompiler. If you have multi module project, then I have implemented changes to integrate project.nvin in my repo which when nvim is opened inside the top most directory will find definitions across modules.

  15. pndesu commented on Sep 2, 2025

    @pndesu

    Yeah, for example if I want to go to the source code of the interface UserDetails( import org.springframework.security.core.userdetails.UserDetails;), does the current state of this plugin support that feature?

  16. logrusx commented on Sep 2, 2025

    @logrusx
    Collaborator

    Yeah, for example if I want to go to the source code of the interface UserDetails( import org.springframework.security.core.userdetails.UserDetails;), does the current state of this plugin support that feature?

    then this needs additional implementation which utilizes decompiler.

    Which means no.

  17. logrusx commented on Sep 6, 2025

    @logrusx
    Collaborator

    @pndesu actually it turns out you can configure jdtls to download sources.

    Here's what I took from a nvim-jdtls configuration I found out there which did that:

                settings = {
                    java = {
                        eclipse = { downloadSources = true },
                        maven = { downloadSources = true },
                    },
                }
    

    Setup nvim-java with this, I think it's enough to make it work.

  18. s1n7ax commented on Nov 30, 2025

    @s1n7ax
    Member

    Hi try switching to v4.0.0 branch. This issue is not present in there.
    https://github.com/nvim-java/nvim-java/tree/v4.0.0

  19. added this to the v4.0.0 milestone on Nov 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions