public abstract class ExternalAnnotator<InitialInfoType,AnnotationResultType>
extends java.lang.Object
Annotators work in three steps:
collectInformation(PsiFile, Editor, boolean)
is called to collect some data about a file needed for launching a tooldoAnnotate(InitialInfoType)
which executes a tool and collect highlighting dataapply(com.intellij.psi.PsiFile, AnnotationResultType, com.intellij.lang.annotation.AnnotationHolder)
ExternalLanguageAnnotators
Constructor and Description |
---|
ExternalAnnotator() |
Modifier and Type | Method and Description |
---|---|
void |
apply(PsiFile file,
AnnotationResultType annotationResult,
AnnotationHolder holder)
Applies collected annotations to the given annotation holder.
|
InitialInfoType |
collectInformation(PsiFile file) |
InitialInfoType |
collectInformation(PsiFile file,
Editor editor,
boolean hasErrors)
Collects initial information needed for launching a tool.
|
AnnotationResultType |
doAnnotate(InitialInfoType collectedInfo)
Collects full information required for annotation.
|
java.lang.String |
getPairedBatchInspectionShortName()
Returns an inspection that should run in batch mode.
|
public InitialInfoType collectInformation(PsiFile file)
public InitialInfoType collectInformation(PsiFile file, Editor editor, boolean hasErrors)
DumbAware
annotators are skipped during indexing.file
- a file to annotateeditor
- an editor in which file's document residehasErrors
- indicates if file has errors detected by preceding analysesExternalAnnotator#doAnnotate(InitialInfoType)
, or null
if not applicablepublic AnnotationResultType doAnnotate(InitialInfoType collectedInfo)
collectedInfo
- initial information gathered by collectInformation(com.intellij.psi.PsiFile)
ExternalAnnotator#apply(PsiFile, AnnotationResultType, AnnotationHolder)
public void apply(PsiFile file, AnnotationResultType annotationResult, AnnotationHolder holder)
file
- a file to annotateannotationResult
- annotations collected in ExternalAnnotator#doAnnotate(InitialInfoType)
holder
- a container for receiving annotationspublic java.lang.String getPairedBatchInspectionShortName()
Returns an inspection that should run in batch mode.
When inspection with short name is disabled, then annotator won't run in the editor via ExternalToolPass
.
Implementing ExternalAnnotatorBatchInspection
and extending LocalInspectionTool
or GlobalSimpleInspectionTool
would
provide implementation for a batch tool that would run without read action, according to the doAnnotate(Object)
documentation.