Skip to content

VS Code extension

Biome comes with an official VS Code extension that tightly integrates with your code editor, providing formatting, linting, and code refactoring features to your development workflow.

This reference document provides an overview of the extension’s features, how to install it, and how to configure it for your projects.

The recommended way to install the extension is through the Visual Studio Code Marketplace for VS Code users, or the Open VSX registry for VSCodium and other derivatives such as Cursor.

A single-root workspace is your typical VS Code workspace, where there is only one workspace folder.

  • Directorysrc/
    • main.ts
  • biome.json
  • package.json

A multi-root workspace is a workspace where there are multiple workspace folders. In this case, the extension will automatically create a Biome instance per workspace folder.

  • Directoryapi/ (workspace folder)
    • biome.json
    • Directorysrc/
      • main.ts
  • Directoryapp/ (workspace folder)
    • biome.json
    • Directorysrc/
      • main.ts
  • my.code-workspace

The Biome extension registers itself as a formatter for supported file types, and supports formatting a whole file, or a selection of code.

Run either one of the following commands from the command palette:

  • To format a whole file, run the Format Document command.
  • To format a selection of code, select the code and run the Format Selection command.

To enable formatting on save, set VS Code’s editor.formatOnSave setting to true.

The Biome extension registers itself as a code action provider for supported file types, and provides code fixes for diagnostics that have safe fixes.

To manually apply a quick fix, select the diagnostic and click the Quick Fix button.

To enable Fix on Save, update VS Code’s editor.codeActionsOnSave setting to include the following:

{
"editor.codeActionsOnSave": {
"source.fixAll.biome": "explicit"
}
}

The extension is able to sort imports on save for supported file types. To enable this feature, set VS Code’s editor.codeActionsOnSave setting to include the following:

settings.json
{
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit"
}
}

The following settings are available for the extension.

Default: true | Scopes: global, workspace, workspace folder

This setting controls whether the extension will create LSP session for a workspace folder. When set globally, it applies to all workspace folders, unless they themselves override the setting.

Default: null | Scopes: global, workspace, workspace folder

This setting allows you to specifiy the path to a custom configuration file. If left unspecified, the default configuration file will be used.

Default: false | Scopes: global, workspace, workspace folder

This setting controls whether Biome will register itself as a formatter and diagnostics provider.

When set to true, the extension will only register itself as a formatter and diagnostics provider if a biome.json file is present in the workspace folder.

Default: undefined | Scopes: global, workspace, workspace folder

This setting allows you to override the path to the biome binary. This is useful if you want to use a different version of Biome, or if you want to use a binary that’s not on your PATH. In can be either a path to a binary, or an object that maps a platform to a path.

{
"biome.lsp.bin": "/path/to/biome"
}

Default: true (windows), false (others) | Scopes: global, workspace, workspace folder

Whether to copy the Biome binary and run it from a temporary location.

On Windows, disabling this setting will prevent you from updating Biome in your node modules while an active LSP session is running, because the OS locks the binary while it’s running. You’ll need to close VS Code before updating Biome.

Default: true | Scopes: global, workspace, workspace folder

When a global installation of Biome is required but not found in the PATH, the extension will suggest installing it.

This setting controls whether that suggestion popup is shown.

Default: off | Scopes: global

This setting allows to set the logging level of the Biome LSP trace. The possible values are off, messages, verbose. You may want to set this setting to verbose when you encounter issues with the extension, and you’d like to share the logs with us.

There may be times when you encounter unexpected issues with the extension. Here a a couple tip to help you troubleshoot the most common issues, and reset the extension’s state.

If you encounter issues with the extension, we may ask you to share the LSP trace with us. You can do so by setting the biome.lsp.trace.server setting to verbose, and re-running the action that caused the issue. The trace will be made available the output panel, under the Biome LSP trace (xxx) select option.

If you are migrating from the 2.x extension, we recommend the following steps, in this exact order:

  1. Update the extension
  2. Close the editor completely.
  3. Open your task manager, and make sure to kill all processes named biome.
  4. Open your editor.

This will destroy possible old Daemon connections that are still connected to the editor, but can’t be shutdown gracefully by the extension, which caused some incorrect formatting when a file was saved.

  • The biome.lspBin setting has been deprecated in favor of biome.lsp.bin. It will still work for now, but we recommend updating your settings to use the new name.
  • The biome.requireConfigFile has been renamed to biome.requireConfiguration. You should migrate the setting now as the old is no longer supported.