microsoft/vscode

Unsaved files should be preserved on quit (hot exit)

dgileadi opened this issue ยท 97 comments

Mac OSX 10.10.5 Yosemite, VS Code 0.10.1

Modern apps have a convention of not losing changes when the application quits and files haven't been explicitly saved. Sublime Text is particularly nice in this regard, where newly created or unsaved files are silently preserved on quit and restored when it is launched again. This would be nice for VS Code to support as well.

To Reproduce

  1. Make changes to a file, or create a brand new unsaved file
  2. Quit VS Code

Desired Behavior

VS Code immediately quits with no prompt. After relaunching the changed file is restored with changes intact and an unsaved indicator.

Actual Behavior

VS Code prompts you to save the file or discard your changes.

FYI : I'm become a big fan of this after computer suddenly hangup/lost power/cats hit shutdown button/etc and everything get restore after reopen.

That's why I'm not uninstall Sublime yet tho.

+1 I occasionally need to exit my editor quickly and like not having to think about saving when I do.

elad commented

Would love to have this too. Very useful for scratch buffers and crash recovery.

+1 would love to have this feature too - for the same reasons elad mentioned. Actually not having this feature makes me using Sublime again.

This comment has been removed because it does not conform to the guidelines in the Code of Conduct for Microsoft open source projects, as covered here: https://opensource.microsoft.com/codeofconduct/

     From  Sublime Text, Preferences

    // Exiting the application with hot_exit enabled will cause it to close
    // immediately without prompting. Unsaved modifications and open files will
    // be preserved and restored when next starting.
    //
    // Closing a window with an associated project will also close the window
    // without prompting, preserving unsaved changes in the workspace file
    // alongside the project.
    "hot_exit": true,

Quite frankly the hot_exit feature of SublimeText is so important to me
That I won't even consider another editor that doesn't have the feature.

One reason this is the case, is my machine sometimes doesn't come out of sleep
so I just do a forced reboot - no problem as all of my changes will be preserved.

Also note: the hot_exit feature also preserves the undo stack for each file
this is quite valuable.

Guys please implement this feature this is the only reason why I'm not even consider using VS Code on a regular basis. My laptop shuts down unexpectedly at times so if I'm using Sublime I will be having no issues

elad commented

@jithurjacob stick with Sublime. Neither Atom nor Code are getting close anytime soon. I tried and failed to switch.

Same here, hot_exit is mandatory to try something else than sublime... would like to try, but can't imagine working again with editor that can't give me this security feelings that sublime is giving to me.

I often switch between 2 or 3 projects, that hot_exit let me do that with abslolutly no pain. Have to check code in another project, 3 new files in the current, no problem, project switch in the same window, copy past what i need, i come back to the working project, all is there ... even new file, undo etc ...

other situation, machin crash, need of restarting windows etc ... is osblolutly painless, as each project keep all files saved or not, open, i get back my tab in each project, can'l leave without this ,D

I really need this feature before I switch to VS code. It's very handy, easy to quit the editor. Many times, I intentionally leave some of my temporary work unsaved in Sublime for many days.

suyah commented

what's the status of this feature now? I just moved from windows to mac and found that sublime doesn't have the feature anymore!!!

ref #906

I have deleted my initial comments on this feature request because it was my personal opinion and not the VS Code opinion. We think this is a perfectly valid feature request.

elad commented

@bpasero I'm glad to hear that and I'm sure others are, too. I can testify that as far as Sublime replacements go, Atom doesn't look too good because it feels very slow and laggy, and I would love to have the option to switch to VS Code. That said, losing data is something that in 2016 should be off the table. I want my tabs restored when I reopen the browser and I want my unsaved/untitled buffers restored when I reopen my editor. :)

Quoting my comment on the similar Atom issue referenced just above my comment:

In Sublime I can just keep having drafts, kill it any time I'm presenting or having a sole-use of my laptop, and open it later with all drafts intact. The same even if my laptop crashed while Sublime was opened.

I'd love to see this happen with Code now that I'm using it way more often.

With the move to daily builds in Code (https://code.visualstudio.com/blogs/2016/05/23/evolution-of-insiders), I think this feature is even more important.

If I have to restart my text editor every day, and I'm using it as a scratchpad, I don't want to have to save each and every scratch pad once a day, when it's just temporary note files.

It would be great if we can just restart for an update, and have it exactly where we left off.

Browsers remember last saved tabs, so it would be cool if Code can also remember your open buffers as well =).

Installed Code today and the first thing I tested was tabs, the next thing I tested was hot_exit, disappointed on both counts. However I can live without tabs, as ctrl+tab works as expected. Will not be making the switch or recommending Code to anyone soon because of hot_exit. Guess I'll be sticking to Sublime Text for now.

  • 1
    Would be very useful for my surface book and its dead sleep :)
pr0g commented

+1 - I would absolutely love this feature!

What is the current status of this feature? When we can see this feature in action?

+1 I've been using Sublime Text for a while and I really miss this feature in Code.

+1. I can't remove sublime only because of that.

This has been "fixed" with a setting that allows you set the interval for saving your doc. But it's not the normal default that OS X has now for when any doc is closed that the system has already been saving every keystroke the whole time, and the entire state of the app has been preserved. I think Windows generally does the same thing. Not sure why this app can't hand over that functionality to the OS...

after developing in VSCode and publishing extensions in VSCode , i still have to use notepad++ to have auto save untitled files and open when opens next time..
Please do it urgent
its very important features that is not implemented yet that stopped me to use VSCode for my dirty notes

still under review since March.

I think we need to create an extension for this

@shanalikhan Actually I am trying to. But since VSCode doesn't provide API like onEditorExit, it's not easy to implement such extension in standard way.

@fyears maybe save after every edit, with timer to prevent overload?

elad commented

@k00lagin @fyears yes. Using an "onEditorExit" hook won't save work after crashes. For every open editor window, keep a buffer with the text + path to backing store (if there was any). After every edit, but not too frequently, update the buffer text.

@k00lagin @elad Actually VSCode has provided the setting "files.autoSave": "off" for the titled (saved) files in the way as you state. But while using this feature, the editor just ignore the untitled ones while closing editor...

I would say, well, the existing feature is kind of IDE-like, but definitely not SublimeText-like and I could not use VSCode as the "sketchpad".

Moreover, even the extension is implemented in this way, to ensure things going well, we still need the last check with onEditorExit. (And actually SublimeText is not friendly with crashes, which makes me guess it only invokes saving on exit.)

I agree with everyone else, a "hot exit" feature is one of the few killer features that keeps me on Sublime

Having this would make it much less of an issue to restart vscode to install/update extensions. If it's an option on exit it could even be turned on temporarily for all window reloads.

This feature "Unsaved files should be preserved on quit" still not yet implement in VSCode version 1.4 !
It's really needed feature.

Just wanted to vote for this. Can't believe it's been open for almost nine months - VSCode doesn't compete with other similar editors without hot exit.

@amosharper, Why you mention some specific shareware program name.
Here is freeware Notepad++,
Notepad++ have great feature about this,
See this...
screenshot_2016 08 20_08h38m31s_001_
https://visualstudio.uservoice.com/forums/293070-visual-studio-code/suggestions/10441491-remembering-last-session-and-auto-saving-untitled

Why you mention some specific shareware program name.

Given how popular that specific shareware program is, it's not unusual that many of us could have been using it for quite a while before Visual Studio Code, and have been using this feature in it way more than the specific freeware program you mentioned.

@lovebdsobuj Please kindly do not spend too much time on this in the thread because that would be thread hijacking. Hopefully you'd agree that this is a mere detail anyway, but please, let's keep it at this either way. Thanks.

Actually,

  • Asking to save on exit time, it's a old model.
  • Exit time need to keep all opened tab as well.
  • Asking to save file when user try to close opened tab.
    It's a new and modern model.

Hope, upcoming version Visual Studio Code developer team implement this thing very well.
Thank you.

I just tried VS Code for the first time and discovered the lack of "hot exit". I've decided to stick with Sublime until this is remedied. Forcing me to save forces me to name the file, determine where to put it, and then manage it's lifespan going-forward...a huge burden for something I intentionally want to be temporarily-lived.

I've had VS Code crash on me a few times, and lost content...sigh.

Is this something that's on the roadmap?

really hope this feature in upcoming versions.

rtorr commented

Can I also request that a unsaved file should not prompt to be saved when an editor window closes?

concerns listed here #9304

tsi commented

+1 for:

  • Restore unsaved changes to files (not auto-saving, just keep the changes in the editor) on re-launch.
  • Restore changes to untitled tabs.
  • Optional prompt on exit (I'd default to false).

Thanks!

+1 this is someting i miss in this editor it would be a huge help if the editor also reopened previous files without having to open a folder.

Atom's Behavior

Based on my testing of Atom v1.10.2, it seems to only care about the single editor case. When a second editor is closed with changes there is no dialog and there is seemingly no way to restore the files ๐Ÿ˜จ

Sublime Text's Behavior

Based on my testing of Sublime Text 3 build 3114, Sublime only enables hot exit when only a single editor is opened. When attempting to close an editor with dirty files when 2+ editors are opened, Sublime will always show the save dialog.

If a single editor has dirty files and is closed and then Sublime is launched with a different folder via subl <path>, 2 instances of Sublime will be created:

  • One at the path specified in the command line args
  • One with the same folders opened in the "hot exit workspace" with all the dirty files open

Proposed VS Code Behavior

I was initially keen on having some clever logic where the files being restored are bound to the open project folder so there could be multiple sets of folders. While this certainly does have its benefits, it's also quite a complex model for users to understand. The major downside being that there's the very real potential to lose work by losing track of backups. For example, if 2 folders with dirty changes are closed and a different folder is opened, using that model the files would not be restored until the original folders were opened again.

I propose behavior very similar to Sublime's, where hot exit is only triggered when the last instance of VS Code is being closed. And if a different folder is opened after a hot exit backup then a second instance appears on next launch with the unsaved changes.

Separate backups on a per-instance basis may happen behind the scenes regardless in order to implement crash protection (#12327) and to reduce the critical path time when closing down VS Code.

elad commented

@Tyriar you had me at "very similar to Sublime's." Just please don't lose my data. It's 2016, use all the disk space you want. ;)

@Tyriar if it were me, I'd try to avoid the unfriendly prompts when any non-last editor is closed. I think I'd keep VS Code launching to a blank screen by introducing a new sidebar tab that lists closed files that weren't saved at time of closure (including those on disk but with unsaved changes).

If a user opens a file for which an unsaved version exists in the list, I guess I'd either offer them a diff and ask them which version they want to load, or just load the unsaved version (the latter avoids problems if a user opens a folder with multiple unsaved files, where they'd be bombarded with messages about which version to open).

I'd also put a message at the top (as you do with available updated, etc) to indicate that the version that had been opened was the unsaved version.

That said, what you've proposed will still be a great improvement over what we've got at the moment.

It could be me, but I feel a bit of ambiguity has crept into the latest discussion since #101 (comment). The original issue description seems to describe and conflate two important but (IMO) subtly different use cases:

  1. The behavior when exiting with open views of existing files on disk
  2. The behavior when exiting with open views of new unsaved buffers

The usable prompting behavior to handle (1) does seem nuanced, and @Tyriar's assessment makes sense. However, I'm not seeing any explicit solution proposed to handle case (2).

For me, one of the features of Sublime which I "take for granted" and which is explicitly called out in the original issue description is the ability to create unsaved "scratch" buffers and have absolute confidence that they will persist across editor restarts without prompting me to save them.

Is there agreement that (2) is a separate use case? My opinion is that for (2), prompts have no place in the solution. Unsaved new buffers should simply exist in perpetuity until closed between editor restarts without user intervention until they are explicitly saved to a user-provided filename, at which point prompting comes into play per #101 (comment).

Thoughts?

No matter how many instances are opened it saves all untitled files.

When editor opens with empty workspace or not folder it should pop up to open all the untitled files in tabs or all instances or open it layer on. when user select folder to open and close editor

It shouldn't delete the files even then let it be configurable to remove all or keep it but when user says to keep it it should always either ask or open the untitled files directly this can be made configurable too

@ironcladlou unsaved new files behave the same as dirty existing files in Sublime so that's the behavior we're going for, at least initially. So hot exit will only be available when closing the last instance and it will backup and restore both unsaved new files and dirty existing files.

maxlk commented

@Tyriar Sublime allows to close all open windows simultaneously through the menu. In this case all windows will be restored next time Sublime is opened. I'm using it a lot on my home PC (to avoid other family members editing/closing my work).
So, please don't limit hot exit to last window.

Agree with @maxlk. Prompting on the non-last window removes a significant amount of the benefit of this change, since a user cannot reliably (for example) shut down their machine and be sure that all files will meet them on startup.

@maxlk improvements beyond what I've specified would likely have to be made after the September release as it's getting close to endgame already. I created #12436 to track this.

This won't make it into the September release unfortunately,. Hopefully it will land in Insiders after v1.6 comes out so it can get a decent amount of testing before shipping to stable.

I was starting to like VSCode until I realised it didn't have this feature (the first time I was required to reboot my machine, a rare thing - normally only on patch Tuesday).

No session persistence at all?! Not autosaving unsaved changes to a session is one thing, but it doesn't even restore which files you had opened (unless you open a folder, which I never do).

I use NP++ as my primary text editor, I can have split views with dozens of files open in each, when I close and reopen the editor its like I never closed it. All the views and open files are persisted, unsaved changes are persisted, all the caret positions persist, all my jump points (bookmarks) persist, etc.

VS Code offers NONE of the above :( .Visual Studio at least persists open files and views, why wouldn't VSCode do this? I saw a feature request for this from 11 months ago, but it was never implemented or had any comment from MS even though it had 300+ votes.

@thedarkfalcon VS code does have auto save (setting "files.autoSave": "afterDelay"), it also restores sessions, the default is to restore the files in a single editor but you can change this to cover multiple editors ("window.reopenFolders": "all").

But anyways, hot exit was planned for the upcoming release but didn't make it in time so it should land in v1.6 which will come to the stable channel in just over a month.

@Tyriar - I'm sure that's helpful but it only works if a folder is open. Personally, I use VS Code often without opening folders (as it's a great editor for single files as well) and it would be nice to have an option restore that editor state as well.

The setting might be revised to something like:

"window.reopenEditors": {"all", "all-folders", "one-folder", "none"}

Conveniently, if you open a folder in vscode, you can then open files outside that folder and their state is restored as well when the editor is reopened, so that's a nice workaround. It definitely suggests the ability to do it without a folder is already there, just needs to be enabled.

@Tyriar thanks for the response, but as I had mentioned in my post I don't think session restore should be limited to only work with folders. I am often working with files spanning many directories (many times spanning many different machines even), so in this case the limited session functionality that VSC has doesn't help me.

Further, the autosave feature actually saves to the file, this isn't what I want. Most of the time my unsaved changes are because the file is in an incomplete state, I wouldn't want to save (or autosave) it how it is, hence why I want the session to be saved, not the actual file.

Scenario: Have multiple files open spanning several completely different directories, several of these files have unsaved changes. Close VSC, reopen it.
Desired Behaviour 1: All previously opened files are reopened with the same view/caret position.
Desired Behaviour 2: All files are in the same state they were before VSC was closed (i.e. any unsaved changes are still shown).
Actual Behaviour: VSC is blank when opened ๐Ÿ˜ฅ

@thedarkfalcon under the default setup you're supposed to get desired behavior 1 automatically so I'm not sure what's going on there, create another issue if you think something is wrong on our end.

Desired behavior 2 is this feature request which is in progress.

@Tyriar okay thanks.

you're supposed to get desired behaviour 1

Just checking before I open another issue, if you open VSC, then open files from different locations (not using the "open folder" function) by either dragging them into the editor or using Open File, you expect these files to reopen after closing and opening VSC? Because that is definitely not what I am getting in v1.5.3.

@thedarkfalcon you're right this doesn't seem to work when you don't have a folder open. I'm not sure if a feature request exists for that yet but it would make sense to have.

๐Ÿ‘ This is a killer feature in sublime, this is really needed in vs code

+1 for this...I do use this feature in SublimeText more than I realized. Really missing it with VSCode.

Just want to stress the point made by @thedarkfalcon about the files.autoSave preference set to afterDelay causing files to be saved in-place, which doesn't work in common web-development situations where you run a watcher that would rebuild incomplete code on-the-fly.

I elaborated more on this in a prior post for #906.

I actually hate Sublime Text's hotexit feature. Atom implemented it - with no way to turn it off! That was actually the main reason for me to switch to VS Code: When I close an unsaved file it asks me two save it.

So please make this an option. I also hope that you don't make hotexit the default with an update, as this is quite a major change which most people won't expect. A prompt if unsaved changes should be saved is actually quite common (e. g. Visual Studio).

@jhasse there will always be an option to toggle it on or off. My plan is for it to be disabled by default for the first version it ships and switch over to the default on the following version. This would be a team decision though. I'm of the opinion more people would like the feature than not and it would be easier to turn it off if you're so inclined then to assume it's implemented and go seek it out in settings.

+1 for this! It's the one crucial feature that VS Code is missing!

+1 This is a crucial feature for me to use this as my daily editor.

+1 for this feature and being implemented to be configurable.

Stop +1'ing, people. The feature is tracked as in progress and should be delivered this month.

If you want to +1 add a ๐Ÿ‘ to the first comment.

Hi all, here's an update on this feature. The plan was to push it in for v1,7 in an incomplete state (working for Linux and Windows when closing single windows only) but the implementation is still going through some heavy changes and I don't think it's stable enough to be included for the October release after being in the insiders build for 1.5 days.

Here is the current PR which includes all the hot exit related changed #14115, also issues associated with the PR are now being tracked in GItHub issues under the hot-exit label since it was a real headache trying to track everything only within the PR.

I've broken the feature down into 4 parts that will be worked on in order:

  • #14200 Closing a single window that has a folder open and restoring it on next open (Windows/Linux)
  • #13733 Closing a single window that does not have a folder open and restoring it on next open (Windows/Linux)
  • #13305 Closing all windows and restoring them on next open. Due to the way that the application is still alive after exiting on Mac, this is the only way to use hot exit on Mac (cmd+q) (Windows/Linux/Mac)
  • #12327 Restoring backups after a crash (Windows/Linux/Mac), this is a stretch goal for November

@Tyriar I can't seem to see how to enable this (I'm using insiders nightly builds).
Only slightly related options I can see is the previously existing "window.reopenFolders", and "files.autoSave"...
Or has it been pulled from insiders?

@thedarkfalcon it's been pulled, it will probably come back to Insiders in 1-2 weeks.

What is the status for this feature will we see this in upcoming stable build ?

The initial PR got merged on Friday and it has landed in the Insiders build. Provided there are no major issues it will stay this time ๐Ÿ˜ƒ. To enable it you will need to add the following to your settings.json:

"files.hotExit": true

Currently the cases in which hot exit will work are:

  • When you're exiting the last window in a folder workspace - If you have multiple windows open you will still get the confirm dialog. Note that this does not apply to Mac as VS Code does not shut down when you close the last window.
  • When you're exiting all windows (cmd+q or file > exit)

See #101 (comment) for a checklist the major remaining user-facing parts of the feature. The list of current hot exit bugs can be viewed here, if you find something that's not on the list please create a new issue.

Is it just me or is it not working? I have the the current Insiders running on a Macbook Air with the setting enabled. But no matter what I do it always asks to save the changes.

Code - Insiders
Version 1.8.0-insider (1.8.0-insider)
3408691
2016-11-14T07:03:06.956Z

Not sure if it's a difference in OS, but on Windows I think it's only
working if you have a folder open. Without a folder open I am prompted each
time as well. You can see the four parts they are working on here:
#101 (comment)

On Tue, Nov 15, 2016 at 2:41 PM, devployment notifications@github.com
wrote:

Is it just me or is it not working? I have the the current Insiders
running on a Macbook Air with the setting enabled. But no matter what I do
it always asks to save the changes.

Code - Insiders
Version 1.8.0-insider (1.8.0-insider)
3408691
3408691
2016-11-14T07:03:06.956Z

โ€”
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#101 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAH0gx_TRuwf8Z-h1btrpWFpoQ6gLZPwks5q-grhgaJpZM4GlCMA
.

@devployment currently only cmd+q will trigger hot exit on Mac (#13305). Enabling hot exit all the time for a particular folder is being discussed in #15467.

@seanwcom support for empty (no folder) workspaces is not yet implemented, see #13733.

Ok. Totally missed those. Thanks for the pointers. Will check the linked tickets. Keep up the great work!

"Hot exit save" copies the entire content to second file if you're just switching from first file to second file without saving first file. Very dangerous cause totally corrupts the second file with content of first, if you are unaware of what happens and you close second file with out "undo".

@bpj101 each backup file is saved to a path based on the original file's path, so something like that shouldn't happen. Do you have repro steps showing the problem? If so, please create a new issue as > 50 people get notifications when a comment is made on this issue.

In app.js file, notice content

[image: Inline image 1]

In app2.js notice content

[image: Inline image 2]

Back in app.js file. Just add black lines to top of code. Notice indicates
1 file to be saved.

Now, without saving app.js, I click on tab to go to app2.js

[image: Inline image 3]

Now notice the content from app.js has been copied to replace content in
app2.js, without changes made to app.js

[image: Inline image 4]

I hope this makes sense.

Thanks

On Wed, Nov 16, 2016 at 10:02 AM, Daniel Imms notifications@github.com
wrote:

@bpj101 https://github.com/bpj101 each backup file is saved to a path
based on the original file's path, so something like that shouldn't happen.
Do you have repro steps showing the problem?

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#101 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADxkgZHrcIrXqmB1sw45MAxa54p7liBYks5q-0VDgaJpZM4GlCMA
.

Thanks @bpj101, the images don't seem to make it through when commenting via email though โ˜น๏ธ

Sorry. I hoe the written comments in the email helps.

On Nov 16, 2016 11:47 AM, "Daniel Imms" notifications@github.com wrote:

Thanks @bpj101 https://github.com/bpj101, the images don't seem to make
it through when commenting via email though โ˜น๏ธ

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#101 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADxkgXdN7b_sXX_XWezLBrJgz4GH763Yks5q-13egaJpZM4GlCMA
.

50+ people get notifications when a comment is made on this issue.

Sir @bpj101, If you just edit your previous comment with images, It will better.

I just pushed empty workspaces which also closes off the crash recovery story so I'm closing this off โœจ Empty workspaces should come in the next Insiders build.

Has this been released, or is going to be released soon? There are a ton of comments to try and figure out if the original story was rejected, fixed, or if something else but similar was put in place.

@g5codyswartz to be released soon (tomorrow), you can always check the milestone the issue is assigned for when it's expected to hit the stable release.

Edit: Hah, beat me by seconds @Tyriar.

@g5codyswartz

preemptive tl;dr: Should be released in, like, 24 hours, with the 1.8 release.

@Tyriar's comment farther up shows that he broke this issue into a few different sub-issues to better track the relevant parts that needed to be implemented, in case you hadn't seen those.

Also, you can always check the iteration plan for an upcoming release and see if a feature/bugfix/etc. made it onto the list, as well as check it's completion state!

Hope that helps!

Also, thanks so much for the hard work on this @Tyriar and @bpasero.
All of us Sublime Text transplants couldn't be happier!

My apologies for commenting on a closed issue, but this seems to be the best place to ask.

Hot exit seems to be working great on any unsaved files, but should saved files also be restoring? Perhaps I'm missing a setting somewhere, but I've looked through and didn't see a way to set that. My expectation is that dirty or not, the full session would restore. Right now if I have 2 dirty files, 1 untitled (dirty) file, and one saved file then the first three are restored, but the saved file is not brought back.

I'll be happy to open a new issue if needed, but thought I would check here first in case I'm just missing a setting. Thanks for everyone's effort on this!

@seanwcom we do this as long as you have a folder opened, but not in "empty" workspaces (see #207)

I need this for "Untitled" files. Everytime I close VSCode manually, it is prompting me to save untitled files. If I don't save it, then its not restored. I don't want to save those untitled files, I just use those as scratch notes. If I ctrl+alt+del to force exit then it works, but i prefer not to ctrl+alt+del it.

@Noitidart it should behave exactly as you expect right now.
I checked my user settings and the only setting that might affect this is:

"window.restoreWindows": "all"

although based on the description I'm not sure that's right either.

All I know is that on Windows 10 x64 and the last many VS Code releases, I can have one or more untitled, unsaved buffers open and modified and they restore just fine through closing and opening, regardless of how I seem to close it.

Oh thanks @joshsleeper will try now! Mine was set to "one"

Edit:
If my untitled file has unsaved chnges, it is still prompting :( even after pref change.

https://screenshots.firefoxusercontent.com/images/c80f3433-b728-4f38-a7a4-c3775f10fac8.png

edit

If my suggestion doesn't help, rather than keep bumping this rather old thread, just submit a new issue proper and tag me so we don't tick people off any more than we might've already. ;)

@Noitidart drat!

Just to be sure, you are using the correct setting, right?
The name has changed over time.
It used to be window.reopenFolders, then window.reopenWindows and now it's window.restoreWindows

Just grasping at straws, because as of #28580 it should totally be working properly and certainly does for me.

Make doubly sure you don't have any invalid user settings maybe?

@joshsleeper found it! Thanks so much for your help! There was a setting called:

"files.hotExit": "onExitAndWindowClose"

Mine was set to "onExit" I changed it to "onExitAndWindowClose" and it's perfect! VSCode rocks!!