I don't see a keyboard shortcut for "Open Folder..." listed on the documentation page below, and after searching elsewhere for a while I didn't see anything else.
https://code.visualstudio.com/docs/customization/keybindings
I thought I would ask here before putting an issue on GitHub about it. (Also there doesn't seem to be a open / closed issue about this anywhere on the GitHub repo.)
https://github.com/Microsoft/vscode/issues
There is indeed a shortcut for it, the command is workbench.action.files.openFolder, and the default keybinding is Ctrl+K,Ctrl+O.
It's easy to find in the list of shortcuts (File → Preferences → Keyboard Shortcuts) if you search for "folder" or "openFolder" in the Default Keybindings.
Hit Cmd+O on macOS or Ctrl+O on Windows/Linux to activate the open dialog, select a folder, and click "Open."
Note: This answer was written before multiple folder workspaces were implemented in VS Code. If you open folders this way, it will replace your entire workspace with the folder you selected to open. If you want to add a folder to your existing workspace, you must use Cmd+K, Cmd+O on a macOS or Ctrl+K, Ctrl+O on Windows/Linux.
If I launch Visual Studio Code directly it remembers all the files I had open previously. The issue I have is if I (under Win10) right click a file and select "Open With Code". If VS Code is already open everything is file. If VS Code is not open, it will launch and open the file, but forget all the files I had previously opened.
This seems like unexpected (and non-consistent) behavior. Is there a way to get VS Code to launch from "Open With Code" but have it also open all the files I had opened previously? Basically, act the same as if VS Code was already opened when I clicked on "Open With Code".
Add the following line to your setting.json (Code Menu > Preferences > Setting)
"window.restoreWindows": preserve
This issue seems to cover exactly your case and has been resolved here
After I use VSCode to open a folder and some editors for the files, I close the folder. When I close and reopen the folder, VSCode opens the editors I opened last time.
How to prevent VSCode from reopening the editors I opened last time?
I have already set "window.restoreWindows": "none". When I exit directly from VSCode, it won't restore windows. I am saying when I reopen a folder, the editors I opened last time before I close the folder, will still be opened.
To stop Visual Studio Code from opening your previous folder all the time, then you have to edit settings.json.
To achieve this, open the settings.json. Do this by following the steps below.
Open the Command Palette by pressing F1.
Type, "Open settings".
When you see the options, select Open Settings (JSON).
After that, add the following option.
{
"window.restoreWindows": "none"
}
This should prevent Visual Studio Code from opening the previous folder when launching the application.
I just open vscode from my terminal, it's way faster and efficient in my opinion.
Just browse to your wished folder and write "code ." in your terminal.
Follow this process
Open VS Code, goto file>preferences>settings.
search for restore Window or click on Window tab then find restore window .select none from selection.
https://i.stack.imgur.com/FLx4a.png
https://i.stack.imgur.com/TAuHT.png
https://i.stack.imgur.com/B8W5a.png
I did it many times, and each time I forgot where it was.
Menu File → Preferences → Settings.
I get this:
I want to open file settings.json (editable JSON file) instead. How can I do that?
To open the User settings:
Open the command palette (either with F1 or Ctrl+Shift+P)
Type "open settings"
You are presented with a few options¹, choose Open User Settings (JSON)
This image was taken in the VS Code online editor
Which, from the manual and depending on platform, is one of:
Windows %APPDATA%\Code\User\settings.json²
macOS $HOME/Library/Application\ Support/Code/User/settings.json
Linux $HOME/.config/Code/User/settings.json
The Workspace settings will be in a {workspaceName}.code-workspace file where you saved it, and the Folder settings will be in a .vscode folder if and when it has been created.
Official page on User and Workspace Settings
As stated by sevencardz below, VS Code includes a button in the Settings UI gutter which can be used to switch between JSON and graphical view.
The workbench.settings.editor option selects which of the settings files is opened by default when not using the above method, such as with the shortcut ⌘+, or through the application menu.
Footnotes
The aforementioned settings, User and Workspace. Remote settings will appear when using WSL.
By a test this maps to %APPDATA%\Roaming\Code\User\settings.json, I am not sure by what logic.
On the settings UI page, there's a special button in the top right corner gutter that toggles between the settings.json file and the settings UI.
Bonus Answer:
Add "workbench.settings.editor": "json" to your settings.json file. This will make it so that menu File → Preferences → Settings or ⌘ + , opens your settings.json file by default. Optionally, add a comment at the top to remind yourself where the toggle button is.
// Click the Open Settings (UI) button in the top
// right corner gutter to toggle the settings UI
{
// Other settings in settings.json
// ...
"workbench.settings.editor": "json"
}
Follow these steps:
Shift + CMD + P
Type "settings"
Click on "Preferences: Open Settings (JSON)"
Visual Studio Code Tips and Tricks
If you want to edit local workspace/folder settings instead of global user settings, you can edit the file .vscode/settings.json (shortcut: Ctrl/Cmd + P and type "settings.json").
If that settings.json file or the folder .vscode do not exist, you can create them in the folder directory.
These settings will apply to the specific project.
These changes are global, so it will affect all of your projects.
You can change the settings.json file from user preferences.
Menu File → Preferences → Settings → Extensions → search for "Edit in settings.json"
Eventually edit these files directly:
Linux: $HOME/.config/Code/User/settings.json
macOS: $HOME/Library/Application Support/Code/User/settings.json
Windows: %APPDATA%\Code\User\settings.json
On Windows, the default keybind to open the settings UI within VSCode is Ctrl + ,. From there, there is a button at the top right to "Open Settings (JSON)":
That is one way to get to it. For convenience, I have bound Ctrl + Shift + , to opening the settings JSON. For reference, the setting ID for that is workbench.action.openSettingsJson.
Open VS Code.
Go to settings by clicking the keyboard shortcut ctrl + , or with GUI
File -> Preferences -> Settings
Refer this image
Click on the Open Settings (JSON) icon.
Refer to the image
Once you click on the icon it should open settings.json file
If still, that did not work.
Go to the search bar and type json:scheme
There click on Edit in settings.json. This should work.
But still, if it hit you in the head with a brick please let me know.
In Just 2 steps
1- Hit the shortcut Ctrl+Shift+P
(If you use a MAC it's ⌘+Shift+P):
2- Type in the search bar user settings json, and finally press Enter:
And you're done! Here you can change the general configs of VS Code in the settings.json.
However note that that there are also other types of settings.json which are relative to a project or a workspace for instance.
On a Mac the settings file is found at ~/Library/Application\ Support/Code/User/settings.json - it can be opened from the command line:
open -a 'visual studio code.app' ~/Library/Application\ Support/Code/User/settings.json
On Windows:
Click (Fn) + F1 (or Ctrl + P + >)
Type open settings json
Select Preferences: open settings (JSON)
Say I have a project/folder open in VS Code and I want to open the folder in Windows Explorer, is there keyboard shortcut or a VS Code Extension for that? Sometimes I also need to go to the project folder in command prompt.
In Visual Studio 2017, there's a menu option to open the folder and an extension for quickly getting to the project folder in command prompt -- see below:
How do I handle these in VS Code?
Right click on a file or folder from the left side explorer of VSCode, then select "Reveal in Explorer". Now you can see the folder in windows explorer.