redhat-developer / lsp4ij

LSP Client for IntelliJ
Eclipse Public License 2.0
105 stars 23 forks source link

semanticTokens highlighting flashes #428

Open krizej opened 3 months ago

krizej commented 3 months ago

Can be temporarily fixed by restarting pycharm, but appears again after some time (a few restarts of the lsp server? a few refreshes of the tokens? maybe with the Semantics Token Inspector tab open?). The issue persists through lsp server restarts. semtokflash

might be useful: the "Analyzing..." indicator in the top right corner was visible for the entire time this was happening image

managed to capture a screenshot of some highlights missing: image

angelozerr commented 3 months ago

I noticed that with some language servers (ex: jdt ls) the LSP IJ highlight visitor implementation is called every time.

To avoid having bad performance the LSP semanticTokens request is cached, but it seems that we can have this issue.

I have no idea why IJ call everytime the highlight visitor

angelozerr commented 2 months ago

@krizej I don't if it fixes your issue but we did an improvement for LSP sematic tokens by fixing https://github.com/redhat-developer/lsp4ij/issues/477

Please install https://github.com/redhat-developer/lsp4ij?tab=readme-ov-file#testing-nightly-builds and tell me if it fixes your issue.

Thanks!

krizej commented 2 months ago

I got to the point where the indicator in the top right is stuck at "Analyzing..." but the highlights were not flashing, which leads me to believe that the bug is solved. If anything pops up again I'll open an issue

angelozerr commented 2 months ago

I got to the point where the indicator in the top right is stuck at "Analyzing..."

Do you know if you have this problem without LSP4IJ?

but the highlights were not flashing, which leads me to believe that the bug is solved.

Great!

If anything pops up again I'll open an issue

Yes sure,thanks.

krizej commented 2 months ago

Do you know if you have this problem without LSP4IJ?

Only happens with LSP4IJ, not sure whether it's a bug with the LSP server or with LSP4IJ as the server was amateurishly written by me :-)

angelozerr commented 2 months ago

Ok thanks for your feedback. While analyzing process, do you see a lot of LSP console like publishDiagnostics or semanticTokens?

krizej commented 2 months ago

No, nothing is happening in there

angelozerr commented 2 months ago

Could you give me some directives how to install your plugin please?

And too a sample file.

krizej commented 2 months ago

I think that since my project is a huge hack for now I'm afraid it would take too much work to get it to run on your (or anyone else's) machine. However I've managed to reproduce it using ZigBrains (can be installed from within PyCharm and most likely other related IDEs, it was complaining about missing ZLS executable for me so I installed that as well)

  1. I used this file
  2. Open Semantic Tokens Inspector tab
  3. Open the file

The Inspector will act a bit weird as if it was constantly changing something but once it settles down the "Analyzing..." is still up there. From what I see this bug is rather consistent. Unfortunately it also seems like the original flashing issue is not fixed, but it is less common than before and still not consistently reproducible :-/

angelozerr commented 2 months ago

Even if semantic tokens has been improved, I reopen this issue to understand why "Analyzing..." is still up.