protected @Nullable Pair<PsiElement, TextRange> getRangePair(PsiFile file, Editor editor) {
    int offset = editor.getCaretModel().getOffset();
    PsiLanguageInjectionHost host = PsiTreeUtil.getParentOfType(file.findElementAt(offset), PsiLanguageInjectionHost.class, false);
    if (host == null || host instanceof PsiComment || ElementManipulators.getManipulator(host) == null) return null;
    List<Pair<PsiElement, TextRange>> injections = InjectedLanguageManager.getInstance(host.getProject()).getInjectedPsiFiles(host);
    if (injections == null || injections.isEmpty()) return null;
    int offsetInElement = offset - host.getTextRange().getStartOffset();
    Pair<PsiElement, TextRange> rangePair =
      ContainerUtil.find(injections, pair -> pair.second.containsRange(offsetInElement, offsetInElement));
    if (rangePair != null) {
      Language language = rangePair.first.getContainingFile().getLanguage();


      Object action = host.getUserData(EDIT_ACTION_AVAILABLE);
      if (action == null) {
        action = language.getUserData(EDIT_ACTION_AVAILABLE);
      }
      if (action != null && action.equals(false)) return null;

      myLastLanguageName = language.getDisplayName();
    }
    return rangePair;
  }
protected @Nullable Pair<PsiElement, TextRange> getRangePair(PsiFile file, Editor editor)