List<HighlightInfo> (@NotNull PsiFile psiFile, @NotNull Document document, @NotNull ProgressIndicator progress) { ApplicationManager.getApplication().assertIsNonDispatchThread(); assertMyFile(psiFile.getProject(), psiFile); GlobalInspectionContextBase.assertUnderDaemonProgress(); // clear status maps to run passes from scratch so that refCountHolder won't conflict and try to restart itself on partially filled maps myFileStatusMap.markAllFilesDirty("prepare to run main passes"); stopProcess(false, "disable background daemon"); myPassExecutorService.cancelAll(true); List<HighlightInfo> result; try { result = new ArrayList<>(); VirtualFile virtualFile = psiFile.getVirtualFile(); if (virtualFile != null && !virtualFile.getFileType().isBinary()) { List<TextEditorHighlightingPass> passes = DumbService.getInstance(myProject).runReadActionInSmartMode(() -> { List<TextEditorHighlightingPass> mainPasses = TextEditorHighlightingPassRegistrarEx.getInstanceEx(myProject) .instantiateMainPasses(psiFile, document, HighlightInfoProcessor.getEmpty()); JobLauncher.getInstance().invokeConcurrentlyUnderProgress(mainPasses, progress, pass -> ReadAction.compute(() -> { pass.doCollectInformation(progress); return true; })); return mainPasses; }); try { for (TextEditorHighlightingPass pass : passes) { result.addAll(pass.getInfos()); } } catch (ProcessCanceledException e) { LOG.debug("Canceled: " + progress); throw e; } } } finally { stopProcess(true, "re-enable background daemon after main passes run"); } return result; }