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

Refactor undo-redo action for editors #13963

Merged
merged 4 commits into from
Aug 6, 2024
Merged

Conversation

msujew
Copy link
Member

@msujew msujew commented Jul 25, 2024

What it does

Closes #13962
Closes #9344

Refactors our undo/redo mechanism to better support different kinds of editors. Adds a UndoRedoHandlerService that keeps a list of UndoRedoHandler contributions. This design is heavily influenced by how VS Code handles its undo/redo across different editors. See also microsoft/vscode#98288.

How to test

Follow the reproduction steps from #13962 and #9344 and assert that the undo/redo action is only ever executed on the currently selected editor. Also:

  • Assert that undo/redo on normal text inputs (like the extension search bar) still works as expected even in the presence of a text editor in the main area.
  • Assert that the undo/redo falls back to the last active monaco editor in case no widget is selected that is capable of performing an undo/redo action.

Follow-ups

Using this architecture, we could add support to undo/redo actions in the navigator. VS Code for example allows to undo file deletion/rename/move. We can do that in a separate PR though.

Review checklist

Reminder for reviewers

@msujew msujew added custom-editor issues related to custom-editor functionality notebook issues related to notebooks labels Jul 25, 2024
Copy link
Contributor

@jbicker jbicker left a comment

Choose a reason for hiding this comment

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

Works as expected now. Thanks!

@msujew msujew merged commit 9e91241 into master Aug 6, 2024
14 checks passed
@msujew msujew deleted the msujew/refactor-undo-redo branch August 6, 2024 00:05
@github-actions github-actions bot added this to the 1.53.0 milestone Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
custom-editor issues related to custom-editor functionality notebook issues related to notebooks
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Incorrect undo/redo action on notebook editors Undo/Redo for a text based customEditor isn't working
2 participants