@Override
  public @NotNull IntentionPreviewInfo generatePreview(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
    PsiVariable variable = (PsiVariable)getStartElement();
    if (variable instanceof LightRecordField) {
      variable = ((LightRecordField)variable).getRecordComponent();
    }
    PsiFile containingFile = variable.getContainingFile();
    if (containingFile == file.getOriginalFile()) {
      PsiVariable varCopy = PsiTreeUtil.findSameElementInCopy(variable, file);
      PsiTypeElement typeElement = varCopy.getTypeElement();
      if (typeElement != null) {
        typeElement.replace(PsiElementFactory.getInstance(project).createTypeElement(myReturnType));
        return IntentionPreviewInfo.DIFF;
      }
    }
    PsiType oldType = variable.getType();
    PsiModifierList modifiers = variable.getModifierList();
    String modifiersText = modifiers == null ? "" : StreamEx.of(PsiModifier.MODIFIERS).filter(modifiers::hasExplicitModifier)
      .map(mod -> mod + " ").joining();
    String oldTypeText = oldType.getPresentableText() + " ";
    String newTypeText = myReturnType.getPresentableText() + " ";
    String name = variable.getName();
    String initializer = variable.hasInitializer() ? " = ...;" : ";";
    String origText = modifiersText + oldTypeText + name + initializer;
    String newText = modifiersText + newTypeText + name + initializer;
    return new IntentionPreviewInfo.CustomDiff(JavaFileType.INSTANCE, containingFile.getName(), origText, newText);
  }
@Override
  public @NotNull IntentionPreviewInfo generatePreview(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file)