@SuppressWarnings("deprecation")
  private static @NotNull List<TextContent> doExtract(@NotNull PsiElement anyRoot,
                                                      @NotNull Set<TextContent.TextDomain> allowedDomains,
                                                      @NotNull Language language) {
    TextExtractor extractor = EP.forLanguage(language);
    if (extractor != null) {
      List<TextContent> contents = extractor.buildTextContents(anyRoot, allowedDomains);
      for (TextContent content : contents) {
        if (!content.getCommonParent().getTextRange().contains(content.textRangeToFile(TextRange.from(0, content.length())))) {
          if (!(extractor instanceof EventuallyConsistentTextExtractor)) {
            PluginException.logPluginError(LOG, "Inconsistent text content", null, extractor.getClass());
          }
          return List.of();
        }
      }
      return contents;
    }

    // legacy extraction
    for (GrammarCheckingStrategy strategy : LanguageGrammarChecking.INSTANCE.allForLanguage(language)) {
      if (strategy.isMyContextRoot(anyRoot)) {
        GrammarCheckingStrategy.TextDomain oldDomain = strategy.getContextRootTextDomain(anyRoot);
        TextContent.TextDomain domain = StrategyTextExtractor.convertDomain(oldDomain);
        if (domain != null && allowedDomains.contains(domain)) {
          return ContainerUtil.createMaybeSingletonList(new StrategyTextExtractor(strategy).extractText(strategy.getRootsChain(anyRoot)));
        }
      }
    }

    return Collections.emptyList();
  }
@SuppressWarnings("deprecation")
  private static @NotNull List<TextContent> doExtract(@NotNull PsiElement anyRoot,
                                                      @NotNull Set<TextContent.TextDomain> allowedDomains,
                                                      @NotNull Language language)