Fast switching between projects in Visual Studio Code
If you are using VSCode, you probably know that projects are called “workspaces”. In general, a workspace is either a folder or a collection of folders represented by a file that binds them together. Because of that, the standard way to open or switch projects is through “Open folder” or “Open workspace from file” commands, accessible from the main menu or the command palette. However, this approach opens a standard folder/file picker that might not be that fast to navigate.
Today I want to talk about Project Manager, an extension that streamlines this process, and makes switching between projects a joy. While Project Manager has more features, I want to focus here just on the simplest thing: switching between existing projects with the least amount of work and configuration.
If you are like me, your projects are probably also Git repositories. In this case, the Project Manager needs only one configuration: the path to your projects parent folder. It will automatically infer the list of projects from all the Git repositories inside.
After the extension is installed, open Settings (Ctrl + ,
) and search for “Project Manager > Git: Base Folders” to add the root folder there:
Once added, you will find all projects in the Activity Bar, under “Project Manager”:
You can see that I already marked some of the projects as “favorites”, which is a nice touch to declutter the list in case the number of projects is large and chaotic.
It is now possible to just click on the project name or on the “new window” icon next to the name to switch to the project or open it in a new window. But the most useful addition is the new “Project Manager: List projects to open“ command in the command palette. It will list the projects and offer a convenient way to switch projects from anywhere in VSCode.
It can also be opened directly with a shortcut (Shift + Alt + P
)!
And that’s all for today.
— Petr