private static @Nullable PsiElement getPreviousElement(@NotNull ActionContext context, @NotNull PsiElement element) {
    int caretOffset = context.offset();
    int elementOffset = element.getTextRange().getStartOffset();
    if (caretOffset == elementOffset && caretOffset > 0) {
      return context.findLeafOnTheLeft();
    }
    return null;
  }
private static @Nullable PsiElement getPreviousElement(@NotNull ActionContext context, @NotNull PsiElement element)