Annotations only shown initially but not after editing within the associated range

Answered

I am using an annotator to provide dedicated syntax highlighting for a Groovy based DSL within a custom file type which reuses the Groovy language. However, the applied annotations are only shown on the first completion of a keyword and not when edits took place within it. The action keyword for instance initially gets highlighted, yet with one letter except for the last one removed and then added again (i.e. forcing the annotator to re-highlight the keyword) no highlighting is visible. Fascinatingly, the re-highlighting works when removing and adding parts beginning from the end of the keyword (e.g. the last letter, the last two letters, etc.) . I have already verified that after adding the deleted parts within the keyword again, the annotator creates the corresponding annotation on the respective text range just like it did with the initial highlighting.

Am I missing something here or is this behavior intended? And if so, how do I get parts re-highlighted after they have been edited?

3 comments
Comment actions Permalink

Please note Annotators run concurrently and overlapping several highlightings of INFO level can lead to unpredictable results.

0
Comment actions Permalink

I meanwhile managed to fix the problem. 

For anyone having similar problems, the approach used in IntelliJ's Gradle plugin can prove useful. Here the org.intellij.groovy.unresolvedHighlightFilter extension point is used to avoid unresolved reference annotations on DSL specific keywords.

 

0
Comment actions Permalink

Addendum (to your previous deleted comment), one can use com.intellij.codeInsight.daemon.impl.HighlightInfoPostFilter to suppress highlight infos in favor of their own Annotator.

0

Please sign in to leave a comment.