-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Add an option to confirm before quitting #14710
Comments
I've also wanted this - I really like the Chrome option that requires you to hold cmd+q, or double tap, to actually quit. I cmd+w and cmd+tab a lot, rarely cmd+q on purpose. |
And you can't just remap it, as it's handled by electron |
As a workaround you could at least map |
Wanted to point out that if you accidentally command Q with an unsaved file open, the file state is preserved on re-opening VSCode, but all undo history is lost, so not having this feature can destroy user data. |
I found this extension that adds a "confirm before quit" functionality that solved this for me. |
Thanks @obahareth, this just got me again today. |
Despite the existence of |
Is there an extension for the rock music though? |
Ask and ye shall receive. Now I just need an extension that deposits money directly into my account... |
It would be great if we have an option that requires us to hold Cmd + Q to quit, like the way Chrome does |
I just had VSCode exit on me while debugging because I hit Cmd-Q instead of Cmd-Tab. Really annoying. Going to check out this extension! |
I regularly have multiple instances open with different servers/processes running and it's annoying it's so easy to close the app. Have just installed installed the extension; seems to be the solution 👍 |
This option is really a must! Every other good IDE (and other programs) has a "warn on quit" function already integrated - so VSCode shouldn't step out of line of "good IDE behaviour", IMO. |
The Quit Control for VSCode extension mentioned here is useful but it only addresses accidental keystrokes and not all (you can still close your workspace by inadvertently hitting e.g. Alt+F4 instead of Ctrl+F4). Perhaps the extension API does not even allow that :-? I think a builtin "Prompt before exit" feature still makes sense if it's granular enough to tell workspace windows apart. That would allow to still be able to close quickly random files but get a prompt on folders |
Another case. Thanks team. |
Yea that happened to me as well. |
Please add! |
Chrome's way of handling this is genius as it is. I am supporting the one who suggested it for VSCode! |
Please add something like this, I keep hitting |
+1 |
Please add. |
@firelizzard18 Yep, that's the next big thing I would love to change in the extension: not depending on overwriting keybindings As I see it, the extension's contribution points would be better as two "command interceptors" and not as a bunch of "keybindings" that point to new "commands" depending on the platform, so users don't need to change any of the keybindings they already have for "Quit" and "Close Window". Quit control would just intercept
Quit Control handles |
Here's another workaround: binding quit action to // keybindings.json
{ "key": "cmd+q q", "command": "workbench.action.quit" },
{ "key": "cmd+q cmd+q", "command": "workbench.action.quit" }, And with these settings as suggested above, you should be almost guaranteed to not accidentally close vscode. // settings.json
"files.hotExit": "off",
"terminal.integrated.showExitAlert": true,
"terminal.integrated.confirmOnExit": "always",
That said I'm still a proponent for this feature being implemented if possible. |
use 'Quit Control for VSCode' Extension to prevent accidental close Name: Quit Control for VSCode |
I'd love to have a global option to just confirm quitting vscode. Like IntelliJ has. No need for extensions, woakarounds, and many confusing options, just a global toggle option for a modal: "Exit VSCode? Yes/Cancel/Disable this message". As simple as that, regardless if using ctrl+w, alt+f4 or clicking "x" button. I came here because just today i missed the mouse click because of higher screen resolution and windows overlay, and boom! VSCode was accidentally closed. This doesn't happen with IntelliJ because i keep confirmation option activated. Just a little dissapointed since this issue is from 6 years ago, but... |
@andre-mr Welcome to the "I wish vscode had an option to confirm before quitting" family! |
+1 |
Please add this. I mean, how difficult can it be? |
Probably not that difficult... it's open source software, so why don't you find out and submit a PR so we can all gain from it (rather than not-one-single-person gaining anything from your comment)? |
i believe it may be that hard. because it's a 6 years old discussion, and the only pull request i found was closed 2 years ago. maybe it's out of vscode side, i think of electron or something. i honestly don't know how it works and don't have time to help for now, but it seems i am not the only one. and i would be grateful if someone finds a solution to include in official release. :) |
Well, easier said than done. Having none to little experience with this project and Electron I believe it would take me quite a lot of time to get this done in comparison to someone who is an expert. I know my comment was not constructive, however my only intention was to push this topic in terms of prioritisation. |
Same thoughts. Simple google search seems to indicate such. There's even sample codes and demo GIFs on stackoverflow. The exit event is also documented in electron docs.
|
I think here's a possible workaround - launch terminal automatically, and enable confirm on exit when there's terminal session, provided that you don't mind having terminal open on launch. I use terminal everytime so this is just perfect for me. If you don't use terminal, just close the terminal window (x button, not the trash button), the terminal will stay active in background as it just hides it. Install this extension to autorun terminal: Then, enable Confirm On Exit under Features>Terminal in vscode settings. |
Came to upvote this and see that I have already done it years ago. :-( |
Took a second attempt at this, given we meanwhile had added support for At first I was thinking about adding 2 settings - one for closing a window and one for quitting the application - but not sure that is necessary. The setting covers both window close and quit with a dialog to confirm the operation. Setting to Thoughts? |
Looks good! In addition, I would add these scenarios on
|
Yeah that is covered.
We do not have the infrastructure for long press. What is possible is to add another command to quit/close without confirmation but going through the hassle of configuring another keybinding for that you could as well just change the existing keybinding to a chord (as outlined here in many comments)? |
I would make 'always' the default in a fresh installation since the prompt allows one to set a default by "not asking again". |
This is now available in insiders for testing when setting |
Tried it out on the insiders version. It works. Thanks very much! |
Many times on a Mac it is necessary to use
cmd+`` to navigate between projects. This can lead to a mishit on
cmd+q` very easily. It would be great to have a confirm quit feature. Something like this sublimetext extension https://github.com/xavi-/sublime-maybs-quitThanks!
The text was updated successfully, but these errors were encountered: