External Annotator not called in 2023.1


I have a custom implementation of the ExternalAnnotator that works fine when running the plugin in IntelliJ 2022.3 (runPlugin gradle task)

I simply change the IntelliJ version to 2023.1 and then the annotator is never called (I tried to breakpoint in debug mode and I never pass in the class - which is the case in 2022.3)

Anyone would have a suggestions for this ? I cannot find any resource related to this


Hi Guillaume,

It's hard to tell the reason with so little details. I suggest setting a breakpoint in com.intellij.lang.ExternalLanguageAnnotators#allForFile and see if your external annotator is returned for a file and is not filtered out.


Thank you Karol, 

As a side note : indeed I had very few details to provide, but it was all I had given the feedback from the IDE and the documentation I found online regarding the subject ... and I spent hours on documentation, examples etc before actually asking the question. 
I know this is not a simple subject to solve, but deep diving in the decompiled code to find where the bug comes from is definitely not the best experience you can expect from a "plugin development framework".

That being said, your advice is indeed a good place to look for! I actually found it myself during the weekend while navigating in debug mode in the compiled code.

I actually found the source of the bug. The core code of the intelliJ had a "breaking change" regarding the external annotator resolution for a type of file. I did not look for when exactly this was introduced but basically :
- in 2022.3 the language used for looking up to external annotators could be resolved only with a custom FileType declared.
- in 2023.1 this is not the case anymore, it is coming directly from the psiRoot 
The problem was that, if you do not declare any kind of parser definition which requires to create a specific PsiFile as a root - which is hopefully attached to the right language - the external annotator is not resolved anymore as belonging to the FileType I had declared.

It happened because I am using a Language Server and a TextMate bundle as the base the all the features I need, hence I did not require any kind of parser to be actually declared... until that change.


Please sign in to leave a comment.