I have finally figured out the use case for multi-root workspaces in VSCode. My repository is structured as a mono-repo, but I always had issues with VSCode not automatically detecting which virtual environments I’m using for a Python project. Because of that, I always had to open a new instance of VSCode to get auto-completion and linting to work. There are other ways of solving this as well, but that was my approach up until now.

With multi-root workspaces, this detection happens automatically and I can finally work from a single VSCode instance.

One downside is that the folder structure I have used is to put all code into a code folder within the Product folder. This works well for consistency but does lead to some confusion when all those code folders are added to the same workspace. Now there’s just a long list of code folders, with no easy way to distinguish them. As a result, I’ll have to do some renaming.

Search Exclusion

Folders can be ignored to prevent files from external libraries from showing up when searching in the workspace using the search.exclude setting:

{
	"settings": {
		"search.exclude": {
			"**/__pycache__": true,
			"**/.venv": true,
			"**/.vscode-test": true,
			"**/node_modules": true
		}
	}
}