@ApiStatus.Internal
  static void runInsideHighlightingSessionInEDT(@NotNull PsiFile file,
                                                @Nullable EditorColorsScheme editorColorsScheme,
                                                @NotNull ProperTextRange visibleRange,
                                                boolean canChangeFileSilently,
                                                @NotNull Consumer<? super @NotNull HighlightingSession> runnable) {
    ApplicationManager.getApplication().assertIsDispatchThread();
    if (!(ProgressIndicatorProvider.getGlobalProgressIndicator() instanceof DaemonProgressIndicator)) {
      ProgressManager.getInstance().executeProcessUnderProgress(()->runInsideHighlightingSessionInEDT(file, editorColorsScheme, visibleRange, canChangeFileSilently, runnable), new DaemonProgressIndicator());
      return;
    }
    DaemonProgressIndicator indicator = GlobalInspectionContextBase.assertUnderDaemonProgress();
    HighlightingSessionImpl session = createHighlightingSession(file, indicator, editorColorsScheme, visibleRange, canChangeFileSilently
                                                                                                                 ? CanISilentlyChange.Result.UH_HUH
                                                                                                                 : CanISilentlyChange.Result.UH_UH,
                                                                0);
    session.myInContent = true;
    try {
      runnable.accept(session);
    }
    finally {
      clearHighlightingSession(indicator, file);
    }
  }
@ApiStatus.Internal
  static void runInsideHighlightingSessionInEDT(@NotNull PsiFile file,
                                                @Nullable EditorColorsScheme editorColorsScheme,
                                                @NotNull ProperTextRange visibleRange,
                                                boolean canChangeFileSilently,
                                                @NotNull Consumer<? super @NotNull HighlightingSession> runnable)