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

Show restart transformation button after successful inline assist #20439

Merged

Conversation

g0t4
Copy link
Contributor

@g0t4 g0t4 commented Nov 8, 2024

When using inline assist, after successfully generating a transformation it's not possible to generate a new transformation. Currently, you have to modify the prompt (i.e. add a <SPACE> and hit <ENTER>) to regenerate.

So, I changed the restart button to be visible after a successful transformation. And in that case I map it to a different keyboard shortcut because menu::Confirm is mapped to accept the current suggestion.

Now, I can invoke a series of transforms back to back until I get what I want!

It might also be desired to keep the accept button visible after modifying the prompt (before submitting it). In that case we'll need to remap accept to an alternate key (perhaps the same alt-shift-enter I am using for restart. That wouldn't be too insane to remember. But maybe someone has a better idea.

I don't care what the shortcut is, I just want the ability to regenerate without adding/deleting spaces.

Before

Two choices after a suggestions is presented. Also, a great example of why I would want to regenerate the suggestion, it left some tokens <rewrite_this>!

CleanShot 2024-12-13 at 00 34 09

After

Three choices after a suggestion is presented, the circular icon is for regenerate, just like you see if you modify the prompt text.
CleanShot 2024-12-13 at 00 37 58

Release Notes:

  • Added Restart Button to Inline Assistant When Prompt Is Unchanged

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 8, 2024
@mikayla-maki
Copy link
Member

mikayla-maki commented Dec 13, 2024

Thank you for this PR!

Could you include a screenshot of the UI change, preferably both a before and after?

Also, this PR needs a cargo fmt.

@g0t4
Copy link
Contributor Author

g0t4 commented Dec 13, 2024

@mikayla-maki screenshots attached and cargo fmt done, does the format look ok?

Also I am going to rebase it, if you don't want that let me know and I will revert the rebase

@mikayla-maki
Copy link
Member

Rebase is good! I think we could use @danilo-leal or @iamnbutler taking a look at this though, that restart icon kinda throws off the whole UI.

g0t4 added 2 commits December 13, 2024 00:56
…nd wire it up to shift+alt+enter though something else would be fine too
@g0t4
Copy link
Contributor Author

g0t4 commented Dec 13, 2024

Good idea, please have them review the shortcut I chose, I just pulled that outta my arse to have something to test with.

@g0t4 g0t4 force-pushed the restart-inline-assist-on-success-too branch from 92780c5 to 45c0dc8 Compare December 13, 2024 06:59
@g0t4
Copy link
Contributor Author

g0t4 commented Dec 13, 2024

@mikayla-maki rebase is done

@danilo-leal
Copy link
Contributor

Sweet, very cool PR! Pushed a commit with a new SVG for the RotateCw icon that better fits the other ones.

Screenshot 2024-12-13 at 09 42 16

@g0t4
Copy link
Contributor Author

g0t4 commented Dec 13, 2024

@danilo-leal that looks slick! What do you think about the keymap to activate it? alt+shift+enter ... I just chose something that wasn't already used and similar to enter

"alt-shift-enter": "menu::Restart",

"alt-shift-enter": "menu::Restart",

@mikayla-maki
Copy link
Member

Thank you!

@mikayla-maki mikayla-maki merged commit 0be7cf8 into zed-industries:main Dec 14, 2024
12 checks passed
lino-levan pushed a commit to the-code-editor-company/editor that referenced this pull request Dec 16, 2024
…ed-industries#20439)

When using inline assist, after successfully generating a transformation
it's not possible to generate a new transformation. Currently, you have
to modify the prompt (i.e. add a `<SPACE>` and hit `<ENTER>`) to
regenerate.

So, I changed the restart button to be visible after a successful
transformation. And in that case I map it to a different keyboard
shortcut because `menu::Confirm` is mapped to accept the current
suggestion.

Now, I can invoke a series of transforms back to back until I get what I
want!

It might also be desired to keep the accept button visible after
modifying the prompt (before submitting it). In that case we'll need to
remap accept to an alternate key (perhaps the same alt-shift-enter I am
using for restart. That wouldn't be too insane to remember. But maybe
someone has a better idea.

I don't care what the shortcut is, I just want the ability to regenerate
without adding/deleting spaces.

## Before

**Two choices** after a suggestions is presented. Also, a great example
of why I would want to regenerate the suggestion, it left some tokens
`<rewrite_this>`!

![CleanShot 2024-12-13 at 00 34
09](https://github.com/user-attachments/assets/3c1786ca-8ec5-48e2-b3dd-64de36e61f6a)

## After

**Three choices** after a suggestion is presented, the circular icon is
for regenerate, just like you see if you modify the prompt text.
![CleanShot 2024-12-13 at 00 37
58](https://github.com/user-attachments/assets/ceda300f-0851-48bf-ad3a-be44308c734e)


## Release Notes:

- Added Restart Button to Inline Assistant When Prompt Is Unchanged

---------

Co-authored-by: Danilo Leal <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants