Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsaved files should be preserved on quit (hot exit) #101

Closed
dgileadi opened this issue Nov 18, 2015 · 97 comments · Fixed by #12400
Closed

Unsaved files should be preserved on quit (hot exit) #101

dgileadi opened this issue Nov 18, 2015 · 97 comments · Fixed by #12400
Assignees
Labels
feature-request Request for new features or functionality plan-item VS Code - planned item for upcoming workbench-hot-exit Preservation of unsaved changes across restarts
Milestone

Comments

@dgileadi
Copy link
Contributor

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.

@bpasero bpasero self-assigned this Nov 19, 2015
@bpasero bpasero added the feature-request Request for new features or functionality label Nov 19, 2015
@katopz
Copy link

katopz commented Nov 27, 2015

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.

@egamma egamma modified the milestone: Backlog Dec 10, 2015
@waderyan
Copy link

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

@bpasero bpasero added the file-explorer Explorer widget issues label Dec 18, 2015
@elad
Copy link

elad commented Jan 20, 2016

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

@marcusschiesser
Copy link

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

@PeterMtj
Copy link

PeterMtj commented Mar 23, 2016

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/

@MarkGoldberg
Copy link

     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.

@bpasero bpasero self-assigned this Apr 7, 2016
@jithurjacob
Copy link

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
Copy link

elad commented Apr 8, 2016

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

@padpanik
Copy link

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

@ashwinimohan
Copy link

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
Copy link

suyah commented May 6, 2016

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!!!

@katopz
Copy link

katopz commented May 10, 2016

ref #906

@bpasero
Copy link
Member

bpasero commented May 10, 2016

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
Copy link

elad commented May 10, 2016

@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. :)

@Meligy
Copy link

Meligy commented May 16, 2016

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.

@victorhooi
Copy link

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 =).

@SriramKeerthi
Copy link

SriramKeerthi commented Jun 1, 2016

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.

@warpdesign
Copy link
Contributor

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

@pr0g
Copy link

pr0g commented Jun 19, 2016

+1 - I would absolutely love this feature!

@seanwcom
Copy link

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
.

@Tyriar
Copy link
Member

Tyriar commented Nov 15, 2016

@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.

@devployment
Copy link

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

@bpj101
Copy link

bpj101 commented Nov 16, 2016

"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".

@Tyriar
Copy link
Member

Tyriar commented Nov 16, 2016

@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.

@bpj101
Copy link

bpj101 commented Nov 16, 2016

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
.

@Tyriar
Copy link
Member

Tyriar commented Nov 16, 2016

Thanks @bpj101, the images don't seem to make it through when commenting via email though ☹️

@bpj101
Copy link

bpj101 commented Nov 17, 2016

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
.

@lovebdsobuj
Copy link

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.

@Tyriar
Copy link
Member

Tyriar commented Dec 3, 2016

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.

@Tyriar Tyriar closed this as completed Dec 3, 2016
@Tyriar Tyriar mentioned this issue Dec 5, 2016
3 tasks
@g5codyswartz
Copy link

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.

@Tyriar
Copy link
Member

Tyriar commented Dec 14, 2016

@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.

@joshsleeper
Copy link

joshsleeper commented Dec 14, 2016

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!

@egamma egamma mentioned this issue Dec 20, 2016
56 tasks
@seanwcom
Copy link

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!

@bpasero
Copy link
Member

bpasero commented Dec 21, 2016

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

@Noitidart
Copy link

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.

@joshsleeper
Copy link

@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.

@Noitidart
Copy link

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

@joshsleeper
Copy link

joshsleeper commented Nov 1, 2017

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?

@Noitidart
Copy link

@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!!

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality plan-item VS Code - planned item for upcoming workbench-hot-exit Preservation of unsaved changes across restarts
Projects
None yet
Development

Successfully merging a pull request may close this issue.