Visual Studio Code Integration#


Screenshot of the modal to add VS Code to a project environment. Shows VS Code on the right.

Visual Studio Code Integration Overview#

AI Workbench integrates with VS Code. The primary feature is attaching VS Code to the project container, allowing you to develop in the correct execution environment.

It works for both local and remote projects.

Note

The best way to understand the Visual Studio Code (VS Code) integration is through the exercises in the Onboarding Project.

Adding Visual Studio Code to a Project#

To add VS Code to a project, follow these steps:

  • Open AI Workbench and select a project

  • Navigate to Environment > Project Container > Applications

  • Click Add

  • Select Visual Studio Code

Visual Studio Code Integration Constraints and Limitations#

AI Workbench has the following constraints and limitations in regards to VS Code integration:

Extensions - VS Code extensions installed within a project container do not automatically persist - You can manually persist them in the .vscode/extensions.json file in the project repository

Global Container Runtime - The VS Code integration relies on the globally configured container runtime in VS Code (see Docker vs. Podman) - You may need to manually configure this in VS Code settings

Windows - Execution settings need to be changed between WSL and a remote location - You may need to manually configure this in VS Code settings

Note

If you are using VS Code, then it’s recommended you use the same container runtime (either Docker or Podman) for AI Workbench in each of your locations.

VS Code Configuration and Setup Details#

This section provides details on how to configure VS Code for integration with AI Workbench.

Before you begin, ensure that VS Code is already installed on the target machine.

How it works#

  • AI Workbench installs VS Code Server inside the project container

  • AI Workbench updates the spec.yaml file to allow and include VS Code

Note

Adding VS Code integration to an AI Workbench project, is a per-project setting. Each time you want to use VS Code with a different AI Workbench project, you need to explicitly add it.

Docker vs. Podman#

By default, VS Code is configured to work with Docker. To use Podman instead, you need to manually update VS Code settings.

To configure VS Code to use Podman instead of Docker, follow these steps:

  • In VS Code, click on the Gear icon, and select Settings

  • In the search bar, search for dev.containers.dockerPath

  • For the Dev > Containers: Docker Path setting, change its value to podman

Windows Configuration#

You are required to configure VS Code to execute within Windows Subsystem for Linux (WSL) and specify the NVIDIA-Workbench WSL distribution. For more information about installing WSL2, see How to install Linux on Windows with WSL.

Screenshot of the VS Code settings for WSL configuration.

To configure VS Code for WSL:

  1. In VS Code, click on the Gear icon, and select Settings

  2. In the search bar, search for for dev.containers.executeInWSL

    Two settings should appear, Dev > Containers: Execute In WSL and Dev > Containers: Execute In WSLDistro. and check the box to enable it.

  3. Click the check box to enable Execute In WSL”

  4. Then set Dev > Containers: Execute In WSLDistro to NVIDIA-Workbench

Important

You must change this execution setting in VS Code every time you switch between local and remote environments.

For example, if you need to open VS Code on a Linux VM, you must uncheck dev.containers.executeInWSL in VS Code settings.

FAQs#

How do I get to the VS Code settings?#

File > Preferences > Settings opens the settings tab. You can use the search bar to find the settings you need.

Can I use other IDEs besides VS Code and JupyterLab?#

Yes. A Workbench project is a git repository of files, so you can use any IDE that you want.

  • However, for IDEs besides VS Code and JupyterLab, you must manually configure remote SSH connections and attaching to the project container

  • We will be expanding direct integration support. You can check status in the table of IDEs

Can I use the CLI to add and configure VS Code?#

Yes. The CLI has the same functionality as the Desktop App.