use of com.jetbrains.lang.dart.fixes.DartQuickFixSet in project intellij-plugins by JetBrains.
the class DartAnnotator method applyServerHighlighting.
private static void applyServerHighlighting(@NotNull final VirtualFile file, @NotNull final AnnotationHolder holder) {
final PsiFile psiFile = holder.getCurrentAnnotationSession().getFile();
final DartAnalysisServerService das = DartAnalysisServerService.getInstance(psiFile.getProject());
for (DartServerData.DartError error : das.getErrors(file)) {
if (shouldIgnoreMessageFromDartAnalyzer(file.getPath(), error.getAnalysisErrorFileSD()))
continue;
final Annotation annotation = createAnnotation(holder, error, psiFile.getTextLength());
if (annotation != null) {
final DartQuickFixSet quickFixSet = new DartQuickFixSet(psiFile.getManager(), file, error.getOffset(), error.getCode(), error.getSeverity());
for (IntentionAction quickFix : quickFixSet.getQuickFixes()) {
annotation.registerFix(quickFix);
}
if (error.getCode() != null) {
annotation.setProblemGroup(new DartProblemGroup(error.getCode(), error.getSeverity()));
}
}
}
for (DartServerData.DartHighlightRegion region : das.getHighlight(file)) {
final String attributeKey = HIGHLIGHTING_TYPE_MAP.get(region.getType());
if (attributeKey != null) {
final TextRange textRange = new TextRange(region.getOffset(), region.getOffset() + region.getLength());
holder.createInfoAnnotation(textRange, null).setTextAttributes(TextAttributesKey.find(attributeKey));
}
}
}
Aggregations