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

Rework selection replacement #895

Merged
merged 6 commits into from
Jul 12, 2024
Merged

Conversation

dlqqq
Copy link
Member

@dlqqq dlqqq commented Jul 12, 2024

Description

  • Removes "Replace selection" checkbox that shows underneath the chat input when the user selects a range of text
  • Re-implements selection replacement by allowing users to both replace a text selection or an active cell, with the text selection taking priority.
  • Implements a hamburger menu that shows next to each agent message, which allows replacing/inserting the entire response (not just a single code block) into the user's main panel.
  • Fixes Remove "Replace selection" checkbox #865.

Demo

Screen.Recording.2024-07-12.at.1.58.26.PM.mov

@dlqqq dlqqq added the enhancement New feature or request label Jul 12, 2024
@dlqqq dlqqq added this to the v2.19.0 milestone Jul 12, 2024
@srdas
Copy link
Collaborator

srdas commented Jul 12, 2024

@dlq It all looks good. I get either a selection replaced or the entire text replaced.

Nit: The replacement does not always take care of the highlighted text but all the lines. See the video below. I highlighted two lines of code by taking my cursor to the start of the third line, and it then replaces the third line also, even though it is not highlighted. See this video:
https://github.com/user-attachments/assets/cc66635b-cad3-44df-a5f4-59fe414006dd
If you highlight a part of the third line in the video, it will replace that part and not the whole line, and the same is true if you go across lines and highlight only parts of them.

Copy link
Collaborator

@srdas srdas left a comment

Choose a reason for hiding this comment

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

Small nit -- all else looks good. If this is intended, please override the comment.

@dlqqq dlqqq merged commit fb75ef0 into jupyterlab:main Jul 12, 2024
8 checks passed
@dlqqq dlqqq deleted the revamp-selection-handling branch July 12, 2024 23:19
Marchlak pushed a commit to Marchlak/jupyter-ai that referenced this pull request Oct 28, 2024
* remove replace selection checkbox

* add useCopy() hook

* fixup

* add useReplace() hook

* add menu for replacement & insertion options on agent messages

* show 'replace 1 line' instead of 'replace 1 lines'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove "Replace selection" checkbox
2 participants