Difference between HighlightVisitor and Annotator?

Hi guys,

I am wondering what is the difference between a HighlightVisitor and an Annotator? I am using both of them and it seems that in both cases I can highlight a PsiElement with different levels and quick fixes.
The wiki page only mentions Annotators, but most of the error highlighting in IDEA is done in HighlightVisitorImpl.

Also, when I highlight errors in my custom language using Annotator or HighlightVisitor, the file is not underwaved (in tabs and in project view). Am I missing something? Is it possible to highlight files with errors for custom languages?

Thanks
Bastien

5 comments
Comment actions Permalink

I think I misread your question. There is another extension point for highlighting the file problemFileHighlightFilter.

https://github.com/JetBrains/intellij-community/blob/master/platform/lang-impl/src/com/intellij/codeInsight/problems/WolfTheProblemSolverImpl.java

0
Comment actions Permalink

Regarding your first question, the Annotator API was created specifically for use by third-party language plugins, whereas HighlightVisitor is what IDEA itself originally used. The recommended approach is to keep using Annotator for highlighting.

0
Comment actions Permalink

OK, I changed my code to use Annotators only.

Regarding the second question, how come my files are not underlined if my annotator reports one or more errors?

Thanks

0
Comment actions Permalink

Jon answered this correctly - you need to provide an implementation of problemFileHighlightFilter.

0
Comment actions Permalink

Oh, sorry, I thought it was related to errors highlighting inside files... Thank you both for your answers!

0

Please sign in to leave a comment.