'VS CODE - disable UNDO command after file was closed

If I'm making some files changes then close it and then reopen it, I will be able to undo those changes. How can I disable this behaviour that only changes made in the current open session can be reverted?

PS: this behaviour was not present for older versions of VS code.



Solution 1:[1]

See v1.45 Release Notes:

Disable persistent Undo

Last milestone, changed the Undo/Redo stack to be persisted when you close a file and reopen it. Not everyone wanted this new feature, so there is now a setting, files.restoreUndoStack, to disable persistent Undo.

[Additional info: see v1.46 release notes - you can undo even in files that were closed and remain closed.]

Solution 2:[2]

  • Open VS code
  • Click on manage {bottom-left}
  • Click settings
  • Search undo
  • Uncheck restore undo stack

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Abhi