You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inconsistent identifier highlighting with 2025.2 #1300
This seems to be a recent regression, but I noticed that when the caret is placed on an identifier in an LSP4IJ-managed document, identifier highlighting is applied in an inconsistent/unreliable manner. Here's an example:
Hopefully that conveys the issue clearly where at first the identifier under the caret is highlighted properly, but as I click around, it stops working, though not completely. However, I no longer see textDocument/documentHighlight entries in the trace log as I click around, so that's probably a good lead on whatever is happening.
The example above is in TypeScript, but I see the same thing for other language servers as well, e.g., CSS.
Oh, and this is all with the latest published version, 0.16.1.
Yes, this is all in IntelliJ IDEA Community Edition since that doesn't have native JavaScript/TypeScript/CSS support and LSP4IJ is being used to provide support for those languages there.
Have you the same problem with old IJ?
I'm not sure. I don't have older versions of Community Edition installed, only Ultimate Edition for verification and testing of my own plugin against older versions. I noticed this a little back so my guess is that it's been happening for at least a few versions.
Hopefully it should be pretty simple to reproduce based on the description and video I provided above, but let me know if not.
The one in the demo has some additional files behind it, but I reproduced it in a standalone project with no other dependencies. That project contains the following two files:
LSP4IJ 0.16.1 is the only installed third-party plugin:
IntelliJ IDEA 2025.2.2 (Community Edition)
Build #IC-252.26199.169, built on September 18, 2025
Source revision: 7fd6c69de64ef
Runtime version: 21.0.8+1-b1038.71 aarch64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 11.0
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 2048M
Cores: 12
Registry:
ide.experimental.ui=true
llm.show.ai.promotion.window.on.start=false
Non-Bundled Plugins:
com.redhat.devtools.lsp4ij (0.16.1)
Kotlin: 252.26199.169-IJ
Here's a video of that reproduction:
As you can see, I had to click around a bit before it started happening, but once it does, it continues to do so until I close and reopen that editor tab (or perhaps even project window).
@SCWells72 according my test, this issue comes from since 2025.2. After debugging quickly, IJ call just one time LSPHighlightUsagesHandlerFactory. IJ has changed something -(
@SCWells72 according my test, this issue comes from since 2025.2. After debugging quickly, IJ call just one time LSPHighlightUsagesHandlerFactory. IJ has changed something -(
I kind of expected it might be something like that as I've noticed that identifier highlighting is lagging in my plugin as well in the more recent versions. It does eventually happen, but it's like it's a deprioritized background action.
I would recommend grabbing the stack trace by which LSPHighlightUsagesHandlerFactory is invoked -- specifically the core plugin SDK parts of that stack trace -- and demonstrating clearly that it's called more reliably in 2025.1 than in 2025.2, and logging a bug in YouTrack about this potential regression -- and minimally change in behavior -- in the newer IDE versions. I'll be curious to see what they say.
By debugging IJ it seems it caches highlight result for a given PsiElement.
It means if you click on an offset which returns your lsp semantic psi element it consumes lsp request and it is working. If you select again this element there is no lsp request and it uses the cache.
This cache seems evicted when you update the editor content.
But if you click on an offset which is not an lsp semantic tokens it uses PsiFile which covers the all ranges and after that nothing is working.
It seems highlights is working only with proper PsiFile which is unusable for lsp.
@SCWells72 according my test, this issue comes from since 2025.2. After debugging quickly, IJ call just one time LSPHighlightUsagesHandlerFactory. IJ has changed something -(
I kind of expected it might be something like that as I've noticed that identifier highlighting is lagging in my plugin as well in the more recent versions. It does eventually happen, but it's like it's a deprioritized background action.
I would recommend grabbing the stack trace by which LSPHighlightUsagesHandlerFactory is invoked -- specifically the core plugin SDK parts of that stack trace -- and demonstrating clearly that it's called more reliably in 2025.1 than in 2025.2, and logging a bug in YouTrack about this potential regression -- and minimally change in behavior -- in the newer IDE versions. I'll be curious to see what they say.
Before doing that I would like to try to fix the issue. Ineed just to understand how this cache is working
Thats strange sometimes it is working and sometimes not.
One of a usecase is when server is starting and you click on a method name. At this step lsp highlight return nothing. IJ cache the result and when you click again when server is started as it is cached lsp request is not called.
For other usecase I need to debug IJ himself but no time for the moment to do that
Activity
angelozerr commentedon Sep 26, 2025
Have you the problem with IJ community?
Have you the same problem with old IJ?
Thats strange because I dont remember having doing some changes about highlight (but perhaps I am wrong:))
SCWells72 commentedon Sep 26, 2025
Yes, this is all in IntelliJ IDEA Community Edition since that doesn't have native JavaScript/TypeScript/CSS support and LSP4IJ is being used to provide support for those languages there.
I'm not sure. I don't have older versions of Community Edition installed, only Ultimate Edition for verification and testing of my own plugin against older versions. I noticed this a little back so my guess is that it's been happening for at least a few versions.
Hopefully it should be pretty simple to reproduce based on the description and video I provided above, but let me know if not.
angelozerr commentedon Sep 26, 2025
I cannot reproduce the issue tr
Could you give me the content of the ts file that you are using in the demo?
SCWells72 commentedon Sep 26, 2025
The one in the demo has some additional files behind it, but I reproduced it in a standalone project with no other dependencies. That project contains the following two files:
Account.tsMyComponent.tsLSP4IJ 0.16.1 is the only installed third-party plugin:
Here's a video of that reproduction:
As you can see, I had to click around a bit before it started happening, but once it does, it continues to do so until I close and reopen that editor tab (or perhaps even project window).
angelozerr commentedon Sep 27, 2025
Could you test with 2025.1 please.
angelozerr commentedon Sep 27, 2025
I have tried with 2025.2 with lsp4ij installed and I can reproduce the issue. Sometimes it doesnt send the highlight lsp request?
I have tried with 2025.1 by launching lsp4ij (to debug it) and I cannot reproduce the issue?
Unfortunately I cannot start lsp4ij with 2025.2 I have an error with couroutine agent and a classnotfoundexcetion.
@sbouchet please help me :)
[-]Inconsistent identifier highlighting[/-][+]Inconsistent identifier highlighting with 2025.2[/+]angelozerr commentedon Sep 30, 2025
@SCWells72 according my test, this issue comes from since 2025.2. After debugging quickly, IJ call just one time LSPHighlightUsagesHandlerFactory. IJ has changed something -(
SCWells72 commentedon Sep 30, 2025
I kind of expected it might be something like that as I've noticed that identifier highlighting is lagging in my plugin as well in the more recent versions. It does eventually happen, but it's like it's a deprioritized background action.
I would recommend grabbing the stack trace by which
LSPHighlightUsagesHandlerFactoryis invoked -- specifically the core plugin SDK parts of that stack trace -- and demonstrating clearly that it's called more reliably in 2025.1 than in 2025.2, and logging a bug in YouTrack about this potential regression -- and minimally change in behavior -- in the newer IDE versions. I'll be curious to see what they say.angelozerr commentedon Sep 30, 2025
By debugging IJ it seems it caches highlight result for a given PsiElement.
It means if you click on an offset which returns your lsp semantic psi element it consumes lsp request and it is working. If you select again this element there is no lsp request and it uses the cache.
This cache seems evicted when you update the editor content.
But if you click on an offset which is not an lsp semantic tokens it uses PsiFile which covers the all ranges and after that nothing is working.
It seems highlights is working only with proper PsiFile which is unusable for lsp.
angelozerr commentedon Sep 30, 2025
Before doing that I would like to try to fix the issue. Ineed just to understand how this cache is working
angelozerr commentedon Sep 30, 2025
@SCWells72 after debugging IJ 2025.2, the problem comes from https://github.com/JetBrains/intellij-community/blob/fafeca54382eac161c74c2b9f53bbb767182c5da/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/IdentifierHighlightingComputer.kt#L98 when you click on an offset which return a PsiElement which have the same range than PsiFile (ex : when a file is TextMate and it returns a LeafElement), after that higlighting is broken (because it updates the cache with the empty result for the PsiFile text range).
BUT hopefully, IJ seems have fixed the issue (according the code and comment) JetBrains/intellij-community@e228f69#diff-89b4262e9397a94ab3f5746b323dbbc890185315916314e940ca4e266dc7f1bcR256
If this fix is correct, LSP highlight will be broken with 2025.2 but should fixed in future version.
angelozerr commentedon Oct 9, 2025
@SCWells72 I have tested with 2025.3 and it seems it is working again. Could you try it please.
SCWells72 commentedon Oct 9, 2025
@angelozerr, yes, it does seem to work properly again in 2025.3 EAP. I wonder if they'll backport whatever fixes that to 2025.2.4 or similar.
angelozerr commentedon Oct 9, 2025
Thats strange sometimes it is working and sometimes not.
One of a usecase is when server is starting and you click on a method name. At this step lsp highlight return nothing. IJ cache the result and when you click again when server is started as it is cached lsp request is not called.
For other usecase I need to debug IJ himself but no time for the moment to do that
angelozerr commentedon Apr 8, 2026
@SCWells72 it seems IJ 2026.1 fixes the issue right?
angelozerr commentedon Apr 22, 2026
I close the issue because it seems working with 2026.1. If it doesn't work please reopen it.
ci: the nightly tests every supported IntelliJ release that ci.yml do…
ci: the nightly tests every supported IntelliJ release that ci.yml do…