Skip to content

feat: document LSP methods#4197

Open
ematipico wants to merge 11 commits intonextfrom
feat/lsp-features
Open

feat: document LSP methods#4197
ematipico wants to merge 11 commits intonextfrom
feat/lsp-features

Conversation

@ematipico
Copy link
Copy Markdown
Member

@ematipico ematipico commented Apr 28, 2026

Summary

This PR refactors and enhances the section relative to the language server. Now that we are shipping more features targeted to editors e.g. biomejs/biome#9700, I thought it was time to add more information to what it can do.

Here's what the PR contains:

  • changed the section to "Biome Language Server" with an introduction, first-party extension and third-party extensions.
  • The introduction now contains the LSP requests that the server supports. It might get difficult to update this section; however, I think it's worth the effort since we don't change these methods often. We could revisit in case it gets out of sync often.
  • I added a new code-generated section in the reference section, called "Daemon requests", which contains all our workspace requests. They get updated at every release.
  • Added a description of the go-to definition with what we support for the time being.
  • Updated the VSCode and Zed sections with the new feature

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 28, 2026

Deploy Preview for biomejs failed. Why did it fail? →

Name Link
🔨 Latest commit 9c40029
🔍 Latest deploy log https://app.netlify.com/projects/biomejs/deploys/69fdcf13f189e50008566e24

@ematipico ematipico force-pushed the feat/lsp-features branch from 4e6139c to b16610c Compare May 8, 2026 08:40
@ematipico ematipico marked this pull request as ready for review May 8, 2026 08:50
@ematipico ematipico requested review from a team May 8, 2026 08:50
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 71878de8-5428-4c91-bb17-849a9bd03bd4

📥 Commits

Reviewing files that changed from the base of the PR and between 77049a5 and 9c40029.

📒 Files selected for processing (1)
  • codegen/src/lsp.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • codegen/src/lsp.rs

Walkthrough

This PR implements automatic generation of Biome daemon JSON-RPC API documentation. A new code generator reads biome_service method schemas, converts them to TypeScript interfaces, and injects the result into daemon.md. The changes update the codegen crate's dependencies to a newer biome commit, add the Lsp CLI subcommand, implement the core schema-to-markdown transformation logic, wire it into the codegen entrypoint and npm script, and expose the new documentation alongside reorganised editor integration guides that introduce go-to-definition settings for VS Code and Zed.

Possibly related PRs

Suggested reviewers

  • dyc3
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: document LSP methods' accurately reflects the main objective of the PR, which adds comprehensive LSP documentation including code-generated daemon requests.
Description check ✅ Passed The description is well-related to the changeset, detailing the reorganisation of the language server documentation, addition of LSP request documentation, and updates to editor-specific settings.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/lsp-features

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@codegen/src/lsp.rs`:
- Around line 18-20: The generated heading uses h3 ("### `biome/{}`") which
conflicts with the TOC strategy noted in the comment; update the string
construction in codegen/src/lsp.rs where output.push_str(&format!("###
`biome/{}`\n\n", method.name)); to emit an h4 heading instead (use four #
characters) so it matches the intended h4 level for the `biome/{}` section and
avoids polluting the table of contents; ensure you only change the literal
heading marker around method.name.
- Around line 69-73: The is_primitive_schema function currently only treats
"null", "boolean", and "string" as primitives; update its type check to also
include "number" and "integer" so numeric JSON Schema types are detected as
primitives. Locate the matches! call in is_primitive_schema (working on the
schema: &Value) and add "number" and "integer" to the Some(...) arm so numeric
params render as primitive (e.g., "Accepts `number`") instead of falling through
to interface rendering.
- Around line 47-53: The expect() messages used when finding START_MARKER and
END_MARKER are misleading (they mention introduction.mdx) — update the two
expect(...) error strings in the block that computes start_idx and end_idx (the
calls that use content.find(START_MARKER) and content.find(END_MARKER)) to
reference the correct target file/section for this function instead of
"introduction.mdx" so errors point to the actual file being edited; keep the
rest of the logic unchanged and preserve START_MARKER.len() usage for start_idx.

In `@src/content/docs/editors/introduction.mdx`:
- Line 164: The link in the sentence containing "Using the binary via CLI..."
still points to the old anchor `#daemon-logs`; update that anchor to match the
current heading by replacing `#daemon-logs` with `#language-server-logs` so the
in-page jump targets the "Language Server logs" section correctly.
- Around line 2-3: The frontmatter "description" in the Biome Language Server
doc (the description field in src/content/docs/editors/introduction.mdx) is
placeholder text; replace the placeholder value with a concise, accurate summary
of the page (a one- or two-sentence description) so search previews and docs
metadata display meaningful content, ensuring you update the frontmatter
description key while keeping the existing title intact.
- Around line 10-26: The three list items labeled
`woskpace/didChangeConfiguration`, `woskpace/didChangeWatchedFiles`, and
`woskpace/didChangeWorkspaceFolders` contain a typo — change `woskpace` to
`workspace`; also fix the `textDocument/definition` link so it matches the other
spec URLs by adding the missing `/specification/` path segment (use the same
pattern as the other links, e.g. the specification-style URL for
`textDocument/definition`).

In `@src/content/docs/reference/daemon.md`:
- Around line 10-19: The example for the "biome/open_project" JSON-RPC call uses
the wrong parameter name; replace the "openInitialized" field in the example
params with "openUninitialized" to match the schema/docs (or vice‑versa if you
prefer to standardize on "openInitialized") so both the example JSON and the
documented parameter (openUninitialized) are identical; update the method
example's "params" object to use the same parameter name as the documented
schema (openUninitialized) and ensure any other examples in the same section
(lines ~82-91) are updated the same way.
- Around line 6-8: Fix the intro typos and clarify the phrasing: change "my" to
"by", correct "paylod" to "payload", and reword the sentence "where `method` is
the one of the methods listed in this page." to "where `method` is one of the
methods listed on this page." Also ensure the JSON-RPC reference and example
`biome/open_project` remain intact and punctuate the sentences for clarity.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: de3747e2-bd55-4077-9ae5-3dfa0a352aef

📥 Commits

Reviewing files that changed from the base of the PR and between fae8e58 and 44495ae.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • Cargo.toml
  • astro.config.ts
  • codegen/src/lib.rs
  • codegen/src/lsp.rs
  • codegen/src/main.rs
  • package.json
  • src/content/docs/editors/first-party-extensions.mdx
  • src/content/docs/editors/introduction.mdx
  • src/content/docs/editors/third-party-extensions.mdx
  • src/content/docs/reference/daemon.md
  • src/content/docs/reference/vscode.mdx
  • src/content/docs/reference/zed.mdx

Comment thread codegen/src/lsp.rs Outdated
Comment thread codegen/src/lsp.rs Outdated
Comment thread codegen/src/lsp.rs
Comment thread src/content/docs/editors/introduction.mdx Outdated
Comment thread src/content/docs/editors/introduction.mdx Outdated
Comment thread src/content/docs/editors/introduction.mdx Outdated
Comment thread src/content/docs/reference/daemon.md Outdated
Comment thread src/content/docs/reference/daemon.md
@ematipico ematipico force-pushed the feat/lsp-features branch from 44495ae to 16ff5ed Compare May 8, 2026 10:41
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Comment thread codegen/src/lsp.rs Outdated
Comment thread codegen/src/lsp.rs Outdated
Comment thread codegen/src/lsp.rs Outdated
ematipico and others added 3 commits May 8, 2026 11:46
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@codegen/src/lsp.rs`:
- Around line 76-83: primitive_ts_name is missing branches for numeric schemas
so numeric types fall through to interface rendering; update primitive_ts_name
to handle schema.get("type") == "number" and "integer" (returning
Some("number")) so it matches is_primitive_schema's treatment and numeric return
types render as "number".
- Around line 68-74: The function is_primitive_schema in lsp.rs contains a stray
closing brace after its definition causing a syntax error; remove the extra `}`
following the closing of is_primitive_schema so the braces balance correctly
(i.e., ensure only the function's closing brace remains and delete the lone
extra brace that follows).

In `@src/content/docs/editors/introduction.mdx`:
- Line 124: Fix the typo in the sentence "You can integrate Biome in your editor
extension is different ways." by replacing the incorrect word "is" with "in" so
the line reads "You can integrate Biome in your editor extension in different
ways."; update the text in the editors/introduction.mdx content where that
sentence appears.
- Line 160: Fix the typo and pluralization in the sentence that reads "The
language server exposes [some options](/editors/introduction#extension-settings)
that editor extension can exposse to users" — change it to "The language server
exposes [some options](/editors/introduction#extension-settings) that editor
extensions can expose to users" by correcting "exposse" → "expose" and making
"extension" plural.
- Line 132: Fix the sentence fragment "If your editor is able to interact with a
server and send [JSON-RPC] request, you only need to configure the editor run
that command." by inserting the missing preposition "to" before "run" and
pluralizing "request" to "requests" for grammatical consistency; target the
sentence starting "If your editor is able to interact with a server and send
[JSON-RPC] request" in src/content/docs/editors/introduction.mdx and update it
to read "...and send [JSON-RPC] requests, you only need to configure the editor
to run that command."
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 150baec3-c93b-4936-80f3-efb470cae0e9

📥 Commits

Reviewing files that changed from the base of the PR and between 44495ae and 77049a5.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • Cargo.toml
  • astro.config.ts
  • codegen/src/lib.rs
  • codegen/src/lsp.rs
  • codegen/src/main.rs
  • package.json
  • src/content/docs/editors/first-party-extensions.mdx
  • src/content/docs/editors/introduction.mdx
  • src/content/docs/editors/third-party-extensions.mdx
  • src/content/docs/reference/daemon.md
  • src/content/docs/reference/vscode.mdx
  • src/content/docs/reference/zed.mdx
✅ Files skipped from review due to trivial changes (4)
  • src/content/docs/reference/zed.mdx
  • src/content/docs/reference/vscode.mdx
  • codegen/src/lib.rs
  • src/content/docs/reference/daemon.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • Cargo.toml
  • codegen/src/main.rs
  • astro.config.ts

Comment thread codegen/src/lsp.rs Outdated
Comment thread codegen/src/lsp.rs
Comment on lines +76 to +83
fn primitive_ts_name(schema: &Value) -> Option<&'static str> {
match schema.get("type").and_then(|v| v.as_str()) {
Some("null") => Some("void"),
Some("boolean") => Some("boolean"),
Some("string") => Some("string"),
_ => None,
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

primitive_ts_name doesn't handle number/integer.

is_primitive_schema now correctly treats number and integer as primitives (line 71), but primitive_ts_name doesn't return a value for them. This means numeric return types will fall through to interface rendering instead of showing "Returns number".

Suggested fix
 fn primitive_ts_name(schema: &Value) -> Option<&'static str> {
     match schema.get("type").and_then(|v| v.as_str()) {
         Some("null") => Some("void"),
         Some("boolean") => Some("boolean"),
         Some("string") => Some("string"),
+        Some("number" | "integer") => Some("number"),
         _ => None,
     }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fn primitive_ts_name(schema: &Value) -> Option<&'static str> {
match schema.get("type").and_then(|v| v.as_str()) {
Some("null") => Some("void"),
Some("boolean") => Some("boolean"),
Some("string") => Some("string"),
_ => None,
}
}
fn primitive_ts_name(schema: &Value) -> Option<&'static str> {
match schema.get("type").and_then(|v| v.as_str()) {
Some("null") => Some("void"),
Some("boolean") => Some("boolean"),
Some("string") => Some("string"),
Some("number" | "integer") => Some("number"),
_ => None,
}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@codegen/src/lsp.rs` around lines 76 - 83, primitive_ts_name is missing
branches for numeric schemas so numeric types fall through to interface
rendering; update primitive_ts_name to handle schema.get("type") == "number" and
"integer" (returning Some("number")) so it matches is_primitive_schema's
treatment and numeric return types render as "number".


## Integrate Biome in an editor extension

You can integrate Biome in your editor extension is different ways.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Typo: "is" should be "in".

Small grammar fix needed.

-You can integrate Biome in your editor extension is different ways.
+You can integrate Biome in your editor extension in different ways.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
You can integrate Biome in your editor extension is different ways.
You can integrate Biome in your editor extension in different ways.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/content/docs/editors/introduction.mdx` at line 124, Fix the typo in the
sentence "You can integrate Biome in your editor extension is different ways."
by replacing the incorrect word "is" with "in" so the line reads "You can
integrate Biome in your editor extension in different ways."; update the text in
the editors/introduction.mdx content where that sentence appears.

- a [daemon](/internals/architecture#daemon) that does execute the requested operations;
- a server that functions as a proxy between the requests of the client - the editor - and the server - the daemon;

If your editor is able to interact with a server and send [JSON-RPC](https://www.jsonrpc.org/) request, you only need to configure the editor run that command.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Missing preposition "to".

-If your editor is able to interact with a server and send [JSON-RPC](https://www.jsonrpc.org/) request, you only need to configure the editor run that command.
+If your editor can interact with a server and send [JSON-RPC](https://www.jsonrpc.org/) requests, you only need to configure the editor to run that command.

Also changed "request" to "requests" for grammatical consistency.

🧰 Tools
🪛 LanguageTool

[style] ~132-~132: As a shorter alternative for ‘able to’, consider using “can”.
Context: ...he server - the daemon; If your editor is able to interact with a server and send [JSON-R...

(BE_ABLE_TO)


[uncategorized] ~132-~132: Possible missing preposition found.
Context: ..., you only need to configure the editor run that command. You can check how the [`...

(AI_HYDRA_LEO_MISSING_TO)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/content/docs/editors/introduction.mdx` at line 132, Fix the sentence
fragment "If your editor is able to interact with a server and send [JSON-RPC]
request, you only need to configure the editor run that command." by inserting
the missing preposition "to" before "run" and pluralizing "request" to
"requests" for grammatical consistency; target the sentence starting "If your
editor is able to interact with a server and send [JSON-RPC] request" in
src/content/docs/editors/introduction.mdx and update it to read "...and send
[JSON-RPC] requests, you only need to configure the editor to run that command."


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

The language server exposes [some options](/editors/introduction#extension-settings) that editor extension can exposse to users.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Typo: "exposse" → "expose".

-The language server exposes [some options](/editors/introduction#extension-settings) that editor extension can exposse to users.
+The language server exposes [some options](/editors/introduction#extension-settings) that editor extensions can expose to users.

Also added plural "extensions" for consistency.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
The language server exposes [some options](/editors/introduction#extension-settings) that editor extension can exposse to users.
The language server exposes [some options](/editors/introduction#extension-settings) that editor extensions can expose to users.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/content/docs/editors/introduction.mdx` at line 160, Fix the typo and
pluralization in the sentence that reads "The language server exposes [some
options](/editors/introduction#extension-settings) that editor extension can
exposse to users" — change it to "The language server exposes [some
options](/editors/introduction#extension-settings) that editor extensions can
expose to users" by correcting "exposse" → "expose" and making "extension"
plural.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Comment thread astro.config.ts
Comment on lines +645 to +654
translations: {
es: "Biome en tu IDE",
fr: "Biome dans votre IDE",
ja: "Biome をあなたのエディタに導入する",
"zh-CN": "编辑器中使用 Biome",
pl: "Biome w Twoim IDE",
"pt-BR": "Biome no seu editor",
uk: "Biome в вашому IDE",
ru: "Biome в вашей IDE",
},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Translations are outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants