private static boolean hasErrorElements(@NotNull PsiElement element) {
    List<HighlightErrorFilter> filters = null;
    for (PsiErrorElement error : SyntaxTraverser.psiTraverser(element).traverse().filter(PsiErrorElement.class)) {
      if (filters == null) {
        filters = HighlightErrorFilter.EP_NAME.getExtensions(element.getProject());
      }
      if (shouldHighlightErrorElement(error, filters)) {
        return true;
      }
    }
    return false;
  }
private static boolean hasErrorElements(@NotNull PsiElement element)