Skip to content

Conversation

@ruidosujeira
Copy link
Contributor

fixes #8209

Summary

The workspace capability detection only treated formatter.format as a signal that a file supports formatting. As a result, file handlers that only rely on format_range or format_on_type were not marked as supporting Format, causing SourceFileNotSupported for valid range-formatting requests (e.g. JSONC .vscode/settings.json).
This change updates FeaturesSupported::with_capabilities() to consider any of format, format_range, or format_on_type when enabling FeatureKind::Format.

Test Plan

Build Biome with this change.
Open a project containing .vscode/settings.json (JSONC) in VS Code.
Trigger: Format Selection (sends textDocument/rangeFormatting) and full document formatting (textDocument/formatting), if configured.

Expectations:

  • JSONC range formatting no longer throws SourceFileNotSupported.
  • The selected range is formatted correctly.
  • Full-document formatting still works for languages/files that provide format().
  • Format-on-type (where supported) still works and is not blocked by capability detection.

…biomejs#8209)

The `FeaturesSupported::with_capabilities()` function was only checking if `format()` existed, but was ignoring `format_range()` and `format_on_type()`.
This caused files like `.vscode/settings.json` (JSONC) to incorrectly throw `SourceFileNotSupported` error when using range formatting.

This fix ensures that ANY formatting capability (format, format_range, or format_on_type) marks the Format feature as supported.

Fixes biomejs#8209
@changeset-bot
Copy link

changeset-bot bot commented Nov 22, 2025

🦋 Changeset detected

Latest commit: b8de2c6

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

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

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

@github-actions github-actions bot added the A-Project Area: project label Nov 22, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 22, 2025

Walkthrough

Workspace capability detection was changed: with_capabilities now treats Format as supported if any of formatter.format, formatter.formatRange or formatter.formatOnType is present. A changeset was added documenting this patch. No public API signatures were altered.

Pre-merge checks and finishing touches

✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly and concisely summarises the main change: recognising format_range and format_on_type as Format capabilities.
Description check ✅ Passed Description thoroughly explains the problem, solution, and test plan, directly related to the changeset and issue #8209.
Linked Issues check ✅ Passed Changes address all coding requirements from #8209: updating with_capabilities to treat any formatting capability as enabling Format support.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the capability detection logic for formatting; no unrelated modifications present.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c8569df and b8de2c6.

📒 Files selected for processing (1)
  • .changeset/recognize-format-capabilities.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/recognize-format-capabilities.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Good catch!!

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

@ruidosujeira
Copy link
Contributor Author

@ematipico Are the additions and modifications made satisfactory?

Copy link
Contributor

@dyc3 dyc3 left a comment

Choose a reason for hiding this comment

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

LGTM

@dyc3 dyc3 added this pull request to the merge queue Nov 22, 2025
Merged via the queue into biomejs:main with commit e430555 Nov 22, 2025
13 checks passed
This was referenced Nov 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Project Area: project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 "Request textDocument/codeAction failed" shows when saving JSON files

3 participants