void (@Nullable Project project, @NotNull Editor editor) { if (project == null) return; // rely on com.intellij.codeInsight.daemon.impl.EditorTracker if in focused window Window window = UIUtil.getWindow(editor.getComponent()); if (window == null || !window.isShowing() || UIUtil.isFocusAncestor(window)) return; PsiManagerEx psiManager = PsiManagerEx.getInstanceEx(project); DaemonCodeAnalyzer codeAnalyzer = DaemonCodeAnalyzer.getInstance(project); VirtualFile file = editor.getVirtualFile(); if (file == null) return; PsiFile psiFile = ReadAction.compute(() -> psiManager.getFileManager().getCachedPsiFile(file)); if (psiFile != null) { codeAnalyzer.restart(psiFile); } }