Skip to content

Commit

Permalink
MID-9502 external annotator exception for empty files fix
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Mar 4, 2024
1 parent 0b68d93 commit bd13cc6
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Collections;
import java.util.List;

/**
Expand All @@ -30,14 +31,18 @@ public PsiFile collectInformation(@NotNull PsiFile file) {
@Nullable
@Override
public List<AxiomQueryError> doAnnotate(final PsiFile file) {
String content = file.getText();
if (content.isBlank()) {
return Collections.emptyList();
}

return axiomQueryLangService.validate(file.getText());
}

@Override
public void apply(@NotNull PsiFile file,
List<AxiomQueryError> errors,
@NotNull AnnotationHolder holder)
{
@NotNull AnnotationHolder holder) {
for (AxiomQueryError error : errors) {
TextRange range = new TextRange(error.getCharPositionInLineStart(), error.getCharPositionInLineStop() + 1);
holder.newAnnotation(HighlightSeverity.ERROR, error.getMessage())
Expand Down

0 comments on commit bd13cc6

Please sign in to comment.