public static @NotNull List<HighlightInfo> runAnnotatorsInGeneralHighlighting(@NotNull PsiFile psiFile,
                                                                                boolean highlightErrorElements,
                                                                                boolean runAnnotators,
                                                                                boolean runVisitors) {
    ApplicationManager.getApplication().assertIsNonDispatchThread();
    ApplicationManager.getApplication().assertReadAccessAllowed();
    Project project = psiFile.getProject();
    Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);
    if (document == null) return Collections.emptyList();
    DaemonProgressIndicator daemonProgressIndicator = GlobalInspectionContextBase.assertUnderDaemonProgress();
    // in case the inspection is running in batch mode
    HighlightingSessionImpl.getOrCreateHighlightingSession(psiFile, daemonProgressIndicator, ProperTextRange.create(psiFile.getTextRange()));
    GeneralHighlightingPass ghp =
      new GeneralHighlightingPass(psiFile, document, 0, psiFile.getTextLength(), true, ProperTextRange.create(psiFile.getTextRange()), null,
                                  runAnnotators, runVisitors, highlightErrorElements, HighlightInfoUpdater.EMPTY);
    InjectedGeneralHighlightingPass ighp = new InjectedGeneralHighlightingPass(psiFile, document, null, 0, psiFile.getTextLength(), true,
                                                                               ProperTextRange.create(psiFile.getTextRange()), null,
                                                                               runAnnotators, runVisitors, highlightErrorElements, HighlightInfoUpdater.EMPTY);

    String fileName = psiFile.getName();
    List<HighlightInfo> result = new ArrayList<>();
    IJTracer tracer = TelemetryManager.Companion.getTracer(HighlightVisitorScope);

    for (TextEditorHighlightingPass pass : List.of(ghp, ighp)) {
      runWithSpan(tracer, pass.getClass().getSimpleName(), span -> {
        span.setAttribute("file", fileName);

        pass.doCollectInformation(daemonProgressIndicator);
        List<HighlightInfo> infos = pass.getInfos();
        for (HighlightInfo info : infos) {
          if (info == null) continue;
          if (info.getSeverity().compareTo(HighlightSeverity.INFORMATION) > 0) {
            result.add(info);
          }
        }
      });
    }

    return result;
  }
public static @NotNull List<HighlightInfo> runAnnotatorsInGeneralHighlighting(@NotNull PsiFile psiFile,
                                                                                boolean highlightErrorElements,
                                                                                boolean runAnnotators,
                                                                                boolean runVisitors)