For example, Visual Studio Code talks about applying settings at the user level vs the workspace level.
On the one hand,
The page referenced above says
"Workspace: These settings are stored inside your workspace in a .vscode folder and only apply when the workspace is opened."
A workspace is how Visual Studio represents any collection of files in Open Folder, and it's represented by the IWorkspace type. By itself, the workspace doesn't understand the contents or features related to files within the folder.
A workspace provides access to a active set of source code projects and documents and their associated syntax trees, compilations and semantic models. A workspace has a current solution that is an immutable snapshot of the projects and documents.
A project that consists of one or more root folders, along with all of the Visual Studio Code configurations that belong to that project. These configurations include:
Visual Studio Code does not use the term consistently across the UI (I've opened a GitHub issue to address this). Sometimes it refers to a workspace as described above, and other times it refers to a workspace as a project that is specifically associated with a .code-workspace
file.
A good example being the recent files widget. Notice in the linked screenshot that all projects are grouped under the same "workspaces" heading, which would indicate that everything there is a workspace. But then projects with a .code-workspace
file are given a "Workspace" suffix, contradicting the heading and indicating that only those files are actually workspaces.
.code-workspace
file?It is a JSON file with comments that stores all of the configuration data mentioned above, in addition to the location of all root folders belonging to a workspace.
.code-workspace
file?Only if you're creating a multi-root workspace, in which case you'll have a single .code-workspace
file that automatically restores all of the workspace settings, in addition to all of the root folders that you want to be displayed in the Explorer.
Everything is automated.
When you open a folder in Visual Studio Code and start making modifications to the editor that are specifically related to the project you're currently working on, Visual Studio Code automatically creates a .vscode
folder and stores it in the root of the project folder that you're working on. This .vscode
folder has files that store the changes you made.
For example, if you change Visual Studio Code settings that you want to apply only to your current project, Visual Studio Code creates a settings.json
file with those updates, and that file is stored in the .vscode
folder.
You can create a .code-workspace
file that includes just a single root folder if you really want to. You'd then be able to either open the project folder directly, or open the workspace file. But I can't think of any reason why this would be beneficial.
.code-workspace
file?Go to menu File → Save Workspace As...
Go to menu File → Add Folder to Workspace....
.code-workspace
file?Go to menu File → Open Workspace....
Alternatively, double click the .code-workspace
file. Visual Studio Code won't open the actual file. Instead, it will read that file and open the folders that belong to that workspace.
.code-workspace
file?Go to menu File → Open... and select the target .code-workspace
file.
Alternatively, open the workspace associated with that file. Then open the command palette, search for, and select the Workspaces: Open Workspace Configuration File command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With