Added ability not to mark error if there is a syntax one in some cases

This commit is contained in:
Svetlana Isakova
2012-03-06 13:07:04 +04:00
parent 5b6805eede
commit 72c9eef31b
9 changed files with 62 additions and 95 deletions
@@ -256,7 +256,9 @@ public class JetPsiChecker implements Annotator {
@Nullable
private Annotation markRedeclaration(@NotNull Set<PsiElement> redeclarations, @NotNull RedeclarationDiagnostic diagnostic, @NotNull AnnotationHolder holder) {
if (!redeclarations.add(diagnostic.getPsiElement())) return null;
return holder.createErrorAnnotation(diagnostic.getTextRanges().get(0), getMessage(diagnostic));
List<TextRange> textRanges = diagnostic.getTextRanges();
if (textRanges.isEmpty()) return null;
return holder.createErrorAnnotation(textRanges.get(0), getMessage(diagnostic));
}