cursor icon indicating copy to clipboard operation
cursor copied to clipboard

Add "Keep Both" option for AI-generated code diff replacement

Open charles-liang opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe.

Currently, when Cursor generates code and presents a diff for replacement, users are only given the options to accept (y) or reject (n) the changes. This binary choice can be limiting, especially when both the original and AI-generated code have merits or when users want to combine elements from both versions.

Describe the solution you'd like

We propose adding a "Keep Both" option alongside the existing "y" (yes) and "n" (no) choices when Cursor presents a diff for AI-generated code replacement. This new option would allow users to: Retain both the original and AI-generated code sections. Place the AI-generated code directly below the original code, separated by a comment. Give users the flexibility to manually edit and combine the two versions as needed. The workflow would look something like this:

  1. AI generates code and presents a diff. User is prompted with options: "Replace? (y/n/k)", where "k" stands for "Keep Both". If the user selects "k", both versions are retained in the file, separated by a comment.

Additional context

charles-liang avatar Sep 14 '24 13:09 charles-liang