@Override
  public @NotNull IntentionPreviewInfo generatePreview(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
    String name = myRefElement.getReferenceName();
    if (name == null) {
      return IntentionPreviewInfo.EMPTY;
    }
    PsiFile containingFile = myRefElement.getContainingFile();
    if (!(containingFile instanceof GroovyFileBase)) {
      return IntentionPreviewInfo.EMPTY;
    }
    String packageName = ((GroovyFileBase)containingFile).getPackageName();
    String prefix = packageName.isEmpty() ? "" : "package " + packageName + "\n\n";
    String template = prefix + "%s " + name + " {\n}" ;
    String newClassPrefix = switch (myType) {
      case CLASS -> "class";
      case INTERFACE -> "interface";
      case TRAIT -> "trait";
      case ENUM -> "enum";
      case ANNOTATION -> "@interface";
      case RECORD -> "record";
    };

    return new IntentionPreviewInfo.CustomDiff(GroovyFileType.GROOVY_FILE_TYPE, name + ".groovy", "", String.format(template, newClassPrefix));
  }
@Override
  public @NotNull IntentionPreviewInfo generatePreview(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file)