Microsoft Dev Blogs

Multi Root Workspaces in Visual Studio Code

thumbnail

Table of Contents

  1. Introduction
  2. Setting Up Multi-Root Workspaces
  3. Working with Independent Projects
  4. Managing Virtual Environments
  5. Further Resources

Introduction

Multi-Root Workspaces (MRW) in Visual Studio Code provide a powerful way to work on multiple independent projects within a single repository. This can be particularly useful for managing mono-repos with multiple projects, such as in Python development using tools like Poetry.

Setting Up Multi-Root Workspaces

To set up MRW in Visual Studio Code, create a .code-workspace file in the root of your repository. This file will define your MRW and list the folders of the independent projects within the repository. Open this file in Visual Studio Code to work with the MRW.

Working with Independent Projects

Each folder listed in the .code-workspace file represents an independent project within the MRW. You can open and work on these projects simultaneously in Visual Studio Code, with each project maintaining its own settings and dependencies.

Managing Virtual Environments

Utilize Python virtual environments and Poetry's shell features to manage dependencies within each independent project. By configuring a poetry.toml file with the in-project configuration key set to true, you can ensure that virtual environments are created within the desired project.

Further Resources

For more information on Multi-Root Workspaces in Visual Studio Code and best practices for managing mono-repos with independent projects, refer to the Workspaces in Visual Studio Code documentation.