mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
external annotator is allowed to decide if it should handle file with error +review CR-IC
This commit is contained in:
@@ -34,12 +34,21 @@ public abstract class ExternalAnnotator<InitialInfoType, AnnotationResultType> {
|
||||
public InitialInfoType collectionInformation(@NotNull PsiFile file) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated use {@link com.intellij.lang.annotation.ExternalAnnotator#collectInformation(PsiFile, Editor, boolean)}
|
||||
*/
|
||||
@Nullable
|
||||
@Deprecated()
|
||||
public InitialInfoType collectInformation(@NotNull PsiFile file, @NotNull Editor editor) {
|
||||
return collectionInformation(file);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public InitialInfoType collectInformation(@NotNull PsiFile file, @NotNull Editor editor, boolean hasErrors) {
|
||||
return hasErrors ? null : collectionInformation(file);
|
||||
}
|
||||
|
||||
// Lengthy annotation goes here
|
||||
@Nullable
|
||||
public AnnotationResultType doAnnotate(InitialInfoType collectedInfo) {
|
||||
|
||||
@@ -94,12 +94,13 @@ public class ExternalToolPass extends TextEditorHighlightingPass {
|
||||
if (!externalAnnotators.isEmpty()) {
|
||||
DaemonCodeAnalyzerEx daemonCodeAnalyzer = DaemonCodeAnalyzerEx.getInstanceEx(myProject);
|
||||
boolean errorFound = daemonCodeAnalyzer.getFileStatusMap().wasErrorFound(myDocument);
|
||||
if (errorFound) return;
|
||||
|
||||
for(ExternalAnnotator externalAnnotator: externalAnnotators) {
|
||||
externalAnnotator.annotate(psiRoot, myAnnotationHolder);
|
||||
if (!errorFound) {
|
||||
externalAnnotator.annotate(psiRoot, myAnnotationHolder);
|
||||
}
|
||||
|
||||
final Object collectedInfo = externalAnnotator.collectInformation(psiRoot, myEditor);
|
||||
final Object collectedInfo = externalAnnotator.collectInformation(psiRoot, myEditor, errorFound);
|
||||
if (collectedInfo != null) {
|
||||
myAnnotator2DataMap.put(externalAnnotator, new MyData(psiRoot, collectedInfo));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user