The following VS Code extensions may provide a productive development environment
for Fuchsia:

## Official Fuchsia-specific extensions

Fuchsia-specific extensions provide support for working with Fuchsia software
and systems. These extensions are currently supported by the Fuchsia project.

### Fuchsia extension for VS Code

The [Fuchsia extension for VS Code](https://marketplace.visualstudio.com/items?itemName=fuchsia-authors.vscode-fuchsia) 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. For more information see the
[Fuchsia developer extension page](https://fuchsia.dev/docs/reference/tools/editors/vscode/fuchsia-ext-install).

![This figure shows the image of the fuchsia developer extension in the Visual Studio Code marketplace](https://fuchsia.dev/static/fuchsia-src/reference/tools/editors/vscode/images/extensions/extension-page.png)

## Community contributed extensions

These extensions are developed by Fuchsia contributors. Extensions listed are unsupported
and could conflict with the official Fuchsia developer extension. It is recommended to use
the [Fuchsia developer extension.](https://marketplace.visualstudio.com/items?itemName=fuchsia-authors.vscode-fuchsia)

### Fuchsia.git Helper

[Fuchsia.git Helper](https://marketplace.visualstudio.com/items?itemName=jwing.fuchsia-git-helper)
adds an "Open in...", which allows you to open a file in OSS Code Search.

To use this extension:

1. Right click a file in the file editor.
2. Select **Open in OSS Code Search**.

![This figure shows the VS Code menu to open a file in OSS code search.](https://fuchsia.dev/static/fuchsia-src/reference/tools/editors/vscode/images/extensions/fuchsia-git-helper.png)

### Build system extensions

#### GN

[GN](https://marketplace.visualstudio.com/items?itemName=npclaudiu.vscode-gn)
adds syntax highlighting for GN files.

![This figure shows syntax highlighting for GN files in VS Code.](https://fuchsia.dev/static/fuchsia-src/reference/tools/editors/vscode/images/extensions/gn.png)

#### GNFormat

[GNFormat](https://marketplace.visualstudio.com/items?itemName=persidskiy.vscode-gnformat)
provides GN file formatting.

You may need to configure GNFormat with the file path to your GN binary and buildtools.
Do the following:

1. In VS Code, launch **Quick Open** by running `CMD/CTRL + P`.
2. Type `settings` in the search field.
3. Click **Preferences: Open Settings (JSON)**.
4. Add the following configuration and restart VS Code:

    "gnformat.path.gn": "FILE_PATH",
    "gnformat.path.buildtools": "BUILD_TOOLS_PATH"

### General workflow extensions

General workflow extensions provide an overall productive workflow when working with Fuchsia.

#### GitLens

[GitLens](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens)
provides highly customizable insights of git history, which allows you to see code evolution.

![This figure shows an overlay of git commit history in VS Code.](https://fuchsia.dev/static/fuchsia-src/reference/tools/editors/vscode/images/extensions/gitlens.png)

### Language specific extensions

#### FIDL language support

[FIDL Language Support](https://marketplace.visualstudio.com/items?itemName=fuchsia-authors.language-fidl)
provides syntax support and LSP-based language features in [FIDL](https://fuchsia.dev/docs/development/languages/fidl/README).

> [!NOTE]
> **Note:** You need to configure Fuchsia environment variables to run this extension. For more information, see [Set up environment variables](https://fuchsia.dev/docs/get-started/get_fuchsia_source#set-up-environment-variables).

![This figure shows syntax highlighting for FIDL files in VS Code.](https://fuchsia.dev/static/fuchsia-src/reference/tools/editors/vscode/images/extensions/fidl-pack.png)

#### JSON5

In some cases, you may work on Fuchsia components using a
[structured configuration](https://fuchsia.dev/docs/development/components/configuration/structured_config) written in JSON5.
[JSON5](https://marketplace.visualstudio.com/items?itemName=mrmlnc.vscode-json5)
adds syntax highlighting for JSON5 files.

![This figure shows syntax highlighting for JSON5 files in VS Code.](https://fuchsia.dev/static/fuchsia-src/reference/tools/editors/vscode/images/extensions/json5.png)

#### Rust-analyzer

[Rust-analyzer](https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer)
is a [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) (LSP)
implementation for the Rust language.

> [!NOTE]
> **Note:** If your Fuchsia source is symlinked from another mountpoint, the `rust-analyzer` extension may not locate the files for analysis. Instead, open the actual file path to the Fuchsia source in VS Code.

To use `rust-analyzer` with VS Code, Fuchsia recommends:

- [Updating to the latest stable VS Code](https://vscode-docs.readthedocs.io/en/stable/supporting/howtoupdate/).
- [Disabling telemetry reporting](https://code.visualstudio.com/docs/getstarted/telemetry#_disable-telemetry-reporting) for confidential code.

##### Configure workflow

Using the [`fuchsia.code-workspace` configuration file](https://fuchsia.dev/docs/reference/tools/editors#fuchsia.code-workspace)
will set recommended defaults for using rust-analyzer on Fuchsia.

Beyond those defaults, here are some optional settings you may want to add to your `settings.json`:


      // optional: only show summary docs for functions (keeps tooltips small)
      "rust-analyzer.signatureInfo.detail": "parameters",
      // optional: don't activate parameterHints automatically
      "editor.parameterHints.enabled": false,

## Fuchsia SDK extensions

### Bazel

The [Fuchsia SDK](https://fuchsia.googlesource.com/sdk-samples/getting-started) uses the Bazel build system. The
[Bazel extension](https://marketplace.visualstudio.com/items?itemName=BazelBuild.vscode-bazel) can build and run components
directly from VS Code.

![This figure shows a successful Bazel build in VS Code.](https://fuchsia.dev/static/fuchsia-src/reference/tools/editors/vscode/images/extensions/bazel-ext.png)
[](https://issues.fuchsia.dev/issues/new?component=1439230&template=1881640&description=Issue+on:+https://fuchsia.dev/docs/reference/tools/editors/vscode/extensions.md "Report a bug or suggest improvements on this page") [](https://cs.opensource.google/fuchsia/fuchsia/+/main:docs/reference/tools/editors/vscode/extensions.md "View the source code of this page") [](https://ci.android.com/edit?repo=fuchsia/fuchsia/main&file=docs/reference/tools/editors/vscode/extensions.md&cloneRepo=fuchsia/fuchsia:refs/heads/main&fullPath=fuchsia/docs/reference/tools/editors/vscode/extensions.md "Edit the source code of this page")