Workspaces - nRF Connect for VS Code
Skip to content

Workspaces

When using the extension, you will come across both two different types of workspaces (VS Code workspaces and west workspaces) and two different types of applications (workspace and freestanding applications).

The following table describes main differences between the workspace types.

VS Code workspace West workspace
Environment VS Code nRF Connect SDK through west
Mutual dependency Cannot be a west workspace. Is always also a VS Code workspace.
Can be a multi-root workspace? Yes (see steps) No
Version control Cannot control other workspaces. Can use west to version-control the files in one or more VS Code workspaces if they share the same root.
Usage of west manifest Does not require a west manifest. Requires a west manifest for configuration. The file is created when you set up a west workspace.
Supported application type Freestanding application Workspace application
Settings location .vscode/settings.json .west directory

VS Code workspace

A VS Code workspace is the collection of one or more folders that are opened together in VS Code with associated settings. These folders are listed in Visual Studio Code's Explorer (Ctrl-Shift-E), with the first folder at the top being the root folder.

The extension parses the VS Code workspace folders and checks for the presence of any application. If any of the folders happens to include one, the application is automatically added to the list in the Applications View.

You can quickly check where the workspace settings are stored and their current values using the Preferences: Open Workspace Settings (JSON) command from the Command Palette.

For more information about VS Code workspaces, read the official VS Code workspaces documentation page.

VS Code workspace setup

The VS Code workspace is automatically set when you open a folder in VS Code using File > Open Folder.... When you do this, a single-folder workspace is created and the workspace settings are stored in the .vscode/settings.json file.

A single-folder workspace opened inside VS Code

How to create a multi-root VS Code workspace

If a project's code is distributed across several folders, as in the case of an application and library code, you might need a multi-root workspace.

To create a multi-root workspace:

  1. Add new folders using File > Add Folder to Workspace.

    Add Folder to Workspace

  2. Save the multi-root workspace to a .code-workspace file using File > Save Workspace As....

Until saved, the multi-root workspace settings are stored in a temporary file.

West workspace

West workspace is a collection of folders that are jointly version-controlled using the west management tool. A west workspace is indicated by a .west folder that contains the west workspace configuration.

Typically, when working with workspace applications, your west workspace will also be a VS Code workspace.

West workspaces allow you to set up a dedicated SDK around your freestanding application; an SDK controlled by a west manifest file. This ensures that your application always builds against the same version of the SDK. West workspaces with their applications are structured differently from normal freestanding applications: they introduce a project folder above the application repository, where the SDK and any other dependencies are instantiated.

West workspace opened inside VS Code

For more information about west workspaces, read Zephyr's west basics documentation page.

West workspace setup

The west workspace is usually set up when you create a west workspace using the related action from the Manage SDKs menu in the Welcome View. This action creates the west manifest file.

Alternatively, a west workspace can be created when you use the nRF Connect: West Init command to initialize the west module, for example when you download and open an application that comes with a west manifest file.

If the extension is unable to identify a west workspace as a valid installation of the nRF Connect SDK or Zephyr, the extension presents the active SDK as an unidentified SDK.

Note

When you work with a west workspace, the Manage SDKs action is replaced by Manage west workspace. You manage the SDK version manually from the west manifest file and you need to update the west workspace to update the SDK version.

The guidelines for configuring the west manifest file are not in scope of this documentation. Refer to the Manifest Files section of Zephyr's documentation about west.

Workspace type dependency

The type of workspace has an impact on the extension and application settings. For more information, see the Extension settings overview page.