ONE-vscode
ONE-vscode copied to clipboard
[OneExplorer] Undo/Redo
What?
Let's find out how to support undo/redo operations
It seems that vscode provides workbench history stack, which can be seen by 'timeline' panel. Let's use it.
Reference
https://stackoverflow.com/questions/46446901/how-can-i-see-local-history-changes-in-visual-studio-code
API for undo stack is NOT SUPPORTED!
StackOverflow Q&As
I do not see any way for extensions to directly access the undo stack. The undo stack is implemented in editStack.ts, but it isn't exposed in the API.
I also do not see any open issues requesting such access. I didn't search through closed issues though.
https://stackoverflow.com/questions/57900097/where-to-find-vscode-undo-stack-documentation
onDidChangeDocument
supports undo/redo for Text Editors, but onDidExecutedCommand
will NOT be supported
(1) undo/redo is supported by onDidChangeDocument
event emitter.
(property) CircleEditorDocument._onDidChangeDocument: vscode.EventEmitter<{
readonly label: string;
undo(): void;
redo(): void;
}>
(2) There was an argument on supporting onDidExecutedCommand
and finalized not to implement it.
Firstly, the need was raised: https://github.com/microsoft/vscode/issues/1431 But, on its implementation, the vscode maintainers decided not to implement the api: https://github.com/microsoft/vscode/issues/78091#issuecomment-518545491
Timeline View
https://code.visualstudio.com/updates/v1_44#_timeline-view
Timeline view is powered by git, git-lense, workbench, ... https://github.com/microsoft/vscode/blob/main/extensions/git/src/timelineProvider.ts (git example)
Should I inspect and mimic this timline view...? :thinking: