How to use workspace in VS Code
If you wondering what is workspace and how to use it in a simple explanation, this article is for you.
The following topics I will explain are
- what is workspace
- type of workspace
- how to use it
- when to use it
- my opinion
What is workspace
Workspace is like a folder in VS Code. In the folder, you can have a single project or more projects in the folder.
In the workspace, you can set configurations and extensions to a specific workspace.
Type of workspace
There are two types of a workspace are:
- Single-folder workspaces
- Multi-root workspaces
The type of workspace is equal to a single folder of your project. when you open a folder in VS Code, it is equal to you open a single-folder workspace.
How to use single-folder workspaces
Suppose I have some python projects like the picture below.
Then I open a python-project-1 folder in VS Code. The VS Code will determine this folder is a single-folder workspace.
You can enable or disable extensions for a project like this.
And you can configure settings in the workspace section for a project like this.
All your workspace configuration and extension changes will be set for only this project.
The purpose of this workspace type is designed for those who want to open many projects in one VS Code window.
for example, if you add many projects to use the same workspace. It can configure settings and extensions. But, when you open a project in a single folder. the configuration in the multi-root workspace doesn’t inherit to it.
For more information about multi-root workspace please see in official page.
We can take the benefit of a single-folder workspace to configure the project and extension to fit your project. Multi-root workspace is a suite for Mono-repo architecture. In my most case, I prefer to use single-folder workspace for development. Thank you for reading and enjoy your code.