Skip to content

Incorrect highlight on open reference (clangd) #1153

Open

Description

@Ant-ON

Ctrl + Click lead to incorrect highlighting of the symbol for transition. Transition is performed correctly.

Server: clangd

20250625_225646.webm

Activity

  1. angelozerr commented on Jun 26, 2025

    @angelozerr
    Contributor

    Here the explanation of this behavior #98

    Which version of LSP4IJ are you trying? You should use 0.14.0.

    But clangd support LSP semantic highlight, so it should work, but perhaps semantic highlight is not ready when you open the file and you have this trouble. If you open another files have you this problem? Could you check in the LSP console that semantic highlight is called.

  2. Ant-ON commented on Jun 26, 2025

    @Ant-ON
    Author

    @angelozerr Yes, I use the LSP4IJ 0.14.0.

    I opened different files. And there was this problem.
    I cleared clangd log, pressed Ctrl + Click and seen textDocument/definition calls only

  3. angelozerr commented on Jun 26, 2025

    @angelozerr
    Contributor

    Could you share your full LSP traces.

  4. angelozerr commented on Jun 26, 2025

    @angelozerr
    Contributor

    Are you using a custom PsiFile?

  5. angelozerr commented on Jun 26, 2025

    @angelozerr
    Contributor
  6. Ant-ON commented on Jun 26, 2025

    @Ant-ON
    Author

    @angelozerr Yes, I have predefined in my plugin. But i test without it on a clean environment and I also have this problem. clangd log from the lsp4ij 0.14.1:
    lsp4ij_0_14_1_clangd.txt

  7. angelozerr commented on Jun 26, 2025

    @angelozerr
    Contributor

    Have you tried to remove your fileType (or just remove a h file extension) and test if it is working.

  8. Ant-ON commented on Jun 26, 2025

    @Ant-ON
    Author

    @angelozerr The log above is from IDE without my plugin. In the IDE with my plugin and removing the extension it also doesn't work.

    ps When testing in a clean environment, I saw a correctly working transition a couple of times, on some files. But after restarting IDE, everything didn't work again on the same files.

  9. angelozerr commented on Jun 26, 2025

    @angelozerr
    Contributor

    If I understand correctly, you are testing with the user defined ls from LSP4IJ without your plugin and it is working but when you restart IDE it doesn't work? If it that I think it is because semantic tokens is not available and the LSP semantic token provides which manages tokens is not active.

    If you have this problem it is because you have not a proper PsiFile expected by IntelliJ.

    We did a fix by creating a proper PsiFile by using semantic tokens. But if semantic token is snot available, you will have this problem.

  10. angelozerr commented on Jun 26, 2025

    @angelozerr
    Contributor
  11. Ant-ON commented on Jun 26, 2025

    @Ant-ON
    Author

    @angelozerr If I use textmate parser in my plugin, I get transitions to work, but problems with double-click selection appear on some files. Apparently, I need to implement my own PsiFile...

    But the problem with clean environment without my plugin still exists.
    Sorry, I posted clangd log instead trace. Trace is below.

    lsp4ij_0_14_1_clangd_trace.txt

  12. angelozerr commented on Jun 26, 2025

    @angelozerr
    Contributor

    @angelozerr If I use textmate parser in my plugin, I get transitions to work, but problems with double-click selection appear on some files.

    If I understand correctly, Ctrl+Click is working but double-click doesn't work? It is an another issue. doucle-click uses selectionRanges

    You should see some Trace - 11:07:54] Sending request 'textDocument/selectionRange trace (I don't see those trace in your LSP trace)

    Apparently, I need to implement my own PsiFile...

    But the problem with clean environment without my plugin still exists. Sorry, I posted clangd log instead trace. Trace is below.

    lsp4ij_0_14_1_clangd_trace.txt

  13. angelozerr commented on Jun 26, 2025

    @angelozerr
    Contributor

    It seems you are using clangd from your user/bin.

    Could you please click on Reinstall

    Image

    to consume the last version of clangd

  14. Ant-ON commented on Jun 26, 2025

    @Ant-ON
    Author

    @angelozerr Trice with the downloaded version of clangd:

    lsp4ij_0_14_1_clangd_trace_2.txt

  15. angelozerr commented on Jun 26, 2025

    @angelozerr
    Contributor

    Do you do a double click?

  16. Ant-ON commented on Jun 26, 2025

    @Ant-ON
    Author

    @angelozerr Ctrl + Click

  17. angelozerr commented on Jun 26, 2025

    @angelozerr
    Contributor

    @angelozerr Ctrl + Click

    and it doesn't work?

  18. Ant-ON commented on Jun 26, 2025

    @Ant-ON
    Author

    @angelozerr It's work, but look like in the first post.

    Enviroment: vanilla IDE + LSP4IJ 0.14.1 + installed clangd

  19. angelozerr commented on Jun 26, 2025

    @angelozerr
    Contributor

    Ok so it doesn't work, Ctrl+Click highight the full editor content. In my case it is working ?

  20. Ant-ON commented on Jun 26, 2025

    @Ant-ON
    Author

    @angelozerr Ctrl + click does not work in the standard implementation of LSP4IJ. But it works with my plugin.

  21. lagergren commented on Nov 20, 2026

    @lagergren
    Collaborator

    @Ant-ON does this still happen with 0.30.1? #1854 changed which range Ctrl+hover underlines in a file type without a language. If it still happens, an LSP console trace (verbose) of the hover would help.

  22. added
    bug
    on Nov 21, 2026
  23. added this to the 0.30.3 milestone on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdefinition

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions