ONE-vscode icon indicating copy to clipboard operation
ONE-vscode copied to clipboard

[OneExplorer] Undo/Redo

Open dayo09 opened this issue 2 years ago • 2 comments

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.

Screenshot from 2022-10-19 19-40-38

Reference

https://stackoverflow.com/questions/46446901/how-can-i-see-local-history-changes-in-visual-studio-code

dayo09 avatar Oct 19 '22 10:10 dayo09

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

dayo09 avatar Oct 24 '22 02:10 dayo09

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:

dayo09 avatar Oct 24 '22 03:10 dayo09