@Override
  protected @NotNull ModCommand perform(@NotNull ActionContext context, @NotNull PsiExpression expression) {
    while (expression.getParent() instanceof PsiExpression parent) {
      expression = parent;
    }
    Formatter formatter = getFormatter(expression);
    final Object value = ExpressionUtils.computeConstantExpression(expression);
    if (!(value instanceof String)) return ModCommand.nop();
    return switch (formatter) {
      case NONE -> ModCommand.nop();
      case DATE_TIME_FORMATTER -> {
        try {
          final DateTimeFormatter fmt = DateTimeFormatter.ofPattern((String)value);
          //noinspection HardCodedStringLiteral
          yield ModCommand.info(LocalDateTime.now().format(fmt));
        }
        catch (IllegalArgumentException e) {
          yield ModCommand.error(IntentionPowerPackBundle.message("invalid.pattern.hint.text"));
        }
      }
      case SIMPLE_DATE_FORMAT -> {
        try {
          final SimpleDateFormat format = new SimpleDateFormat((String)value);
          yield ModCommand.info(format.format(new Date()));
        }
        catch (IllegalArgumentException e) {
          yield ModCommand.error(IntentionPowerPackBundle.message("invalid.pattern.hint.text"));
        }
      }
    };
  }
@Override
  protected @NotNull ModCommand perform(@NotNull ActionContext context, @NotNull PsiExpression expression)