private boolean inspectInjectedPsi(@NotNull LocalInspectionToolSession session,
                                     @NotNull List<? extends LocalInspectionToolWrapper> wrappers,
                                     @NotNull List<? super InspectionContext> outInjectedContexts,
                                     @NotNull ApplyIncrementallyCallback addDescriptorIncrementallyCallback,
                                     @NotNull Consumer<? super InspectionContext> contextFinishedCallback,
                                     @Nullable Condition<? super LocalInspectionToolWrapper> enabledToolsPredicate,
                                     @NotNull Processor<? super JobLauncherImpl.QueueController<? super Pair<PsiFile, PsiElement>>> otherActions) {
    PairProcessor<? super Pair<PsiFile, PsiElement>, JobLauncherImpl.QueueController<? super Pair<PsiFile, PsiElement>>> injectedProcessor = (pair,__) -> {
      executeInImpatientReadAction(() -> {
        PsiFile injectedPsi = pair.getFirst();
        if (!shouldInspect(injectedPsi)) {
          return;
        }
        PsiElement host = pair.getSecond();
        ApplyIncrementallyCallback applyInjectionsIncrementallyCallback = (descriptors, holder, visitingPsiElement, shortName) ->
          applyInjectedDescriptor(descriptors, holder, visitingPsiElement, shortName, host, addDescriptorIncrementallyCallback);

        // convert host priority range to the injected
        Document document = PsiDocumentManager.getInstance(myPsiFile.getProject()).getDocument(injectedPsi);
        TextRange injectedPriorityRange;
        if (document instanceof DocumentWindow documentWindow) {
          int start = documentWindow.hostToInjected(myPriorityRange.getStartOffset());
          int end = documentWindow.hostToInjected(myPriorityRange.getEndOffset());
          injectedPriorityRange = TextRange.isProperRange(start, end) ? new TextRange(start, end) : TextRange.EMPTY_RANGE;

          if (LOG.isTraceEnabled()) {
            LOG.trace("startInspectingInjectedPsi: psi=" + injectedPsi + "; host ranges= " + Arrays.toString(documentWindow.getHostRanges())+"; wrappers="+wrappers+"; injectedPsi.getTextRange()="+injectedPsi.getTextRange()+"; shouldInspect="+shouldInspect(injectedPsi));
          }
        }
        else {
          injectedPriorityRange = TextRange.EMPTY_RANGE;
          if (LOG.isTraceEnabled()) {
            LOG.trace("startInspectingInjectedPsi: psi=" + injectedPsi + "; document = " + document+"; wrappers="+wrappers+"; injectedPsi.getTextRange()="+injectedPsi.getTextRange()+"; shouldInspect="+shouldInspect(injectedPsi));
          }
        }
        InspectionRunner injectedRunner = new InspectionRunner(injectedPsi, injectedPsi.getTextRange(),
                                                               injectedPriorityRange, false, myIsOnTheFly, myProgress,
                                                               myIgnoreSuppressed, myInspectionProfileWrapper, mySuppressedElements);
        List<? extends InspectionContext> injectedContexts = injectedRunner.inspect(
          wrappers, session.getMinimumSeverity(), true, applyInjectionsIncrementallyCallback,
          contextFinishedCallback, enabledToolsPredicate);
        outInjectedContexts.addAll(injectedContexts);
      });
      return true;
    };

    return JobLauncher.getInstance().procInOrderAsync(new SensitiveProgressWrapper(myProgress), Integer.MAX_VALUE, injectedProcessor, otherActions);
  }
private boolean inspectInjectedPsi(@NotNull LocalInspectionToolSession session,
                                     @NotNull List<? extends LocalInspectionToolWrapper> wrappers,
                                     @NotNull List<? super InspectionContext> outInjectedContexts,
                                     @NotNull ApplyIncrementallyCallback addDescriptorIncrementallyCallback,
                                     @NotNull Consumer<? super InspectionContext> contextFinishedCallback,
                                     @Nullable Condition<? super LocalInspectionToolWrapper> enabledToolsPredicate,
                                     @NotNull Processor<? super JobLauncherImpl.QueueController<? super Pair<PsiFile, PsiElement>>> otherActions)