Missing highlight when multiple annotators applied to same TextRange?


Hi, all

I registered two annotators for my custom language plugin, one used for color highlighting and another for syntax error highlighting.

But these two annotators can't work together. If there is an element that shoud be highlighted by both of them, only syntax annotator worked.

this is how it looks like in Java: both color and syntax annotator worked:

but in my plugin, unfortunately, only syntax error annotator worked (the second @Override annotation should be highlighted with bule color too):

As for the color highlight annotator, I use


and for the syntax highlight annotator, I use

holder.newAnnotation(HighlightSeverity.ERROR, message)

Is there any way could help me solve this? Thanks.


1) there is no order when executing Annotators, so results are by default "unpredictable"

2) text attributes will be merged only for same-level annotations (e.g. both "INFORMATION"). for this case, ERROR "wins" over "INFORMATION"

You may want to convert highlighting-only annotator to use com.intellij.codeHighlighting.TextEditorHighlightingPass


I did some debug and found that's because when error highlight happens, param "skipParentSet" of com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass#runVisitors contains the parent PsiElement that should be highlighted. In this case, the parent is excatly "@Override"......

Also you can see my keyword "class" in "class a" is not highlighted too.

Is com.intellij.codeHighlighting.TextEditorHighlightingPass able to solve this?

Or I can set forceHighlightParents to true with com.intellij.highlightRangeExtension point?


Sorry for delay. Did you find a working solution now? If not, what did you try?


I've solved this by using "HighlightInfoType.SYMBOL_TYPE_SEVERITY" in my syntax highlight annotator.

Thanks anyway :)


Thank you for posting your fix using HighlightInfoType.SYMBOL_TYPE_SEVERITY! That solved the same problem for me too.


Please sign in to leave a comment.