Set up your editor
Este conteúdo não está disponível em sua língua ainda.
Biome comes with a language server, so editor extensions give you the same diagnostics, formatting, and assist actions as the CLI while you type or save your code.
The Biome team maintains the extensions for VS Code, Zed, and IntelliJ. Helix connects to Biome’s language server directly, and extensions for other editors are maintained by the community.
VS Code
Section titled “VS Code”VS Code is a code editor built by Microsoft. Its engine also powers other editors such as VSCodium and Cursor.
Install the Biome extension from the Visual Studio Marketplace, or install it from your editor:
- Open the Extensions view (View or Ctrl/⌘+⇧+X).
- Search for Biome.
- Select Install.
VSCodium, Cursor, and other derivatives install the extension from the Open VSX registry instead.
Format files with Biome
Section titled “Format files with Biome”To make Biome the default formatter, open a supported file and:
- Open the Command Palette (View or Ctrl/⌘+⇧+P).
- Select Format Document With…
- Select Configure Default Formatter.
- Select Biome.
Then run Format Document to format a whole file, or Format Selection to format the selected code.
Format on save
Section titled “Format on save”To format files when you save them, set VS Code’s editor.formatOnSave setting to true:
{ "editor.formatOnSave": true}Fix and sort imports on save
Section titled “Fix and sort imports on save”To apply fixes and sort imports when you save a file, add Biome’s code actions to VS Code’s editor.codeActionsOnSave setting:
{ "editor.codeActionsOnSave": { "source.fixAll.biome": "explicit", "source.organizeImports.biome": "explicit" }}source.fixAll.biome applies safe fixes, and source.organizeImports.biome sorts imports. You can enable either one on its own.
To apply unsafe fixes on save, make the code fix of the rule safe. To apply a fix manually, select the diagnostic and click Quick Fix.
For every setting of the extension, see the VS Code extension reference.
Zed is a code editor built for speed and collaboration.
To install the Biome extension:
- Open the Command Palette (View or Ctrl/⌘+⇧+P).
- Select zed: extensions.
- Search for Biome.
- Select Install.
Format files with Biome
Section titled “Format files with Biome”To format files with Biome, set it as the formatter for each language it supports:
{ "languages": { "Astro": { "formatter": { "language_server": { "name": "biome" } } }, "CSS": { "formatter": { "language_server": { "name": "biome" } } }, "GraphQL": { "formatter": { "language_server": { "name": "biome" } } }, "HTML": { "formatter": { "language_server": { "name": "biome" } } }, "JSON": { "formatter": { "language_server": { "name": "biome" } } }, "JSONC": { "formatter": { "language_server": { "name": "biome" } } }, "JSX": { "formatter": { "language_server": { "name": "biome" } } }, "JavaScript": { "formatter": { "language_server": { "name": "biome" } } }, "Svelte": { "formatter": { "language_server": { "name": "biome" } } }, "TSX": { "formatter": { "language_server": { "name": "biome" } } }, "TypeScript": { "formatter": { "language_server": { "name": "biome" } } }, "Vue.js": { "formatter": { "language_server": { "name": "biome" } } }, }}Then run editor: format from the Command Palette to format a file.
Format on save
Section titled “Format on save”Zed formats on save only for some languages by default, such as Astro and GraphQL. To format every file when you save it, set Zed’s format_on_save setting to "on":
{ "format_on_save": "on"}Fix and sort imports on save
Section titled “Fix and sort imports on save”To apply fixes and sort imports when you save a file, add Biome’s code actions to code_actions_on_format. Zed runs them every time it formats a file, so they only run on save when format_on_save is on:
{ "languages": { "JavaScript": { "formatter": { "language_server": { "name": "biome" } }, "code_actions_on_format": { "source.fixAll.biome": true, "source.organizeImports.biome": true } }, "TypeScript": { "formatter": { "language_server": { "name": "biome" } }, "code_actions_on_format": { "source.fixAll.biome": true, "source.organizeImports.biome": true } }, "TSX": { "formatter": { "language_server": { "name": "biome" } }, "code_actions_on_format": { "source.fixAll.biome": true, "source.organizeImports.biome": true } } }}source.fixAll.biome applies safe fixes, and source.organizeImports.biome sorts imports. You can enable either one on its own.
To apply unsafe fixes on save, make the code fix of the rule safe.
For every setting of the extension, see the Zed extension reference.
IntelliJ
Section titled “IntelliJ”IntelliJ IDEA is an IDE built by JetBrains. It shares its platform with other JetBrains IDEs such as WebStorm, and the Biome plugin works in all of them.
Install the Biome plugin from the JetBrains Marketplace, or install it from your IDE:
- Go to Settings.
- Select Plugins from the menu on the left.
- Select the Marketplace tab.
- Search for Biome and select Install.
- Restart the IDE to activate the plugin.
To install the plugin from disk instead:
- Download the plugin
.zipfrom the Versions tab of the plugin page. - Open the IDE settings, then select Plugins.
- Select the settings button, then Install Plugin from Disk…
The plugin’s options are on the Biome page of the IDE settings. To find it, search for Biome in the settings.
Format files with Biome
Section titled “Format files with Biome”On the Biome settings page, select Enable LSP-based code formatting. The Reformat Code action (Ctrl+Alt+L, or ⌥+⇧+⌘+L on macOS) then formats files with Biome.
Format on save
Section titled “Format on save”On the Biome settings page, select Run format on save.
Fix and sort imports on save
Section titled “Fix and sort imports on save”On the Biome settings page, select Run safe fixes on save to apply safe fixes, and Sort import on save to sort imports. You can enable either one on its own.
You can also turn these options on from Tools > Actions on Save, where they appear as Run Biome format, Run Biome apply safe fixes, and Run Biome sort import.
To apply unsafe fixes on save, make the code fix of the rule safe. To apply a fix manually, place the cursor on the diagnostic and press Alt+Enter (⌥+⏎ on macOS).
Helix does not need an extension. It connects to Biome through the biome lsp-proxy command, which acts as a language server over standard input and output.
Format files with Biome
Section titled “Format files with Biome”In your languages.toml file, define Biome as a language server, then add it to each language you want it to handle. Disable formatting in the other language servers of that language, so that only Biome formats it:
[language-server.biome]command = "biome"args = ["lsp-proxy"]
[[language]]name = "javascript"language-servers = [ { name = "typescript-language-server", except-features = [ "format" ] }, "biome" ]
[[language]]name = "typescript"language-servers = [ { name = "typescript-language-server", except-features = [ "format" ] }, "biome" ]Then run :format to format a file.
To use Biome with another language, such as JSON or CSS, add a [[language]] block for it. See the languages supported by Biome and the language identifiers defined by the Language Server Protocol.
Format on save
Section titled “Format on save”To format files when you save them, set auto-format to true for each language:
[[language]]name = "typescript"language-servers = [ { name = "typescript-language-server", except-features = [ "format" ] }, "biome" ]auto-format = trueFix and sort imports on save
Section titled “Fix and sort imports on save”Helix has no setting to run code actions on save. To apply a fix or sort imports, press Space a to open the code actions and select the Biome action.
Apply project settings
Section titled “Apply project settings”To make Helix apply project-specific settings, add Biome’s configuration files to the roots field. Helix then detects the project root from the presence of those files:
[[language]]name = "typescript"roots = ["biome.json", "biome.jsonc", "package.json"]language-servers = [ { name = "typescript-language-server", except-features = [ "format" ] }, "biome" ]You can also pass an inline configuration to Biome under [language-server.biome.config.biome.inlineConfig].
Other editors
Section titled “Other editors”These extensions are maintained by the community:
- Vim: ALE supports Biome. Follow its installation instructions.
- Neovim: install nvim-lspconfig and follow the Biome instructions. ALE also supports Biome, and coc-biome is available for coc.nvim.
- Sublime Text: follow the LSP-biome installation instructions.
- Emacs: install lsp-mode, then follow the lsp-biome installation instructions.
- Nova: install the Biome extension and follow its instructions.
© 2023-present Biome developers and contributors.