Skip to content

feat: resolve variables in custom path settings#1014

Open
silverstein wants to merge 3 commits intobiomejs:mainfrom
silverstein:codex/vscode-variable-expansion
Open

feat: resolve variables in custom path settings#1014
silverstein wants to merge 3 commits intobiomejs:mainfrom
silverstein:codex/vscode-variable-expansion

Conversation

@silverstein
Copy link
Copy Markdown

@silverstein silverstein commented Apr 7, 2026

Summary

Fixes #721.

This updates the extension to resolve common VS Code variables in path-like Biome settings before they are used locally or returned to the language server.

What changed

  • biome.lsp.bin and deprecated biome.lspBin now expand variables such as ${workspaceFolder}, ${workspaceFolder:name}, ${userHome}, ${cwd}, and ${env:NAME} before path resolution.
  • biome.configurationPath now goes through the same expansion when the language server requests biome settings via workspace/configuration.
  • The same configuration middleware also normalizes direct workspace/configuration requests for biome.configurationPath, biome.lsp.bin, and biome.lspBin, so local path resolution and server-side settings stay aligned.
  • Added a changeset because this is a user-facing extension behavior fix.

Why this fixes the issue

Before this change, the extension treated configured paths as literal strings. That meant settings like:

  • "biome.lsp.bin": "${userHome}/.../biome"
  • "biome.configurationPath": "${workspaceFolder}/biome.json"

were passed through without interpolation, so the binary lookup and config lookup failed even though the expanded paths were valid.

Verification

Repo checks

  • pnpm exec biome check src/session.ts src/utils.ts .changeset/five-apricots-resolve.md
  • pnpm run typecheck
  • pnpm run build
  • npx -y node@24.14.1 ./node_modules/@vscode/vsce/vsce package --out biome.vsix

Note: pnpm run package failed under local Node 25 because of a vsce dependency/runtime mismatch, but packaging succeeded under the repo's pinned Node 24.14.1 from .node-version.

Manual extension-host validation

Launched a clean VS Code extension-development window with isolated --user-data-dir and a throwaway workspace configured with:

  • "biome.lsp.bin": "${workspaceFolder}/node_modules/.bin/biome"
  • "biome.configurationPath": "${workspaceFolder}/biome.json"

Observed in the extension logs that:

  • biome.lsp.bin was expanded and successfully unshimmed from the workspace-relative path to the real bundled Biome binary.
  • The workspace/configuration response contained "configurationPath": "/tmp/biome-vscode-test-ws/biome.json" as an absolute path, not the raw ${workspaceFolder} string.

AI assistance

I used Codex (GPT-5.4, high reasoning) to help with implementation and drafting, then reviewed the code, fixed issues found during an adversarial follow-up review, and ran the verification above.

@silverstein silverstein requested review from a team and nhedger as code owners April 7, 2026 04:12
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 7, 2026

🦋 Changeset detected

Latest commit: fabfc86

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
biome Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@nhedger nhedger changed the title fix(vscode): resolve variables in custom path settings feat: resolve variables in custom path settings Apr 7, 2026
@@ -0,0 +1,6 @@
---
"biome": patch
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.

Suggested change
"biome": patch
"biome": minor

@silverstein
Copy link
Copy Markdown
Author

Makes sense to me. I was thinking of it as a bug fix for existing settings, but I’m happy to treat the user-visible behavior change as minor here. I’ll switch it over.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 biome.lsp.bin does not expand VSCode variables

2 participants