HighlightInfoHolder (@NotNull PsiFile file) { return new HighlightInfoHolder(file) { @Override public boolean add(@Nullable HighlightInfo info) { if (info != null && info.getSeverity() == HighlightSeverity.ERROR) { myError.set(info); throw new ProcessCanceledException(); } return super.add(info); } }; }