Biome VS Code Extension
Biome unifies your development stack by combining the functionality of separate tools. It uses a single configuration file, has fantastic performance, and works with any stack. This extension brings Biome to your editor so that you can:
- Format files on save or when issuing the Format Document command
- See lints while you type and apply code fixes
- Perform refactors
You can install the code extension by heading to the extension’s Visual Studio Code Market Place page or from within VS Code by either:
- Open the extensions tab (View → Extensions) and search for Biome.
- Open the Quick Open Overlay (Ctrl/⌘+P or Go -> Go to File), enter
ext install biomejs.biome, and hit enter.
- Open the Command Palette (Ctrl/⌘+⇧+P or View → Command Palette)
- Select Format Document With…
- Select Configure Default Formatter…
- Select Biome
You can also enable Biome for specific languages only:
- Open the
settings.json: open the Command Palette(Ctrl/⌘+⇧+P) and select Preferences: Open User Settings (JSON)
- And set the
biomejs.biomefor the desired language
The extension automatically loads the
biome.json file from the workspace’s root directory.
The extension tries to use Biome from your project’s local dependencies (
node_modules/@biomejs/biome). We recommend adding Biome as a project dependency to ensure that NPM scripts and the extension use the same Biome version.
You can also explicitly specify the
Biome binary the extension should use by configuring the
biome.lspBin setting in your editor options.
If the project has no dependency on Biome and no explicit path is configured, the extension uses the Biome version included in its bundle.
To format an entire document, open the Command Palette (Ctrl/⌘+⇧+P) and select Format Document.
To format a text range, select the text you want to format, open the Command Palette (Ctrl/⌘+⇧+P), and select Format Selection.
Format on save
Biome respects VS Code’s Format on Save setting. To enable format on save, open the settings (File -> Preferences -> Settings), search for
editor.formatOnSave, and enable the option.
Fix on save
Biome respects VS Code’s Code Actions On Save setting. To enable fix on save, add
Imports Sorting [Experimental]
The Biome VS Code extension supports imports sorting through the “Organize Imports” code action. By default this action can be run using the ⇧+Alt+O keyboard shortcut, or is accessible through the Command Palette (Ctrl/⌘+⇧+P) by selecting Organize Imports.
You can add the following to your editor configuration if you want the action to run automatically on save instead of calling it manually:
biome.lspBin option overrides the Biome binary used by the extension.
The workspace folder is used as the base path if the path is relative.
Enables Biome to handle renames in the workspace (experimental).
Disables formatting, linting, and syntax errors for projects without a
Enabled by default.
We follow the specs suggested by the official documentation:
Odd minor versions are dedicated to pre-releases, e.g.
Even minor versions are dedicated to official releases, e.g.
@biomejs/biome, but the extension shows a warning saying that it could not resolve library.
@biomejs/biome specifies some optional dependencies that are installed based on your OS and architecture.
It’s possible though, that the extension can’t resolve the binary when loading the extension. This is caused - probably - by your package manager.
To resolve the issue, try to install the binary manually. The warning should show you the binary that belongs to your machine.
If you work in a team that use different OSs/architectures, it’s advised to install all the binaries: