List<HighlightInfo> (@NotNull PsiFile file, boolean highlightErrorElements, boolean runAnnotators, boolean runVisitors) { ApplicationManager.getApplication().assertIsNonDispatchThread(); ApplicationManager.getApplication().assertReadAccessAllowed(); Project project = file.getProject(); Document document = PsiDocumentManager.getInstance(project).getDocument(file); if (document == null) return Collections.emptyList(); DaemonProgressIndicator daemonProgressIndicator = GlobalInspectionContextBase.assertUnderDaemonProgress(); HighlightingSessionImpl.getOrCreateHighlightingSession(file, daemonProgressIndicator, ProperTextRange.create(file.getTextRange())); TextEditorHighlightingPassRegistrarEx passRegistrarEx = TextEditorHighlightingPassRegistrarEx.getInstanceEx(project); List<TextEditorHighlightingPass> passes = passRegistrarEx.instantiateMainPasses(file, document, HighlightInfoProcessor.getEmpty()); List<GeneralHighlightingPass> gpasses = ContainerUtil.filterIsInstance(passes, GeneralHighlightingPass.class); if (!runVisitors) { for (GeneralHighlightingPass gpass : gpasses) { gpass.setHighlightVisitorProducer(() -> { gpass.incVisitorUsageCount(1); return List.of(new DefaultHighlightVisitor(project, highlightErrorElements, runAnnotators, true)); }); } } String fileName = file.getName(); List<HighlightInfo> result = new ArrayList<>(); IJTracer tracer = TelemetryManager.Companion.getTracer(HighlightVisitorScope); for (TextEditorHighlightingPass pass : gpasses) { runWithSpan(tracer, pass.getClass().getSimpleName(), span -> { span.setAttribute("file", fileName); pass.doCollectInformation(daemonProgressIndicator); List<HighlightInfo> infos = pass.getInfos(); for (HighlightInfo info : infos) { if (info != null && info.getSeverity().compareTo(HighlightSeverity.INFORMATION) > 0) { result.add(info); } } }); } return result; }