Configuring remote workspaces

VS Code allows you to open a remote folder on any virtual machine, container, or environment with a running SSH server, allowing developers to interact with files and folders on the remote filesystem. Remote workspaces are helpful when using a separate environment to edit, build, or run Fuchsia.

This diagram shows the difference between your local VS Code and
     SSH environment. VS Code uses an SSH tunnel to communicate with your
     external environment where you can work on Fuchsia.

Configuring remote workspaces involve the following steps:

  1. Prerequisites
  2. Connect to remote workspace
  3. Disconnect remote workspace

Prerequisites

Before you start, complete the following tasks:

Install SSH extension

To connect to a remote host for the first time, install Microsoft’s Remote SSH Extension in VS Code:

  1. In VS Code, launch Quick Open by running CMD/CTRL + P.
  2. Paste the following command in the text prompt and press enter:

    ext install ms-vscode-remote.remote-ssh
    

Connect to remote workspace

After installing the SSH extension, connect to your SSH environment:

  1. Press F1 or CMD/CTRL + SHIFT + P to open Command Palette.
  2. Type in the field, Remote-SSH: Connect to Host… and press enter. This figure shows the command palette field in VS Code. The field
    contains the text Remote-SSH.
  3. Type in the domain name of your SSH environment and press enter:

    username@hostname.com
    
  4. If VS Code cannot detect the type of server, select the type manually. This figure shows a dropdown menu in VS Code to select the type of
    server. The options include Windows, Linux, and macOS.

  5. After connecting, the bottom left status bar displays your current SSH session.

Disconnect remote workspace

To close the connection with the remote host, you can either:

  • Exit VS Code.
  • In VS Code's navigation, click File then Close Remote Connection.

Troubleshooting

For additional support, VS Code provides official documentation for troubleshooting scenarios.