-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Support linked undo operations #101789
Comments
Pushing out to August. |
One use case from notebook, to split a cell by cursor position, what we do now is
right now when performing above two operations, we explicitly ask them not to push undo elements into the stack, and we create a custom undo element instead. It would be simpler with linking two undo operations. |
…l contains foreign elements (#101789)
@alexdima @jrieken it seems there is an issue with edits with the same undo/redo comparison key in the same group, I tried to apply bulk edits like await this._bulkEditService.apply(
[
new ResourceTextEdit(cell.uri, { range: textModel.getFullModelRange(), text: newLinesContents[0] }),
new ResourceNotebookCellEdit(this._notebook.uri,
{
editType: CellEditType.Replace,
index: index + 1,
count: 0,
cells: newLinesContents.slice(1).map(line => ({
cellKind: kind,
language,
source: line,
outputs: [],
metadata: {}
}))
}
)
],
{ quotableLabel: 'Split Notebook Cell' }
); The first edit is happening on |
Undo with above setup will not run into this code path vscode/src/vs/platform/undoRedo/common/undoRedoService.ts Lines 1038 to 1042 in 6891688
|
@rebornix I did not adopt the undo redo grouping for |
I can try debugging if you could tell me the exact repro steps or you can try debugging by using |
@alexdima thanks, vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.ts Lines 215 to 239 in 4aa873b
I'm wondering if we should allow pass in undoRedoGroup in |
@jrieken Can you please help here? I think this is something specific about |
@alexdima Is there any harm if the simple path (task.length === 1) is being removed and we always go through the service? |
@jrieken I think it should be fine, but I suggest we do it in the debt week, and test it out a bit. Maybe you have a way to find out this special use-case where the text edit is a part of a larger bulk edit and only do it then? I think many extensions use some vscode API that ends up here with a single file (e.g. liveshare that I know about), and pushing multi edit stack elements with a single buffer will work, but it might end up always prompting in the undo case ("undo across all files?" even if it is a single file). |
created #107677 for the follow-up work |
This is left-over work from composite undo and describes the problem that you cannot undo a Java class rename in one operation but need two undo's.
The text was updated successfully, but these errors were encountered: