Installing the Fuchsia extension for VS Code

The Fuchsia extension for VS Code provides support for debugging Fuchsia devices, logging, and syntax highlighting. This extension is Fuchsia’s official extension and can be used with the source tree and the SDK.

Prerequisites

Before you begin:

For more information on configuring Vs Code, see VS Code.

Installation

The extension automatically detects the appropriate settings for each workspace that you use, including the location of relevant tools such as ffx. If these settings are incorrect or not set automatically, follow the section below.

SDK

  1. Open your desired workspace. For example, open the getting-started repository in your VS Code workspace.
  2. The extension should automatically detect the path to ffx. If the path is not detected, follow these steps:
    1. In VS Code navigate to the main menu, click Code, then Preferences, then Settings.
    2. Under Extensions navigate to Fuchsia SDK then Ffx Path.
    3. Enter the path to ffx directory (for example, ~/fuchsia/getting-started/tools/ffx).
    4. Verify the extension is working via the button in the bottom right corner. Click said button, which lists a Fuchsia target device and ensure that your device is connected.

If there is no Fuchsia device that is running, including the emulator, you will see the following in the Output tab:

Running: ffxPath target,list,--format,json
exit: 2: null

Source Tree

  1. Open your desired workspace. For example, open the sample repository in your VS Code workspace.
  2. The extension should automatically detect the path to ffx. If not detected follow the following steps:
    1. In VS Code navigate to the main menu, click Code, then Preferences, then Settings.
    2. Under Extensions navigate to Fuchsia SDK then Ffx Path.
    3. Enter the path to ffx directory (for example, ~/fuchsia/tools/ffx).
    4. Verify the extension is working via the button in the bottom right corner. Click said button, which lists a Fuchsia target device and ensure that your device is connected.

If there is no Fuchsia device that is running, including the emulator, you will see the following in the Output tab:

Running: ffxPath target,list,--format,json
exit: 2: null

You have successfully configured the Fuchsia extension! To see more information on how to use the Fuchsia extension, see Using the Fuchsia extension for VS Code.