Biome VS Code ExtensionSection titled 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
InstallationSection titled Installation
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.
Getting StartedSection titled Getting Started
Default FormatterSection titled Default Formatter
- 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
Configuration ResolutionSection titled Configuration Resolution
The extension automatically loads the
biome.json file from the workspace’s root directory.
Biome ResolutionSection titled Biome Resolution
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.
UsageSection titled Usage
Format documentSection titled Format document
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 saveSection titled 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 saveSection titled Fix on save
Biome respects VS Code’s Code Actions On Save setting. To enable fix on save, add
Imports Sorting [Experimental]Section titled 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:
Extension SettingsSection titled Extension Settings
Section titled biome.lspBin
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.
Section titled biome.rename
Enables Biome to handle renames in the workspace (experimental).
Section titled biome.requireConfiguration
Disables formatting, linting, and syntax errors for projects without a
Enabled by default.
VersioningSection titled Versioning
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.
TroubleshootingSection titled Troubleshooting
@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: