private static void restartHighlighterFor(@Nullable Project project, @NotNull Editor editor) {
    if (project == null) return;

    // Rely on com.intellij.codeInsight.daemon.impl.EditorTracker and EditorTrackerListener.TOPIC in a focused window
    Window window = UIUtil.getWindow(editor.getComponent());
    if (window == null || !window.isShowing() || UIUtil.isFocusAncestor(window)) return;

    VirtualFile file = editor.getVirtualFile();
    if (file == null) return;

    ReadAction.nonBlocking(() -> {
        PsiManagerEx psiManager = PsiManagerEx.getInstanceEx(project);
        return psiManager.getFileManager().getCachedPsiFile(file);
      })
      .coalesceBy(DiffEditorHighlighterUpdater.class, editor)
      .expireWith(project)
      .submit(NonUrgentExecutor.getInstance())
      .onSuccess(psiFile -> {
        if (psiFile != null) {
          DaemonCodeAnalyzer.getInstance(project).restart(psiFile);
        }
      });
  }
private static void restartHighlighterFor(@Nullable Project project, @NotNull Editor editor)