Skip to content

fix(diagnostic): include config path and CWD in ConfigurationOutsideProject#9488

Merged
ematipico merged 6 commits intobiomejs:mainfrom
mvanhorn:osc/9463-improve-config-outside-cwd-message
Mar 17, 2026
Merged

fix(diagnostic): include config path and CWD in ConfigurationOutsideProject#9488
ematipico merged 6 commits intobiomejs:mainfrom
mvanhorn:osc/9463-improve-config-outside-cwd-message

Conversation

@mvanhorn
Copy link
Copy Markdown
Contributor

Summary

The "Biome found a configuration file outside of the current working directory" diagnostic now includes the actual configuration file path and working directory. Previously the message had no dynamic content, leaving users with no actionable information to debug the issue.

Before:

Biome found a configuration file outside of the current working directory.

After:

Biome found the configuration file "/home/user/.config/biome.json" outside of the current working directory "/home/user/project".

Both CLI and LSP code paths are updated.

Fixes #9463

Test Plan

  • cargo check -p biome_lsp -p biome_cli passes
  • Diagnostic struct now takes config_path and working_directory fields

AI Assistance

This PR was written with AI assistance (Claude Code).

…roject

The error message "Biome found a configuration file outside of the
current working directory" now includes the actual configuration file
path and the working directory. This gives users actionable information
to debug the issue.

Fixes biomejs#9463

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 15, 2026

🦋 Changeset detected

Latest commit: adff44b

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 A-CLI Area: CLI A-Project Area: project A-LSP Area: language server protocol labels Mar 15, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 15, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 3992e1ab-2c75-4261-bd15-d9bd74adace0

📥 Commits

Reviewing files that changed from the base of the PR and between 19f3ec6 and adff44b.

📒 Files selected for processing (1)
  • crates/biome_cli/src/runner/mod.rs

Walkthrough

The PR expands the ConfigurationOutsideProject diagnostic to include two public fields, config_path: String and working_directory: String, and removes the Default derive. Call sites in the CLI runner and the LSP session now capture and supply the config file path (falling back to "<unknown>" when needed) and compute a working-directory string; control flow and public signatures remain unchanged. Diagnostic message text was updated to reference the new fields.

Possibly related PRs

Suggested labels

A-Diagnostic

Suggested reviewers

  • ematipico
  • dyc3
  • arendjr
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: enhancing the ConfigurationOutsideProject diagnostic to include the config path and current working directory.
Description check ✅ Passed The description clearly explains the improvement with before/after examples and references the fixed issue #9463, demonstrating how the diagnostic message now provides actionable debugging information.
Linked Issues check ✅ Passed The PR fully addresses issue #9463 requirements: config file path and working directory are now included in the diagnostic struct fields and message, making the diagnostic actionable for users.
Out of Scope Changes check ✅ Passed All changes are scoped to the ConfigurationOutsideProject diagnostic implementation across CLI and LSP code paths, with a changelog entry. No unrelated modifications detected.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

CodeRabbit can generate a title for your PR based on the changes.

Add @coderabbitai placeholder anywhere in the title of your PR and CodeRabbit will replace it with a title based on the changes in the PR. You can change the placeholder by changing the reviews.auto_title_placeholder setting.

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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/biome_cli/src/runner/mod.rs`:
- Around line 390-398: The diagnostic is showing the directory path instead of
the actual config file path; change the construction of config_path_str to use
the loaded config file path variable (rather than directory_path) and fall back
to "<unknown>" if that file path is missing, then pass that into
PrintDiagnostic::simple(&ConfigurationOutsideProject { config_path:
config_path_str, working_directory: working_dir.to_string() }). Locate where
config_path_str is built (currently from directory_path.as_ref().map(|p|
p.to_string()).unwrap_or_else(...)) and replace that expression with the actual
config file path variable (e.g., config_path or config_file) converted to
string.

In `@crates/biome_lsp/src/session.rs`:
- Around line 979-985: The logged working_directory is derived directly from
ConfigurationPathHint variants and can be incorrect for FromUser and
FromUserExternal; update the logic that computes working_directory in session.rs
to reuse the same resolution used later for the effective project base (extract
or call the shared helper that resolves the base path used for project loading)
so that working_directory reflects the actual resolved base (ensure the code
paths around where ConfigurationPathHint is matched and where the effective
project base is computed both use the same resolver or helper function).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7ec74a85-247b-49b4-9f2c-9658072e8986

📥 Commits

Reviewing files that changed from the base of the PR and between fe9ff6b and a9b974a.

📒 Files selected for processing (3)
  • crates/biome_cli/src/runner/mod.rs
  • crates/biome_lsp/src/session.rs
  • crates/biome_service/src/diagnostics.rs

mvanhorn and others added 2 commits March 15, 2026 08:45
Show the actual configuration file path in the ConfigurationOutsideProject
diagnostic instead of just the directory path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
let config_path_str = config_file_path
.as_ref()
.map(|p| p.to_string())
.unwrap_or_else(|| "<unknown>".to_string());
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
.unwrap_or_else(|| "<unknown>".to_string());
.unwrap_or("<unknown>".to_string());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Applied in 3d4d125.

&root_configuration_dir
};
if !loaded_location.is_in_project() {
let config_path_str = config_file_path
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
let config_path_str = config_file_path
let config_file_path = config_file_path

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Applied in 3d4d125.

console.log(markup! {
{PrintDiagnostic::simple(&ConfigurationOutsideProject)}
{PrintDiagnostic::simple(&ConfigurationOutsideProject {
config_path: config_path_str,
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
config_path: config_path_str,
config_path: config_file_path,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Applied in 3d4d125.

- Apply ematipico's code suggestions: rename config_path_str to
  config_file_path, use unwrap_or, update struct field reference.
- Fix LSP working directory resolution for FromUser/FromUserExternal
  config hints: resolve to parent directory for file paths and use
  session base path for external configs, matching the project_path
  resolution logic below.
@ematipico
Copy link
Copy Markdown
Member

@mvanhorn linting and tests don't pass. Please make sure to test things locally

- Use map_or_else instead of map().unwrap_or_else() in session.rs
- Update can_read_configuration_from_user_home snapshot for new message format
- Verified tests and clippy pass locally
@mvanhorn
Copy link
Copy Markdown
Contributor Author

Fixed in 19f3ec6: resolved the clippy map_unwrap_or lint in session.rs and updated the snapshot for the new diagnostic message format. Tests and clippy pass locally now.

AI disclosure: this PR uses Claude Code for implementation.

@ematipico
Copy link
Copy Markdown
Member

CI is failing...

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mvanhorn
Copy link
Copy Markdown
Contributor Author

Fixed the clippy map_unwrap_or lint in adff44b - replaced .map().unwrap_or() with .map_or_else().

@ematipico ematipico merged commit bc709f6 into biomejs:main Mar 17, 2026
13 checks passed
@github-actions github-actions bot mentioned this pull request Mar 17, 2026
@mvanhorn
Copy link
Copy Markdown
Contributor Author

Thanks for the merge and the thorough review on #9489 too - learned a lot about biome's test infrastructure conventions.

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

Labels

A-CLI Area: CLI A-LSP Area: language server protocol A-Project Area: project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Improve error message: Biome found a configuration file outside of the current working directory.

2 participants