Skip to content

Refine support for workspaces #950

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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

dstoza
Copy link
Contributor

@dstoza dstoza commented Jun 17, 2025

This PR refines the existing workspace support to closely align with the typical Rust package layout.

For a full description of the workspace auto-detection based on package structure, see the new section of the book.

On top of the new tests for workspace handling, the sample workspace created for the test was verified against the CLI commands for check, doc, test, bench, run, and fmt to make sure the correct workspace members were picked up.

@dstoza dstoza marked this pull request as ready for review June 17, 2025 22:57
@udoprog udoprog added the enhancement New feature or request label Jun 19, 2025
@udoprog
Copy link
Collaborator

udoprog commented Jun 19, 2025

Thanks!

I think you discussed the changes a bit on Discord, and they look good to me. Could you also go over what has changed in the description of the issue making it easier to keep a record?

let (path, name) = file?;
if ["lib", "main"].iter().any(|entry| *entry == name) {
output.try_push(Found {
kind: FoundKind::Source,
Copy link
Collaborator

Choose a reason for hiding this comment

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

One thing we might want to be careful about is that a lib and a main are two different kinds of entrypoints. One is a binary named the same as the crate and if we follow Rust autosource conventions there can be more binaries under a src/bin folder. The other is a library.

I'm not sure this matters, but now might be a good time to set up workspace tests to make sure things work as intended even when many things are named the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I agree. I'll try to formalize this to match Rust conventions and change the existing workspace stuff in the repo to match next week. I just wanted to make sure I was on the right track first 🙂

@dstoza dstoza marked this pull request as draft June 26, 2025 23:37
@dstoza dstoza force-pushed the stoza/add-workspaces-to-language-server branch from 6168832 to 164927f Compare June 27, 2025 20:55
@dstoza dstoza changed the title Add support for workspaces to language server Refine support for workspaces Jun 27, 2025
Copy link
Collaborator

@udoprog udoprog left a comment

Choose a reason for hiding this comment

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

Looks great. Thank you for putting this together! I'll merge this when I get back feel free in case you want to tinker some more.

@dstoza
Copy link
Contributor Author

dstoza commented Jun 30, 2025

The --package flag was the last thing I wanted to do (it was bugging me that it didn't exist, even if I don't think it will be used that often), but I figure I can rebase this after my clippy PR goes in so this PR is a bit cleaner in the log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants