Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions src/content/docs/guides/editors/create-an-extension.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,82 @@ It's the editor's responsibility to locate the resolve the path of the binary an

The binary name is `biome` or `biome.exe`, and it can be found in the root directory of the library, e.g.: `@biomejs/cli-darwin-arm64/biome`, `@biomejs/cli-win32-x64/biome.exe`.

### Extension settings

The Biome Language Server exposes the following settings, which the extension can expose to users.

:::note
The following settings are meant for **extension developers**, not for users.
An extension might decide to expose the settings to users with different names, or different formats.

For example, the Zed extension maps the [`require_configuration`](#require-configuration) setting from the setting `require_config_file`, which is defined in a JSONC file.
:::

#### `require_configuration`

> Type: `boolean`
> Default: `false`

Whether the Biome Language Server requires a configuration file. When set to `true`, it won't analyze any file (except for parsing) until there's a `biome.json` file in the root of the project.

```json
{
"require_configuration": true
}
```

#### `configuration_path`

> Type: `string`
> Default: `null`

A path to a custom configuration file. The path can be the folder where the `biome.json`/`biome.jsonc` is, or a path to a file.

The path can be relative or absolute. The Biome Language Server reads this option only when provided. Use this option when the configuration is *in a subfolder of your project*.

```json
{
"configuration_path": "./frontend/biome.json"
}
```

#### `inline_config`

> Type: `object`
> Default: `null`

An inline version of the Biome configuration. The options of this configuration will override the options coming from any `biome.json` file read from disk (or the defaults).

For example, let's say your project enables the rule `noConsole` with `error` severity:

```json title="biome.json"
{
"linter": {
"rules": {
"suspicious": {
"noConsole": "error"
}
}
}
}
```

However, during local development, you want to disable this rule because it's useful and you don't want to see red squiggles. In your `inline_config`, you would write something like the following:

```json
{
"inline_config": {
"linter": {
"rules": {
"suspicious": {
"noConsole": "off"
}
}
}
}
}
```

### Use the daemon with the binary

Using the binary via CLI is very efficient, although you won't be able to provide [logs](#daemon-logs) to your users. The CLI allows you to bootstrap a daemon and then use the CLI commands through the daemon itself.
Expand Down
36 changes: 17 additions & 19 deletions src/content/docs/reference/zed.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ By default, the biome.json file is required to be in the **root of the workspace

Otherwise, it can be configured through the lsp settings:

```jsonc
// settings.json
```json5 title=".zed/settings.json"
{
"lsp": {
"biome": {
Expand All @@ -52,17 +51,21 @@ Otherwise, it can be configured through the lsp settings:

To use the language server as a formatter, specify biome as your formatter in the settings:

```jsonc
// settings.json
```json5 title=".zed/settings.json"
{
"languages": {
"JavaScript": { "formatter": { "language_server": { "name": "biome" } } },
"TypeScript": { "formatter": { "language_server": { "name": "biome" } } },
"TSX": { "formatter": { "language_server": { "name": "biome" } } },
"JSON": { "formatter": { "language_server": { "name": "biome" } } },
"JSONC": { "formatter": { "language_server": { "name": "biome" } } },
"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" } } },
}
}
```
Expand All @@ -71,8 +74,7 @@ See [Language Support](/internals/language-support) for more information.

### Enable biome only when biome.json is present

```jsonc
// settings.json
```json5 title=".zed/settings.json"
{
"lsp": {
"biome": {
Expand All @@ -86,8 +88,7 @@ See [Language Support](/internals/language-support) for more information.

### Run code actions on format:

```jsonc
// settings.json
```json5 title=".zed/settings.json"
{
"languages": {
"JavaScript": {
Expand All @@ -107,9 +108,7 @@ See [Language Support](/internals/language-support) for more information.
"TSX": {
"formatter": { "language_server": { "name": "biome" } },
"code_actions_on_format": {
"source.fixAll.biome": true,


"source.fixAll.biome": true,
"source.organizeImports.biome": true
}
}
Expand All @@ -119,16 +118,15 @@ See [Language Support](/internals/language-support) for more information.

If you want to apply [unsafe fixes](/linter/#unsafe-fixes) on save, you must make the [code fix of the rule safe](/linter/#configure-the-code-fix).

### Project based configuration
### Project-based configuration

You can include these settings in Zed Project Settings (`.zed/settings.json`) at the root of your project folder or as Zed User Settings (`~/.config/zed/settings.json`) which will apply to all projects by default.

#### Disable biome for a particular project

You can exclude biome for a given language (e.g. GraphQL) on project with:

```jsonc
// settings.json
```json5 title=".zed/settings.json"
{
"languages": {
"GraphQL": {
Expand Down