Skip to content

fix: load rust-analyzer.toml for virtual workspaces#21704

Merged
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
Madoshakalaka:fix/ratoml-virtual-workspace-loading
Apr 6, 2026
Merged

fix: load rust-analyzer.toml for virtual workspaces#21704
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
Madoshakalaka:fix/ratoml-virtual-workspace-loading

Conversation

@Madoshakalaka
Copy link
Copy Markdown
Contributor

@Madoshakalaka Madoshakalaka commented Feb 25, 2026

Summary

Fixes the most common case of broken rust-analyzer.toml loading: virtual workspaces

For virtual workspaces, ProjectWorkspace::to_roots() only creates PackageRoots for member crate packages. The workspace root directory itself gets none.

Any rust-analyzer.toml placed at the workspace root then falls into the default (library) source root and is silently ignored by process_changes().

The fix ensures every workspace root is included as a local source root in ProjectFolders::new(), even when no package lives there.

Relates to #13529, fixes #18943.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 25, 2026
@Madoshakalaka
Copy link
Copy Markdown
Contributor Author

Madoshakalaka commented Feb 26, 2026

Note: Veykril mentioned in #18943 that fixing ratoml loading was blocked on reworking the file system infrastructure (#18948). This PR doesn't attempt that. it's a targeted fix to a broken case.

Comment thread crates/load-cargo/src/lib.rs Outdated
exclude: vec![ws_root.join(".git"), ws_root.join("target")],
});
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This will include unwanted things in the workspace. Instead only include ws_root/rust-analyzer.toml.

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.

thanks, done

}

#[test]
#[ignore = "flaky test that tends to hang"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why did you remove this ignores?

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.

sorry these were accidental

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.

reverted. I also reverted my overly aggressive edit to docs/book/src/configuration.md

Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

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

@Madoshakalaka Madoshakalaka force-pushed the fix/ratoml-virtual-workspace-loading branch from efd2b8e to 865e224 Compare April 6, 2026 05:10
@Madoshakalaka
Copy link
Copy Markdown
Contributor Author

Please squash

done

Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

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

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Apr 6, 2026
Merged via the queue into rust-lang:master with commit f7da193 Apr 6, 2026
17 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 6, 2026
@Madoshakalaka Madoshakalaka deleted the fix/ratoml-virtual-workspace-loading branch April 6, 2026 05:48
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.

rust-analyzer.toml

3 participants