Repository navigation
fix(lsp): run a pinned @biomejs/biome in the biome bunx fallback - #134
Conversation
bunx biome resolved the unrelated unscoped `biome` npm package, so a machine without Biome installed ran a third-party env-var tool instead of the Biome language server. Run @biomejs/biome@2.6.2 instead, and look up a biome on the current PATH rather than the copy Bun captured at startup. Closes #133
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Code Review
This pull request updates the Biome LSP server implementation to use a pinned version (2.6.2) of @biomejs/biome when falling back to bunx, preventing conflicts with the unrelated unscoped biome package. It also ensures that Bun.which reads the current PATH environment variable rather than the startup copy. Additionally, the test suite is refactored to introduce a reusable spawnServerWith helper, and new unit tests are added to verify the fallback behavior of the Biome server. There are no review comments, and we have no feedback to provide.
There was a problem hiding this comment.
cubic analysis
All reported issues were addressed across 2 files
Linked issue analysis
Linked issue: pleaseai/code-intelligence#133: fix(lsp): biome bunx fallback runs the unrelated biome npm package instead of @biomejs/biome
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | Run the pinned @biomejs/biome package in the bunx fallback | BiomeServer now invokes @biomejs/biome@2.6.2 with lsp-proxy --stdio, and a test checks the recorded arguments. |
Architecture diagram
sequenceDiagram
participant Client as LSP Client
participant Server as Biome Server
participant FS as File System
participant BIN as node_modules/.bin
participant PATH as System PATH
participant BUNX as bunx Runner
participant NPM as npm Registry
Note over Client,NPM: Biome Language Server Startup Flow
Client->>Server: Initialize LSP connection
Server->>FS: Search for biome binary
alt Project-local biome found
FS-->>Server: node_modules/.bin/biome
Server->>BIN: Spawn biome lsp-proxy --stdio
BIN-->>Server: LSP process
else No project-local biome
Server->>PATH: Bun.which('biome', { PATH: process.env.PATH })
alt Global biome on PATH
PATH-->>Server: biome binary path
Server->>PATH: Spawn biome lsp-proxy --stdio
PATH-->>Server: LSP process
else No global biome
Server->>BUNX: Spawn bunx @biomejs/biome@2.6.2 lsp-proxy --stdio
BUNX->>NPM: Fetch @biomejs/biome@2.6.2 package
NPM-->>BUNX: Package binaries
BUNX-->>Server: LSP process
end
end
Server-->>Client: LSP communication channel
Note over PATH,BUNX: PATH lookup uses current env<br/>not Bun's captured PATH
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
[Medium impact] The PR appears safe to merge; no blocking issues were found. SummaryThe PR changes the Biome fallback to use pinned
Reviews (2) · Last reviewed commit: "chore(lsp): apply AI code review suggest..." · Reviewed by Greptile |
Check for bunx before the Biome fallback spawns it, and return undefined with the install hint when it is missing. spawn reports a missing command only as an async error event, so the old try/catch never logged the hint and a dead process handle reached the LSP manager.
|



Summary
The Biome server's last-resort fallback ran
bunx biome lsp-proxy --stdio. That resolves the unscoped npm packagebiome, an unrelated environment-variable tool (latest0.3.3) that also ships abiomebin. Real Biome is@biomejs/biome. So on a machine without Biome, this fallback downloaded and ran a third-party package, and the Biome language server never started.Changes in
packages/lsp/src/server/biome.ts:bunx @biomejs/biome@2.6.2 lsp-proxy --stdio. The version is inBIOME_VERSION, the same way fix(lsp): skip an unrunnable typescript-language-server and fall back to bunx #131 pinstypescript-language-server.PATH: thebiomelookup now passesprocess.env.PATHtoBun.which, likefindRunnableBindoes. Without it, Bun searches thePATHit captured at startup, and the tests below can't control whichbiomeis found.Tests in
packages/lsp/test/unit/server.test.ts:spawnServerWith(server, …)and is shared by the TypeScript and Biome fallback blocks. The TypeScript tests are unchanged.BiomeServer fallbackblock (skipped on Windows, like the TypeScript block), with one test per lookup step:@biomejs/biome@2.6.2;biomeonPATHwins over bunx;node_modules/.bin/biomewins over both.bunx biome …for the first,bunx @biomejs/biome…instead of thePATHbinary for the second).Out of scope: the
catcharound the bunx spawn still almost never runs.node:child_processreports a missingbunxthrough the asyncerrorevent, so thenpm install @biomejs/biomehint is never logged. #133 notes this. I left it out to keep this PR to the wrong package.Related issue
Closes #133
Checklist
bun test test/unit/server.test.ts: 85 pass, 0 fail)tsc --noEmitforpackages/lsp)BREAKING CHANGE:note is includedSummary by cubic
Fixes the Biome server's bunx fallback so it runs a pinned
@biomejs/biomepackage instead of the unrelated unscopedbiomenpm package, which previously downloaded a third-party environment-variable tool and never started the language server.bunxfrom the currentPATHbefore spawning and runs@biomejs/biome@2.6.2 lsp-proxy --stdio; whenbunxis missing it logs the install hint and returnsundefinedinstead of a dead process handle, sincespawnreports missing commands asynchronously.biomeis looked up with the currentPATHrather than the copy Bun captured at startup, so tests can control which binary is found.spawnServerWithtest helper and adds tests for the lookup order: project-localbiomewins overPATH, which wins over the pinned bunx fallback, plus the missing-bunxcase.Written for commit 7cbe2e6. Summary will update on new commits.