@ApiStatus.Internal
  public static PsiElement findRefactoringTargetInEditor(@NotNull DataContext dataContext,
                                                         @NotNull Predicate<? super Language> elementLanguagePredicate) {
    Editor editor = dataContext.getData(CommonDataKeys.EDITOR);
    PsiFile file = dataContext.getData(CommonDataKeys.PSI_FILE);
    PsiElement element = dataContext.getData(CommonDataKeys.PSI_ELEMENT);
    Language[] languages = dataContext.getData(LangDataKeys.CONTEXT_LANGUAGES);
    if (element == null || element instanceof SyntheticElement || !elementLanguagePredicate.test(element.getLanguage())) {
      if (file == null || editor == null) {
        return null;
      }
      element = getElementAtCaret(editor, file);
    }

    if (element == null || element instanceof SyntheticElement || languages == null) {
      return null;
    }

    if (ContainerUtil.find(languages, elementLanguagePredicate::test) == null) {
      return null;
    }
    return element;
  }
@ApiStatus.Internal
  public static PsiElement findRefactoringTargetInEditor(@NotNull DataContext dataContext,
                                                         @NotNull Predicate<? super Language> elementLanguagePredicate)