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

Edit: Add codelens shortcuts #2757

Merged
merged 18 commits into from
Feb 14, 2024
Merged

Edit: Add codelens shortcuts #2757

merged 18 commits into from
Feb 14, 2024

Conversation

umpox
Copy link
Contributor

@umpox umpox commented Jan 16, 2024

Description

image

This PR:

  • Adds keyboard shortcuts to common Edit codelens actions (Accept, Retry, Undo, Cancel)
    • These shortcuts are only enabled when an Edit is in an active actionable state, and it is in a visible document. This will help reduce the risk of these shortcuts becoming an annoyance if a user doesn't use Edit much.
  • Updates "Retry" text to show "Edit & Retry"

Test plan

Single edit:

  1. Create an edit
  2. Try undo/retry/save shortcuts

Multiple edit (actions nearest edit):

  1. Create multiple edits
  2. Try undo/retry/save shortcuts and confirm that they only trigger against the nearest edit to the cursor position

Shortcut enablement:

  1. Create an edit
  2. Leave the file
  3. Try undo/retry/save shortcuts. Confirm nothing happens
  4. Return to the file
  5. Try undo/retry/save shortcuts. Confirm they work

@umpox umpox mentioned this pull request Jan 16, 2024
35 tasks
@umpox umpox self-assigned this Jan 16, 2024
@umpox umpox marked this pull request as ready for review February 8, 2024 11:49
@umpox umpox requested review from toolmantim, abeatrix and a team February 8, 2024 11:49
Copy link
Contributor

@abeatrix abeatrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left comments/questions inline. I'm wondering why the current e2e test is passing when the code lens title has changed 🤔 Do we also want a shortcut for ShowDiff?

lens.command = {
title: 'Retry',
title: `Edit & Retry [${shortcut}]`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know why this is not affecting the e2e test where we only look for Edit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where we look for Retry? I think it's because the text is still there. I'll update the e2e test so it matches exactly

vscode/src/non-stop/codelenses/items.ts Outdated Show resolved Hide resolved
vscode/src/non-stop/codelenses/items.ts Outdated Show resolved Hide resolved
vscode/src/non-stop/codelenses/items.ts Outdated Show resolved Hide resolved
vscode/src/non-stop/codelenses/items.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@toolmantim toolmantim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great!

A few things:

  • When an edit is running, the cancel shortcut (opt-z) doesn't seem to work
  • Can we move Show Diff to the end?
  • Can we hide the generic Cody Code Lenses if we have edit code lenses, so we don't get the double up seen in the below?
  • I tested out a few different labelling formats (see below), I think fix typo #2 is the best (parentheses) — wdyt?

1:

CleanShot 2024-02-11 at 00 19 49@2x

Without the generic Cody lens:

CleanShot 2024-02-11 at 00 26 22@2x

2:

CleanShot 2024-02-11 at 00 21 02@2x

Without generic Cody lens:

CleanShot 2024-02-11 at 00 28 08@2x

3:

CleanShot 2024-02-11 at 00 21 53@2x

umpox and others added 6 commits February 12, 2024 14:19
Co-authored-by: Beatrix <68532117+abeatrix@users.noreply.github.com>
Co-authored-by: Beatrix <68532117+abeatrix@users.noreply.github.com>
Co-authored-by: Beatrix <68532117+abeatrix@users.noreply.github.com>
Co-authored-by: Beatrix <68532117+abeatrix@users.noreply.github.com>
@umpox
Copy link
Contributor Author

umpox commented Feb 12, 2024

@toolmantim

When an edit is running, the cancel shortcut (opt-z) doesn't seem to work

Fixed

Can we move Show Diff to the end?

Done. Do you think we should include a shortcut for it too?

I tested out a few different labelling formats (see below), I think #2 is the best (parentheses) — wdyt?

Agree. Updated

@umpox
Copy link
Contributor Author

umpox commented Feb 12, 2024

Can we hide the generic Cody Code Lenses if we have edit code lenses, so we don't get the double up seen in the below?

@toolmantim I looked briefly into this. I think we can do this but it'll be a follow up PR and require some refactoring of the Cody codelens so we can easily hide this for a location within a particular document.

I think we should also consider what to do about this codelens first. It's disabled by default so we should either enable it fully or rethink how we show it so we can enable it by default

Copy link
Contributor

@toolmantim toolmantim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

Done. Do you think we should include a shortcut for [Show Diff] too?

Maybe not, to keep keyboard shortcut footprint low? Or do you think it's weird not having one? Either way, can be a follow-up.

@umpox umpox enabled auto-merge (squash) February 14, 2024 13:13
@umpox umpox merged commit 235c64b into main Feb 14, 2024
17 checks passed
@umpox umpox deleted the tr/edit-shortcuts branch February 14, 2024 13:18
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 this pull request may close these issues.

None yet

3 participants