-
Notifications
You must be signed in to change notification settings - Fork 29.5k
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
Notebook: Undo/Redo #92811
Comments
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation. Happy Coding! |
See #90110 for the issue with custom editors. Whatever solution we come up with may also work for notebooks |
Discussed offline with @alexdima about the expected behavior of Undo/Redo in Notebook, it makes better sense that cells(which are text documents under the hood) in a notebook document share the same undo stack, which is also the undo stack for the notebook document itself. Considering these operations on a notebook document which contains 3 cells
Now focus in One idea to solve this problem is having an unique Uri comparison key for Notebook resources, and the UndoService will use this key to decide if they are on the same stack or not. @jrieken already made the Notebook Document Uri and Cell Uri share the same |
fyi - discussions/problems around our current uri comparison challenge: #92502
That's some we should explore but that knowledge, e.g what compare-logic to use when, must somehow be pluggable (maybe per scheme) because things like rename-workspace edits don't know that they work on notebook cells |
Issue Type: Feature Request
Notebook is a resource which contains multiple text models so it leads to interesting requirements for workspace Undo/Redo. Right now there are three major scenarios
undoRedoService.pushElement(resource)
and the resource passed in is the resource uri of the notebook documentWorkspaceEdit
and Undo/Redo is not working properlyBulkEditService
to apply theWorksapceEdit
.WorkspaceEdit
consists of edits for multiple cells, which are allTextModel
s.WorkspaceEdit
, we have to focus the text editor for the first modified cell of theWorkspaceEdit
. However, we want to allow Undo/Redo when the focus is not in any text editor.I'm wondering if we can add something like
undoRedoAllowedResources
property to theIWorkspaceUndoRedoElement
, thus in the notebook case, it will always be[notebookUri, firstModifiedCellUri]
.export interface IWorkspaceUndoRedoElement { readonly type: UndoRedoElementType.Workspace; readonly resources: readonly URI[]; + readonly undoRedoAllowedResources: URI[]; readonly label: string; undo(): Promise<void> | void; redo(): Promise<void> | void; split(): IResourceUndoRedoElement[]; }
cc @mjbvz
VS Code version: Code - Insiders 1.44.0-insider (798481c, 2020-03-16T07:10:59.884Z)
OS version: Darwin x64 19.2.0
The text was updated successfully, but these errors were encountered: