1

From what i understand any work you do in application is stored in ram (until you save it), so if your computer shuts down before saving (to the hard drive) your interim work won't be saved. But i didn't observe this while working in VS Code; i.e. work that i didn't save before shutting down(i did force shutdown a couple of times) on my computer is back there when i restart my computer (in unsaved mode too!). How is this happening?

starball
  • 20,030
  • 7
  • 43
  • 238
Saurabh Agrawal
  • 162
  • 2
  • 13

2 Answers2

1

There seems to be a cache inside VS Code. Refer this question : Recovering file from the Visual Studio document cache?

I think it just restored the unsaved code from the cache. If you read the above question carefully you will see there are even known bugs with it.

heatstreak
  • 121
  • 3
0

This is VS Code's "Hot Exit" feature. See the official docs on the feature at https://code.visualstudio.com/docs/editor/codebasics#_hot-exit. TL;DR VS Code remembers unsaved changes when you close the application and restores them when reopening those files. You can control that behaviour with the related files.hotExit setting.

starball
  • 20,030
  • 7
  • 43
  • 238