void (@NotNull PsiFile file, @NotNull TextRange restrictRange, @NotNull InspectionManager inspectionManager, @NotNull Map<String, InspectionToolWrapper<?, ?>> wrappersMap, @NotNull List<? extends GlobalInspectionToolWrapper> globalSimpleTools, @NotNull List<? extends LocalInspectionToolWrapper> localTools, boolean inspectInjectedPsi) { Document document = PsiDocumentManager.getInstance(getProject()).getDocument(file); if (document == null) return; ProgressIndicator progressIndicator = ProgressIndicatorProvider.getGlobalProgressIndicator(); if (progressIndicator == null) { throw new IllegalStateException("Must be run under progress"); } InspectionProfileWrapper.runWithCustomInspectionWrapper(file, __ -> new InspectionProfileWrapper(getCurrentProfile()), () -> { try { Map<LocalInspectionToolWrapper, List<ProblemDescriptor>> map = InspectionEngine.inspectEx(localTools, file, restrictRange, restrictRange, false, inspectInjectedPsi, true, progressIndicator, PairProcessor.alwaysTrue()); for (Map.Entry<LocalInspectionToolWrapper, List<ProblemDescriptor>> entry : map.entrySet()) { List<ProblemDescriptor> descriptors = entry.getValue(); if (descriptors.isEmpty()) continue; final ProblemDescriptor firstDescriptor = descriptors.get(0); LocalInspectionToolWrapper toolWrapper = firstDescriptor instanceof ProblemDescriptorWithReporterName descriptor ? (LocalInspectionToolWrapper)getTools().get(descriptor.getReportingToolName()).getTool() : entry.getKey(); InspectionToolPresentation toolPresentation = getPresentation(toolWrapper); BatchModeDescriptorsUtil.addProblemDescriptors(descriptors, toolPresentation, true, this, toolWrapper.getTool()); } assertUnderDaemonProgress(); JobLauncher.getInstance() .invokeConcurrentlyUnderProgress(globalSimpleTools, progressIndicator, toolWrapper -> { GlobalSimpleInspectionTool tool = (GlobalSimpleInspectionTool)toolWrapper.getTool(); ProblemsHolder holder = new ProblemsHolder(inspectionManager, file, false); ProblemDescriptionsProcessor problemDescriptionProcessor = getProblemDescriptionProcessor(toolWrapper, wrappersMap); reportWhenInspectionFinished( getInspectionEventPublisher(), toolWrapper, GLOBAL_SIMPLE, file, getProject(), () -> { tool.checkFile(file, inspectionManager, holder, this, problemDescriptionProcessor); return holder.getResultCount(); }); InspectionToolResultExporter toolPresentation = getPresentation(toolWrapper); BatchModeDescriptorsUtil.addProblemDescriptors(holder.getResults(), false, this, null, toolPresentation, CONVERT); return true; }); VirtualFile virtualFile = file.getVirtualFile(); String displayUrl = ProjectUtilCore.displayUrlRelativeToProject(virtualFile, virtualFile.getPresentableUrl(), getProject(), true, false); incrementJobDoneAmount(getStdJobDescriptors().LOCAL_ANALYSIS, displayUrl); } catch (ProcessCanceledException | IndexNotReadyException e) { throw e; } catch (Throwable e) { LOG.error("In file: " + file.getViewProvider().getVirtualFile().getPath(), e); } finally { InjectedLanguageManager.getInstance(getProject()).dropFileCaches(file); } }); }