DaemonCodeAnalyzerStatus (@NotNull SeverityRegistrar severityRegistrar) { // this method is rather expensive and PSI-related, need to execute in BGT and cache the result to show in EDT later ApplicationManager.getApplication().assertIsNonDispatchThread(); ApplicationManager.getApplication().assertReadAccessAllowed(); DaemonCodeAnalyzerStatus status = new DaemonCodeAnalyzerStatus(); status.errorAnalyzingFinished = true; PsiFile psiFile = getPsiFile(); if (psiFile == null) { status.reasonWhyDisabled = DaemonBundle.message("process.title.no.file"); return status; } if (myProject.isDisposed()) { status.reasonWhyDisabled = DaemonBundle.message("process.title.project.is.disposed"); return status; } if (!myDaemonCodeAnalyzer.isHighlightingAvailable(psiFile)) { if (!psiFile.isPhysical()) { status.reasonWhyDisabled = DaemonBundle.message("process.title.file.is.generated"); return status; } if (psiFile instanceof PsiCompiledElement) { status.reasonWhyDisabled = DaemonBundle.message("process.title.file.is.decompiled"); return status; } FileType fileType = psiFile.getFileType(); if (fileType.isBinary()) { status.reasonWhyDisabled = DaemonBundle.message("process.title.file.is.binary"); return status; } status.reasonWhyDisabled = DaemonBundle.message("process.title.highlighting.is.disabled.for.this.file"); return status; } FileViewProvider provider = psiFile.getViewProvider(); Set<Language> languages = provider.getLanguages(); boolean shouldHighlight = languages.isEmpty(); for (Map.Entry<Language, FileHighlightingSetting> entry : myFileHighlightingSettings.entrySet()) { FileHighlightingSetting level = entry.getValue(); shouldHighlight |= level != FileHighlightingSetting.SKIP_HIGHLIGHTING; status.minimumLevel = status.minimumLevel.compareTo(level) < 0 ? status.minimumLevel : level; } shouldHighlight &= this.shouldHighlight; if (!shouldHighlight) { status.reasonWhyDisabled = DaemonBundle.message("process.title.highlighting.level.is.none"); return status; } HeavyProcessLatch.Operation heavyOperation = HeavyProcessLatch.INSTANCE.findRunningExcept(HeavyProcessLatch.Type.Syncing); if (heavyOperation != null) { status.reasonWhySuspended = heavyOperation.getDisplayName(); status.heavyProcessType = heavyOperation.getType(); return status; } status.errorCounts = getErrorCounts(); status.passes = ContainerUtil.filter(myDaemonCodeAnalyzer.getPassesToShowProgressFor(myDocument), p -> !StringUtil.isEmpty(p.getPresentableName()) && p.getProgress() >= 0); status.errorAnalyzingFinished = myDaemonCodeAnalyzer.isAllAnalysisFinished(psiFile); if (!myDaemonCodeAnalyzer.isUpdateByTimerEnabled()) { status.reasonWhySuspended = DaemonBundle.message("process.title.highlighting.is.paused.temporarily"); } fillDaemonCodeAnalyzerErrorsStatus(status, severityRegistrar); return status; }