Change:
Issue Type: <bBug</bAfter updating to 1.43.0, when VSCode relaunched, it brought up around 80 editor windows from old projects I hadn't opened in quite some time. (spooky workspace necromancy) Perhaps obviously this made my computer behave quite poorly. I tried adding "window.restoreWindows": "none" to my with another text editor, but it didn't seem to be respected (might be my fault somehow). Note that it had been on "folders" previously, in case that helps. I also tried to muck about with file. VSCode seemed to ignore my changes to it (probably not a bug -- I was desparate and dunno how this file works), but I do have a backup of a from right after this happened. It shows all the windows it will try to open when launching, and maybe other stuff. I guess the system info probably has more PII anyway. I dunno how much this helps but: I think the main common feature of the workspaces it resurrected seemed to be that they had open files with unsaved changes -- but these are also the ones which can't be closed without additional UI confirmation, and I did try a couple things to close all windows in bulk (none seemed to work, but maybe I just didn't notice?) Relaunching without extensions also didn't help, but that doesn't mean this wasn't caused by an extension in the first place or somethign. I have more than is probably reasonable installed. That said, it happening immediately after updating to 1.43.0 makes me think it's vscode and not an extension. Anyway, ultimately I just bit the bullet and closed them manually -- VSCode would be usable for about 20 seconds after starting, during which time I could close a few before too many were restored and everything got too slow. So i just did this, quit, and repeated many times until there were no more left (this actually took a couple goes -- even when I'd get down to none left, save, and reopen, it would find some new ones to bring back... Guessing these just didn't make the cut for being restored the previous time, or something) P.S. it would be nice if there were a command line argument to launch without reopening anything. P.P.S. In case it isn't clear: I've been using , , and somewhat interchangably here, just so you don't think I'm being precise about which I use when. VS Code version: Code 1.43.0 (, 2020-03-09T19:34:44.548Z) OS version: Darwin x64 18.7.0 <details<summarySystem Info</summary </details<details<summaryExtensions (55)</summaryExtensionVersion ------ code-gnu-global0.2.2 better-toml0.3.2 glsl-canvas0.2.8 bracket-pair-colorizer-20.0.29 dart-code3.8.1 xml2.5.0 scopes0.45.0 gitlens10.2.1 vscode-html-css0.2.3 tslint1.0.44 vsc-material-theme32.5.0 vsc-material-theme-icons1.1.4 prettier-vscode3.20.0 vscode-test-explorer2.17.0 vscode-peacock3.6.0 language-haskell2.7.0 center-editor-window2.3.0 chat0.31.0 restructuredtext120.0.0 fish-ide0.4.0 regionfolder1.0.8 Kotlin1.7.1 rust-analyzer0.1. Lisp0.1.10 ninja-syntax1.0.0 prettify-json0.0.3 vscode-json51.0.0 vscode-docker1.0.0 csharp1.21.13 sublime-keybindings4.0.6 vscode-typescript-tslint-plugin1.2.3 vsliveshare1.0.1711 vsliveshare-audio0.1.80 vsliveshare-pack0.3.4 debugger-for-chrome4.12.6 idl0.3.1 autotrim1.0.6 proto0.0.2 material-icon-theme4.0.1 polacode0.3.4 tcl0.1.0 crates0.4.7 trailing-spaces0.3.1 vscode-scheme0.4.0 fish-vscode0.2.1 shader1.1.4 rewrap1.9.1 shellcheck0.9.0 org-mode0.5.0 cmake0.0.17 vscode-lldb1.5.0 vscode-icons10.0.0 material-theme3.2.3 vscode-open-in-github1.3.6 tslint-snippets1.1.0 (11 theme extensions excluded) </details<!-- generated by issue reporter --
FWIW this does seem to be respected now and I haven't changed anything, maybe indicating that it was being ignored for some reason during all this? Not sure if this is important, but worth noting I guess.
Hit the same issue here, VSCode opened up a few hundred projects after upgrading and my mac nearly fell over:
Yeah, I expected this to happen. Works now "correctly" after pushed This is expected hot exit behaviour to restore workspaces that have backed up files.
Hit this last night as well and it completely froze my machine up for minutes opening at least 40 windows. I get why this is an expected fix for a bug, but I it made my computer totally unresponsive and probably could have used a more progressive one-time rollout.
So it looks like this was a regression in 1.42 () and it's now fixed as it's designed. It's designed this way so that by default, backups don't go "missing" by accidentally closing window(s) and forgetting which one had your notes in it. I can attest to the fact that it's awful when many windows unexpectedly restore as it happened to me when testing settings sync. I'm not sure what the right recovery fix is but you can workaround this in the meantime by setting in your . To go back you would need to either delete the backup files manually ( from the 's folder) or open the workspaces and close unsaved files.
Just to clarify, for anyone coming to this thread who's hosed with 40+ windows, it sounds like what you're saying is the workaround is set to so that we don't have to go through a ton of different "do you want to save this?" prompts when we try to close every window. set to (or another reasonable setting) so that VS Code doesn't try to open a ton of windows for every workspace with unsaved files. delete the unsaved buffers manually until things are bearable again. Is that the recommendation?
Is all I needed to stop the window tsunami.
if you just set you should be fine if you then open a new folder () and then close the window. This is actually how I've always used hot exit and recommend it if you haven't tried, it takes the rails off and was meant so that you can close windows arbitrarily even on macOS as well as not restoring all windows with backups whenever VS Code gets launched. If you want to go back to , deleting the buffers manually after reviewing is probably the best way to go.
I'm struggling to find a way to properly fix this for users without just changing the behavior something since this change in behavior looks to have been in . Maybe some restriction on the maximum number of windows that can be opened at once, with a dialog if it's over 5 or something? do you know what the behavior was before? seems to add folders to a the active workspace, does this mean all workspaces with folders were getting restored into a single window, or did they get dropped somehow?
I am quite sure we opened 1 window per backup directory with backups. So ended up always restoring every window that has backups. We decided with this approach to ensure we always bring back dirty files into their windows independent from any setting (other than the hot exit one at least). Btw untitled workspaces behave exactly the same for the same reasons because they may contain setting changes that are unsaved.
I think you're describing the designed behavior, I mean to ask about the behavior to 1.43 so that it's clear how having caused the backups to behave and why backups stacked up not getting restored (was this because they weren't being saved to anymore?).
I think can comment if there was some intention behind the change or just an oversight. To be clear: I would never expect a folder with backups to be to a workspace to turn it into a multi-root workspace.
One thing might be considered, as discussed with in Gitter, is to limit the number of windows/workspaces to be restored upon start, such as 10 at most, which might relieve this "correction".
We decided to fix this by reverting the change and no longer restore the folders with unsaved content. That was the behavior from 1.32 to 1.42 and as we didn't get any complaints, this seems to be practical. You can always open these folders from the recent menu, and unsaved content is restored. I created as a followup issue for the next milestone. We plan to also no longer restore workspaces (except unsaved/untitled workspaces) and we will add more information to the recent menu to show which folders/workspaces have unsaved content.
To verify: set open 2 windows, each opened on a folder. Make a unsaved change or add a untitled file with content close both windows. There should be no questions asked, exit VSCode open VSCode on an other folder (). Only one window should appear

Discussion:
let foldersToRestore: URI[] = []; let workspacesToRestore: IWorkspacePathToOpen[] = []; if (openConfig.initialStartup && !openConfig.cli.extensionDevelopmentPath && !openConfig.cli['disable-restore-windows']) { <del> let foldersToRestore = this.backupMainService.getFolderBackupPaths(); foldersToOpen.push(...foldersToRestore.map(f => ({ folderUri: f, remoteAuhority: getRemoteAuthority(f) }))); </del> <ins> // don't restore backuped folders, for #92318. // let foldersToRestore = this.backupMainService.getFolderBackupPaths(); // foldersToOpen.push(...foldersToRestore.map(f => ({ folderUri: f, remoteAuhority: getRemoteAuthority(f) }))); </ins> // collect from workspaces with hot-exit backups and from previous window session workspacesToRestore = [...this.backupMainService.getWorkspaceBackups(), ...this.workspacesMainService.getUntitledWorkspacesSync()];