Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cody: Apply fixups by default #1407

Closed
Tracked by #1354 ...
umpox opened this issue Oct 17, 2023 · 3 comments · Fixed by #1411
Closed
Tracked by #1354 ...

Cody: Apply fixups by default #1407

umpox opened this issue Oct 17, 2023 · 3 comments · Fixed by #1411
Assignees

Comments

@umpox
Copy link
Contributor

umpox commented Oct 17, 2023

Fixups should apply by default. We should provide the codelens options:

  • "Done" -> (Hide codelens)
  • "Diff"
  • "Edited by Cody" -> non-clickable

Undo/Revert should be possible using normal undo flow

@umpox umpox self-assigned this Oct 17, 2023
@toolmantim toolmantim self-assigned this Oct 20, 2023
@toolmantim
Copy link
Contributor

toolmantim commented Oct 20, 2023

I put together a design for this @umpox, including the ability to "Retry" with an updated prompt (replacing "Regenerate" in #1383):

https://www.figma.com/file/kcXB8qZDpOGqWImwuvX6yq/Auto-applied-edits%2C-retryable-w%2F-new-updated-prompt?type=design&node-id=0-1&mode=design

It does include the idea of "Undo". And the way "Retry" is designed, it would do an undo then reattempt the edit with the new prompt, which is what a lot of other code AI tools are doing.

If it's not possible to implement "Undo" at all, we could have "Retry" just edit over the top and I think the UI labelling still works.

"Edited by Cody" -> non-clickable

I think every code lens action has to map to an action and be clickable.

Instead of "Diff" we can make the first "Edits Applied" action show the diff instead. That would be slightly less discoverable, but the diff view isn't great to use, and most people have a git diff too… so I think that's the right balance?

@umpox
Copy link
Contributor Author

umpox commented Oct 23, 2023

@toolmantim Thanks, will update some things!

@umpox
Copy link
Contributor Author

umpox commented Oct 23, 2023

@toolmantim I think every code lens action has to map to an action and be clickable.

Actually it's possible to provide an empty command and the codelens action will still show, but will be unclickable and won't have the usual hover etc effects of a button. Although this is a recent undocumented change I believe (as with so many VS Code changes)

Makes sense though. I've made these changes in this PR: #1411

We now have Undo and Retry logic, LMK what you think

@kalanchan kalanchan added this to the dec-ga/commands-ux-polish milestone Oct 27, 2023
umpox added a commit that referenced this issue Oct 31, 2023
closes #1407

## Description

This PR:
- Applies fixups by default
- Adds support for applying fixups in the background, when the target
file isn't visible. Instead of opening it and changing the users' flow,
we do a workspace edit and notify the user when done.
- Adds a codelens state where the fixup is applied, but can be differed,
regen etc. To avoid this being an annoyance, this codelens is removed
when a user saves the document, or edits part of the fixup.
- Via the Fixup view, adds the functionality to manage applied fixups by
accepting them all or accepting all in a file.
- Fixes some over-logging for telemetry

## Screenshot
<img width="565" alt="image"
src="https://github.com/sourcegraph/cody/assets/9516420/99476b54-ed82-4d22-a439-32d9a8f0c7a1">

## Video (Fixup - Happy path)


https://github.com/sourcegraph/cody/assets/9516420/a515bf02-ac64-45e3-a92b-9d196da77084

## Video (Fixup - Happy path (in background))


https://github.com/sourcegraph/cody/assets/9516420/9fc24cf2-b509-43dd-8346-b0c00188597f

## Video (Fixup - Unhappy path - Undo)


https://github.com/sourcegraph/cody/assets/9516420/421880d4-bf41-4c67-8877-7471e7b5556c

## Video (Fixup - Unhappy path - Retry)

<small>yes, i misspelled code _twice_</small>


https://github.com/sourcegraph/cody/assets/9516420/fefb2c98-c131-4837-bdb0-6cbaa24fb098


## Test plan

Test:
- Instruction fixups (via command palette)
- Documentation command
- Code action fixup
- Fixup UX flow

<!-- Required. See
https://docs.sourcegraph.com/dev/background-information/testing_principles.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants