Visual Studio Code never reopens previous file or folder

Solution 1:

It seems, VsCode only remembers opened files, if you also have a folder opened. It doesn't matter, if this is just a Dummy Folder somewhere on your drive - if you open files outside of this folder, they will be remembered aswell.

I'm not sure if this is as designed, or a bug.

Edit: This is a bug and tracked here

Edit 2: To sum up the answers from below there are now two settings concerning this issue:

Hot exit has been implemented, which restores files which weren't saved before VS Code is closed. To change this, use this setting:

files.hotExit: "onExit"

To reopen all files, use this setting:

window.restoreWindows: "all"

But there is still on open issue with this found here.

...

Solution 2:

Go to: Open File --> Preferences --> Settings and add "window.restoreWindows": "all" to your settings.json file. Remember to add a comma to the preceding statement.

This will reopen all the windows you had open on the close of your last session.

Solution 3:

You could try the settings option:

"window.reopenFolders": "all"

This should reopen everything that was opened when you closed the editor, but I haven't tested it. I usually prefer that nothing gets reopened, so I use none. The default is one.

Solution 4:

They added this functionality in November 2016.

Here is the setting for changing hot exit behavior:

"files.hotExit": "onExit"

Solution 5:

So I needed that functionally too, currently it's just

"window.restoreWindows": "none",

in the settings.

Controls how windows are being reopened after a restart. Select 'none' to always start with an empty workspace, 'one' to reopen the last window you worked on, 'folders' to reopen all windows that had folders opened or 'all' to reopen all windows of your last session.