-
Notifications
You must be signed in to change notification settings - Fork 255
Tracking issue: multiple targets/workspaces/packages, etc. #132
Comments
Diesel is an example of this style |
Sorry for pushing this once again, but I really think that true rebuilding is not an option here. You should be able to have crates I hope that this is included in the long-term plan for RLS/compiler integration. I totally understand why this restriction makes sense at the current stage :) |
Two cases I've run into that were not explicitly mentioned:
For these it would be nice to not have to configure anything. Maybe the RLS could infer the settings from the directory path? |
I probably should've posted more information on the work done for the workspaces here, sorry. More info can be also found over at #263. Currently the new workspace mode can be enabled via Reporting diagnostics and lazy (i.e. not full) package rebuild should work now. |
Status update. We're currently waiting on rust-dev-tools/rls-analysis#106 which is blocked on a Rust PR. Once that lands, we're basically done with our plan for workspaces (thanks @Xanewok !). Having both a lib and a bin (or multiple bins) should also be solved as part of that work, and build scripts (AIUI). We can support any one of multiple targets using an option and there is work in progress (I think) for arbitrary Cargo features. So, remaining work that I'm aware of:
|
The workspace-related options are:
Thoughts:
@Xanewok @alexheretic What do you think? |
Yep I agree with these. The bigger one is enabling |
Yeah, I guess that's fair. The Why doesn't On that note, do you think we can prune non-workspace mode now in the codebase? Before doing that, I think it already has what it'd take to support the, currently lacking, single .rs file case (not Cargo), so this might be worth taking a look first. |
Yeah, I guess the alternative is to make these work with workspace mode, I'm not sure how hard that would be. I'm not sure urgent that would be - aiui, we build everything in workspace mode with all_targets, so we get all bins and the lib, is there any advantage to specifying a particular binary? Given that binaries are always leaves in the dep graph, I don't think it would even make builds faster. I guess specifying build_lib would be faster because we would skip all bins.
Maybe I'm behind the times, I thought it had problems with the dead code lint.
Yes, although we should probably decide on build_lib/build_bin before that
it is workspace mode, or non-workspace mode? How much work do you think that would be? |
Probably not; I can imagine crate having multiple binaries and that it might be handy to only rebuild one, but if the lib is indexed once and shared across bins then I think we can remove it.
The non-workspace mode. It is effectively caching and running a single invocation of rustc, which is exactly the use case for a single file. However, it might be possible to do some unification and make it so that single file mode just creates a job queue with a single rustc job. (just an idea, didn't look into that) |
Thinking about the single file case, I think that this is much lower priority than Cargo projects for 1.0 and that if we support it (and I do think we should) then we should find a way to do so in workspace mode so that we're not supporting these two separate modes. Worst case, when we want to implement, we can resurrect non-workspace mode. |
In many situations there is not just one primary crate - workspaces and packages are I think examples of this, basically. Another common one is where there is both a lib and bin (where cargo users would use
--lib
or--bin
to filter builds). A related issue is where the primary crate is actually just a thin wrapper around a more interesting dep crate. There is also the case where a user wants to edit files in both the primary crate and a dep. The RLS doesn't really handle any of these scenarios very well.Currently the only thing we can do about this is effectively set
cargo check --lib
by setting thebuild_lib
option in rls.toml. We should expand the config file so we can set other filters and set a dep to be the primary crate for a project.More long term we should:
cc #102
The text was updated successfully, but these errors were encountered: