-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
VS Code doesn't prompt on close if a file has been changed #21228
Comments
Then if I open the file again, VS code opens two windows. One with the change I made, and one without. |
The first thing you describe is expected behavior. It can be controlled with the The second, are you saying that VS Code opens two windows with the same file, and only one instance has the change? |
Why would it not ask for a file I changed? That seems busted to me. I think I may switch my default editor back to notepad++ then. Yes. Opening the same file has the change in one window and the "old" version in another. |
You can easily disable this with It should only open one instance, with your change, though. |
Well my vote would be "files.hotExit" to default to "off". Sorry I mispoke. I'm using Notepad2, not notepad++. Notepad2 for me doesn't behave this way and I can't find how to make it behave that way. In fact every other editor I've ever used doesn't behave this way. I can't imagine anybody would find the "hotExit" option nor think to look for it. |
The conservative hot exit option is enabled by default, you can disable it completely or enable it under more circumstances in settings. You can read more about why this decision was made here #101, basically this was the direction because this is similar to how Notepad++, Sublime Text and Atom behave and because it's easier to switch off if you're someone who is not a fan than realize it's supported and switch it on. You would have also received a prompt when you first exited vscode with unsaved files saying that hot exit is now the default and how you can go about disabling it. On multiple windows opening, this is likely because one window is being restored and the other is the window that you requested to open, for example if you opened a file/folder via explorer. |
So you're saying that not only is hotexit the default because people will complain about if it they don't like it, but also the other behavior is by design too. I did this
VS Code then opened two instances of that file because I happened to not have saved it. I looked at the discussion for the hotexit https://github.com/Microsoft/vscode/issues/101 and found I agree with some of the points, but I'd still want it to prompt on exit. Visual Studio handles this by remembering the files/tabs opened, and any unsaved files will prompted next time you open to be recovered. But it always asks when you close VS. I don't like the idea of making edits and then I have to open VSCode again in order to get those edits back. In my situation I didn't even realize I hadn't saved the files. I think what you should do is have an auto backup but still prompt on exit. Does this mean on reboot VS Code will not cause the machine to stop restart? |
I did not say that. For the small portion of users who don't like they can change the setting and this is a very small portion based on telemetry and tracking our feedback channels. There's an easy fix to your preferred way of working and that's to disable the setting. We committed to the behavior change and provided a prompt to users the first time hot exit occurs that explains what it is and how to configure it. If you like Visual Studio's behavior then set Backups are always happening regardless of whether hot exit is enabled in order to provide crash protection. |
I have a better suggestion. Always keep track of the undo stack (even on close) but always be saving my files so I never have to hit save again. Although that would essentially mean an infinite history. Perhaps an undo from close to close. I like the way onenote just saves, I stop thinking about having to hit CTRL+S in one note. I wish onenote had the full history of a note though. At least hotExit should keep the undo stack since the last save. |
Adding undo stack support is captured in #15135 You might also be interested in enabling auto save, that way you don't have to worry about saving your files at all: |
Steps to Reproduce:
The text was updated successfully, but these errors were encountered: