private static void checkInjectionConsistency(PsiFile injectedFile) {
    PsiElement host = injectedFile.getContext();
    if (host instanceof PsiLanguageInjectionHost) {
      DocumentWindow document = (DocumentWindow)injectedFile.getViewProvider().getDocument();
      assert document != null;
      TextRange hostRange = host.getTextRange();
      LiteralTextEscaper<? extends PsiLanguageInjectionHost> escaper = ((PsiLanguageInjectionHost)host).createLiteralTextEscaper();
      TextRange relevantRange = escaper.getRelevantTextRange().shiftRight(hostRange.getStartOffset());
      for (Segment range : document.getHostRanges()) {
        if (hostRange.contains(range) && !relevantRange.contains(range)) {
          String message = "Injection host of " + host.getClass() +
                           " with range " + hostRange +
                           " contains injection at " + range +
                           ", which contradicts literalTextEscaper that only allows injection at " + relevantRange;
          PsiFile hostFile = Objects.requireNonNull(host).getContainingFile();
          recoverFromBrokenInjection(hostFile);

          Attachment fileText = new Attachment(hostFile.getViewProvider().getVirtualFile().getPath(), hostFile.getText());
          throw PluginException.createByClass(new RuntimeExceptionWithAttachments(message, fileText), host.getClass());
        }
      }
    }
  }
private static void checkInjectionConsistency(PsiFile injectedFile)