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

Auto-save unsaved files #906

Closed
weeblr opened this issue Dec 2, 2015 · 22 comments
Closed

Auto-save unsaved files #906

weeblr opened this issue Dec 2, 2015 · 22 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality file-explorer Explorer widget issues
Milestone

Comments

@weeblr
Copy link

weeblr commented Dec 2, 2015

A very handy feature in Notepad++: one can just open a new editing tab, or multiple ones, cut and paste stuff, or scribble a few notes.
Upon closing the application or shutting down the computer, instead of the usual "Do you want to save/not save/cancel" (as vsCode does), all those unsaved and unnamed files are simply saved to a temp location by the app, and restored in the same state upon next start.

Rgds

@alexdima alexdima assigned alexdima and bpasero and unassigned alexdima Dec 2, 2015
@alexdima alexdima added the feature-request Request for new features or functionality label Dec 2, 2015
@bpasero bpasero added this to the Backlog milestone Dec 2, 2015
@bpasero bpasero removed their assignment Dec 2, 2015
@egamma egamma modified the milestone: Backlog Dec 10, 2015
@bpasero bpasero added workbench file-explorer Explorer widget issues and removed workbench labels Dec 18, 2015
@bluecaret
Copy link

I would like to second this request. If this is to compete at all with Sublime and others, this needs to be added. Makes it so much more useful and I feel "safer" using it if I don't have to worry about loosing files.

@pascon
Copy link

pascon commented Mar 15, 2016

In the docs there is information about files.autoSave: "onFocusChange":

onFocusChange to save files when focus moves out of the editor of the dirty file.

Is this option working?

@bpasero
Copy link
Member

bpasero commented Mar 15, 2016

Yes

@pascon
Copy link

pascon commented Mar 15, 2016

@bpasero that strange, maybe I'm misunderstanding this option but when I try following steps:

  1. Open new file
  2. Write some text
  3. Try closing vscode

file is not saved as dirty and vscode asks me for saving the file.

My settings.json file looks like below:
{ "files.autoSave": "onFocusChange" }

Isn't this flag enables auto-saving as in Notepad++ described in first post in this issue?

@bpasero
Copy link
Member

bpasero commented Mar 15, 2016

@pascon works for me, please attach a video of what you try and see.

@alexdima
Copy link
Member

@bpasero I think this is about untitled files

@bpasero
Copy link
Member

bpasero commented Mar 15, 2016

Ok, for untitled files we need to ask the user which filename to pick.

@weeblr
Copy link
Author

weeblr commented Mar 15, 2016

HI

@bpasero

Ok, for untitled files we need to ask the user which filename to pick.

No, that's the point. Don't ask anything. Make up a temp file name, store and reopen when vscode is started next time.

See my OP:

instead of the usual "Do you want to save/not save/cancel" (as vsCode does), all those unsaved and unnamed files are simply saved to a temp location by the app, and restored in the same state upon next start.

Cheers

@bpasero
Copy link
Member

bpasero commented Mar 15, 2016

@weeblr why do you assume this feature works if the feature request is still open?

@weeblr
Copy link
Author

weeblr commented Mar 15, 2016

@bpasero Sorry, I'm confused. From your previous comment, I understood you wanted to implement that feature by prompting the user for a name, in case the file didn't have one already. So I replied that that's not how it should be implemented, per my request.
Isn't it what you suggested?

Rgds

@bpasero
Copy link
Member

bpasero commented Mar 15, 2016

@weeblr sorry I confused you with @pascon

@weeblr
Copy link
Author

weeblr commented Mar 15, 2016

@bpasero ok, no problem, understand now.

@pascon
Copy link

pascon commented Mar 16, 2016

@bpasero this is exactly as @weeblr wrote. In vscode UserVoice there are many requests for auto-saving untitled files as it's available in another editors (Notepad++, SublimeText, Atom, etc...) - without asking for a filename, for example:

Is this feature in consideration to implement in next releases?

@bpasero bpasero self-assigned this Mar 30, 2016
@victorhooi
Copy link

Yup, this would be super awesome for me as well! =).

I often use my text-editors as a scratch-pad.

Sublime Text has had this for a while, and Atom had it via third-party extensions (e.g. save-session. However, Atom recently rolled it into the core - perhaps some of their discussion might be helpful to our implementation?

Relevant PR - atom/atom#9968

@LisannaDettwyler
Copy link

LisannaDettwyler commented May 10, 2016

Incredibly disappointed that this wasn't included in the initial release. Mac users are used to essentially all of their applications working this way. I just lost a lot of work because I incorrectly assumed that Microsoft was making this app Mac-friendly. This is not beta software, this is production software. Users are going to lose data because this is a standard feature for Mac document / code editors, Sublime included. There are very few excuses for a modern text editor to lose unsaved user data in the event of an unexpected application termination.

@weeblr-dev
Copy link

@bpasero I just read issue #101 linked above by @katopz, and I think I understand why you would not favor this change. This maybe a misunderstanding.

I find it very confusing that you quit an editor and don't get prompted to save dirty files. You might expect all changes are written to disk when in fact they are not.

No, we don't expect changes changes to be written to files. We expect changes, ie the current editor content, to be saved. Nobody said it was to be saved in the actual file being edited. On top of possibly failing, as you hint at, this might not be what you want (ie you made a change, but this was no good and you actually don't want to keep it)

So the point is save the "state" of the editor, in a separate area probably (and please, save that data in a portable way, not in the user folder #329 !).

In the VS Code team we all run with auto save enabled (File | Auto Save) so we are past these issues it seems :)

You're probably actually behind what others do. Saving on the fly is common feature in many IDE and editors, but basically, it's still missing what this feature request is about. To auto-save, you need to have a file name. There are many situations where we don't want to have to choose a folder, and make up a name, and then have that useless file lying around.
Auto Save is fine. I don't use it personally, I rather select what needs to be saved and when, but I hate being prompted for file names, when I don't have to.

Rgds

@bpasero
Copy link
Member

bpasero commented May 10, 2016

@weeblr-dev I have removed my comments on #101 because they do not reflect our latest thinkings. Sorry for the confusion. It is a perfectly valid feature request.

I would still close this one as duplicate of #101 though if you are ok with it?

@weeblr-dev
Copy link

@bpasero Yes, sure. I thought about that when I realized #101 was created some times before this one.

@bpasero bpasero added the *duplicate Issue identified as a duplicate of another issue(s) label May 10, 2016
@bpasero
Copy link
Member

bpasero commented May 10, 2016

Ok good.

@bpasero bpasero closed this as completed May 10, 2016
@lovebdsobuj
Copy link

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

@erhhung
Copy link

erhhung commented Oct 4, 2016

I was shocked that VSCode did not support autosaving files when I just lost a lot of work after a crash and was expecting my files to be automatically recovered. I looked around and found that this feature is available, but is not enabled by default!

What bad UX for a user to discover this preference only after losing work! Just about every other code editor I use (Emacs included), have autosave enabled by default.

Now, the autosave feature in some editors writes to separate files, so the user still has the option of not recovering. VSCode can implement that behavior as another preference setting, but use it as the default behavior instead of completely "off".

@erhhung
Copy link

erhhung commented Oct 4, 2016

Having now explicitly set my files.autoSave preference to afterDelay, I realized that this in-place save really doesn't work in common web-development situations where you run a watcher that rebuilds code on-the-fly.

None of the options for that preference works in that scenario--only the tried-and-true explicit commit (save or save all) coupled with autosave to temp files will work, IMO.

BTW, my recommendation on the autosave behavior would not be a duplicate of #101 as it's more general and has nothing to do with quitting the editor.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality file-explorer Explorer widget issues
Projects
None yet
Development

No branches or pull requests