fix(diagnostic): include config path and CWD in ConfigurationOutsideProject#9488
fix(diagnostic): include config path and CWD in ConfigurationOutsideProject#9488mvanhorn wants to merge 5 commits intobiomejs:mainfrom
Conversation
…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 detectedLatest commit: 19f3ec6 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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughThe PR expands the ConfigurationOutsideProject diagnostic to include two public fields, Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 Tip CodeRabbit can use OpenGrep to find security vulnerabilities and bugs across 17+ programming languages.OpenGrep is compatible with Semgrep configurations. Add an |
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
crates/biome_cli/src/runner/mod.rscrates/biome_lsp/src/session.rscrates/biome_service/src/diagnostics.rs
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>
crates/biome_cli/src/runner/mod.rs
Outdated
| let config_path_str = config_file_path | ||
| .as_ref() | ||
| .map(|p| p.to_string()) | ||
| .unwrap_or_else(|| "<unknown>".to_string()); |
There was a problem hiding this comment.
| .unwrap_or_else(|| "<unknown>".to_string()); | |
| .unwrap_or("<unknown>".to_string()); |
crates/biome_cli/src/runner/mod.rs
Outdated
| &root_configuration_dir | ||
| }; | ||
| if !loaded_location.is_in_project() { | ||
| let config_path_str = config_file_path |
There was a problem hiding this comment.
| let config_path_str = config_file_path | |
| let config_file_path = config_file_path |
crates/biome_cli/src/runner/mod.rs
Outdated
| console.log(markup! { | ||
| {PrintDiagnostic::simple(&ConfigurationOutsideProject)} | ||
| {PrintDiagnostic::simple(&ConfigurationOutsideProject { | ||
| config_path: config_path_str, |
There was a problem hiding this comment.
| config_path: config_path_str, | |
| config_path: config_file_path, |
- 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.
|
@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
|
Fixed in 19f3ec6: resolved the clippy AI disclosure: this PR uses Claude Code for implementation. |
|
CI is failing... |
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:
After:
Both CLI and LSP code paths are updated.
Fixes #9463
Test Plan
cargo check -p biome_lsp -p biome_clipassesconfig_pathandworking_directoryfieldsAI Assistance
This PR was written with AI assistance (Claude Code).