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
Cannot undo edit from CodeAction #1548
Comments
Any known workaround for this issue? |
@rkistner, if you're still looking for a workaround: In https://github.com/microsoft/vscode/blob/6ee4811eed9a20487b28996522cdbe664c852dfa/src/vs/editor/standalone/browser/simpleServices.ts#L651 if I replace applyEdits(edits.map(edit => EditOperation.replaceMove(Range.lift(edit.range), edit.text))); with model.pushEditOperations([], edit.map((e) => EditOperation.replaceMove(Range.lift(e.range), e.text)), () => []);
model.pushStackElement(); the undo/redo functionality seems to be working again (tested with monaco-editor-core 0.17.0). I have not thoroughly investigated if this quick fix breaks anything else, but maybe it works for your purposes. Since this issue is already open since August, I expect it can't be this simple. If @alexandrudima has any insight on this, that would be helpful. |
I took a stab at taking your example @gins3000 and getting it upstreamed after confirming it locally 👍 |
Thanks a bunch @orta ! |
monaco-editor version: 0.17.1-0.18.1
Browser: Chrome/Firefox/Edge Dev
OS: Windows 10
If you register a
CodeActionProvider
that applies an edit operation, this edit operation is apparently not pushed to the undo stack.Ctrl+Z
to undoNothing happens. If you edit the text before applying the code action and undo, the edit from before is undone instead of the edit from the code action.
Addition: This bug also affects the edits of the new TypeScript
RenameProvider
. So maybe it's edits in general.Playground:
The text was updated successfully, but these errors were encountered: