How can I keep undo history after saving on Visual Studio Code

Eliot  picture Eliot · Feb 3, 2017 · Viewed 20k times · Source

I'm using latest version of VS code (1.9.0).

After I undo (ctrl+z) something, and save the file (ctrl+s), then I cannot redo anymore (ctrl+y).

I would like to go back and forth during the editor is running same as Sublime or other editor. Can anyone solve this problem? Thank you.

Answer

Mark picture Mark · Apr 30, 2020

For people getting to this question that want to disable the persistence of the undo stack after a file is closed, this too appears to be coming to v1.45.

See https://github.com/microsoft/vscode/issues/94778 and https://github.com/microsoft/vscode/pull/96317 and v1.45 Release Notes:

"files.restoreUndoStack": false

Set to false to disable undo stack items after a file is closed. the default is true.