Reputation: 1040
Using the latest, released version of VSCode, at the time of this writing (2018-Jan-29; version 1.19.3), I see the following behavior (which is unnecessarily time-consuming, for my needs):
Whenever I attempt to close a window that has files open from multiple, disparate directories, I get the following prompt:
"Do you want to save your workspace configuration as a file?"
A set of buttons is also presented, offering me options.
This prompt does not come up if I try to close a window with a single file being open, or a single directory.
Here is an example of how to launch VSCode from an OS command prompt, to reproduce this prompt:
code path/to/DirectoryA path/to/DirectoryB
I rarely want, or need, to save a new workspace. I would rather this prompt never appear. I am ok creating workspaces through other means, if and when necessary.
Is there a way to disable this prompt via one or more setting(s) in VSCode?
Upvotes: 25
Views: 8621
Reputation: 792
I solved this issue by adding following in keybindings.json -
{
"key": "cmd+w",
"when": "!editorIsOpen && !multipleEditorGroups",
"command": "workbench.action.quit"
}
Normally, cmd+w will close the editor window (with checks for unsaved as well), and when no editor window is open, it quits the app.
Upvotes: 3
Reputation: 121
@HaiFengKao's comment mentions workbench.action.quit
that quits vscode without any prompts.
Shortcut for it is Ctrl + Q
but it quits all windows :(
Upvotes: 0
Reputation: 5298
I have updated my extension to quit vscode when all editors are closed
https://marketplace.visualstudio.com/items?itemName=Hai.AlwaysOpenWorkspace
The trick is to call vscode.commands.executeCommand('workbench.action.quit');
when all editors are closed.
workbench.action.quit
will quit vscode without any prompts
Upvotes: 1
Reputation: 117
I was having similar issue Untitled.code-workspace file being created as I just close my laptop and never properly close Vs code. I would delete them manually but somehow Git was still tracking these files whenever I push my code to the branch.
In any case we want to stop these files from being generated for that purpose follow the steps below:
Go to code -> preferences -> settings -> under commonly used -> Files:Exclude -> Add Pattern -> **/.code-workspace
that would disable the prompt and no such files would be created again.
#disable-vscode-prompt #untitled.code-workspace #disable #autosave #vscode-workspace-disable #workspace #vscode-workspace
Upvotes: 3