-
-
Notifications
You must be signed in to change notification settings - Fork 781
fix: recognize format_range and format_on_type as Format capabilities… #8213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: recognize format_range and format_on_type as Format capabilities… #8213
Conversation
…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 detectedLatest commit: b8de2c6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
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 |
WalkthroughWorkspace capability detection was changed: Pre-merge checks and finishing touches✅ Passed checks (4 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
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. Comment |
ematipico
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!!
ematipico
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add a changeset? https://github.com/biomejs/biome?tab=contributing-ov-file#create-a-changeset
|
@ematipico Are the additions and modifications made satisfactory? |
dyc3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
fixes #8209
Summary
The workspace capability detection only treated
formatter.formatas a signal that a file supports formatting. As a result, file handlers that only rely onformat_rangeorformat_on_typewere not marked as supportingFormat, causingSourceFileNotSupportedfor valid range-formatting requests (e.g. JSONC.vscode/settings.json).This change updates
FeaturesSupported::with_capabilities()to consider any offormat,format_range, orformat_on_typewhen enablingFeatureKind::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:
SourceFileNotSupported.format().