Giter Site home page Giter Site logo

chansuke / biome-vscode Goto Github PK

View Code? Open in Web Editor NEW

This project forked from biomejs/biome-vscode

0.0 1.0 0.0 679 KB

Biome extension for Visual Studio Code

Home Page: https://marketplace.visualstudio.com/items?itemName=biomejs.biome

License: Apache License 2.0

TypeScript 100.00%

biome-vscode's Introduction

Visual Studio Code extension for Biome

The Visual Studio Code extension for Biome brings first-party support for Biome to VS Code and similar editors such as VSCodium. By integrating with Biome's language server, the extension provides the following features, among others:

  • 💾 Format on save
  • 💡 Inline suggestions with quick fixes
  • 🚧 Refactoring

Installation

The Visual Studio Code extension for Biome is available from the following sources.

Getting Started

This section describes how to get started with the Biome VS Code extension.

Setting as the default formatter

To set the VS Code extension for Biome as the default formatter, follow the steps below.

  1. Open the Command Palette: ⌘/Ctrl++P
  2. Select Format Document With…
  3. Select Configure Default Formatter…
  4. Select Biome

This will ensure that VS Code uses Biome to format all supported files, instead of other formatters that you may have installed.

Setting as the default formatter for specific languages

If you'd rather not set Biome as the default formatter for all languages, you can set it as the default formatter for specific languages only. The following steps describe how to do this.

  1. Open the Command Palette
  2. Select Preferences: Open User Settings (JSON)

Set the editor.defaultFormatter to biomejs.biome for the desired language. For example, to set Biome as the default formatter for JavaScript files, add the following to your editor's options.

"[javascript]": {
	"editor.defaultFormatter": "biomejs.biome"
}

Choosing a biome binary

To resolve the location of the biome binary, the extension will look into the following places, in order:

  1. The project's local dependencies (node_modules)
  2. The path specified in the biome.lspBin configuration option of the extension
  3. The extension's globalStorage location

If none of these locations has a biome binary, the extension will prompt you to download a binary compatible with your operating system and architecture and store it in the globalStorage.

Note

We recommend adding Biome to your project's devDependencies so that both the extension and your NPM scripts use the same version of Biome.

npm install -D @biomejs/biome

Usage

Formatting documents

On-demand formatting

To format a document on-demand, follow the steps below.

  1. Open the Command Palette: ⌘/Ctrl++P
  2. Select Format Document

You can also format a selection of text by following the steps below.

  1. Select the text you want to format
  2. Open the Command Palette: ⌘/Ctrl++P
  3. Select Format Selection

Formatting on save

This supports formatting on save out of the box. You should enable format on save in your editor's settings and make sure that the Biome extension is set as the default formatter for your documents/languages.

Autofix on save

This extension supports VS Code's Code Actions On Save setting. To enable autofix on save, add the following to your editor configuration.

{
  "editor.codeActionsOnSave": {
	"quickfix.biome": "explicit"
  }
}

Sorting imports (experimental)

Biome has an experimental Organize Imports feature that allows you to sort imports automatically. This feature can be run manually or automatically on save.

On-demand sorting

To sort imports on-demand, follow the steps below.

  1. Open the Command Palette: ⌘/Ctrl++P
  2. Select Organize Imports

Sorting on save

To automatically sort imports on save, add the following to your editor configuration.

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

Extension Settings

biome.lspBin

The 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.

biome.rename

Enables Biome to handle renames in the workspace (experimental).

biome-vscode's People

Contributors

95th avatar arendjr avatar bhbs avatar chieforz avatar conaclos avatar cpojer avatar ddanielsantos avatar denbezrukov avatar dependabot[bot] avatar edvardchen avatar ematipico avatar iwanabethatguy avatar jk-gan avatar kaioduarte avatar ktfth avatar leops avatar lucasweng avatar magic-akari avatar malix-off avatar michareiser avatar mrkldshv avatar mzbac avatar nhedger avatar nikeee avatar nissy-dev avatar noftaly avatar notmd avatar unvalley avatar xunilrj avatar yassere avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.