mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
map severities reported by external annotators to appropriate ProblemHighlightingType when running in batch mode
for ESLint, TSLint, WEB-22548
This commit is contained in:
+5
-5
@@ -16,6 +16,7 @@
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl;
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.lang.annotation.Annotation;
|
||||
import com.intellij.lang.annotation.AnnotationSession;
|
||||
@@ -74,16 +75,14 @@ public class ExternalAnnotatorInspectionVisitor extends PsiElementVisitor {
|
||||
return ReadAction.compute(() -> {
|
||||
AnnotationHolderImpl annotationHolder = new AnnotationHolderImpl(new AnnotationSession(file), true);
|
||||
annotator.apply(file, annotationResult, annotationHolder);
|
||||
return convertToProblemDescriptors(annotationHolder, manager, file);
|
||||
return convertToProblemDescriptors(annotationHolder, file);
|
||||
});
|
||||
}
|
||||
return ProblemDescriptor.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static ProblemDescriptor[] convertToProblemDescriptors(@NotNull final List<Annotation> annotations,
|
||||
@NotNull final InspectionManager manager,
|
||||
@NotNull final PsiFile file) {
|
||||
private static ProblemDescriptor[] convertToProblemDescriptors(@NotNull final List<Annotation> annotations, @NotNull final PsiFile file) {
|
||||
if (annotations.isEmpty()) {
|
||||
return ProblemDescriptor.EMPTY_ARRAY;
|
||||
}
|
||||
@@ -109,11 +108,12 @@ public class ExternalAnnotatorInspectionVisitor extends PsiElementVisitor {
|
||||
}
|
||||
|
||||
LocalQuickFix[] quickFixes = toLocalQuickFixes(annotation.getQuickFixes(), quickFixMappingCache);
|
||||
ProblemHighlightType highlightType = HighlightInfo.convertSeverityToProblemHighlight(annotation.getSeverity());
|
||||
ProblemDescriptor descriptor = new ProblemDescriptorBase(startElement,
|
||||
endElement,
|
||||
annotation.getMessage(),
|
||||
quickFixes,
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
highlightType,
|
||||
annotation.isAfterEndOfLine(),
|
||||
null,
|
||||
true,
|
||||
|
||||
Reference in New Issue
Block a user