-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
breaking change when handling multiple cargo targets #18869
Comments
This never worked, rust-analyzer is inherently incapable of handling multiple targets. The only thing that works (unless that is what broke here) is allowing |
I can confirm that code completion, hints and jumps used to work, this is something I am using every day since 2 years or so. I think this got implemented in this PR: #13290 It is straightforward to verify that it used to work using the provided POC repository: https://github.com/qjerome/rust-analyzer-repro-bug-1 |
#13290 only implemented cargo check to be supported for multiple targets, as the PR title states. |
Waht exactly is the behavior you are observing in that example repo now. That only one of the cfgs is being semantically analyzed? (which I can only repeat, has always been the case) |
Huh, well that looks like a bug to me. This implies that rust-analyzer is not able to analyze for multiple targets at once, this is a huge architecture change that have no capacity to implement |
Ok, so you mean its been 2 years I am relying on a bug on RA to serve well my multiple target use case and that won't be fixed ? I actually have a Rust workspace where I have to develop two targets What would you recommend to be able to do that with rust-analyzer ? |
Unfortunately the only option until we improve the situtation is to open r-a twice, once for each target (and configure each instance via the editor configs). |
Well that is not ideal ... I think it will be cumbersome (at least for the lazy ass I am :)) to always jump between two instances of the IDE ! |
Try including your extra targets in |
Thanks @ChayimFriedman2 it works with this to add only one extra target, I didn't find yet how to do to add several targets. "rust-analyzer.cargo.cfgs": {
"target_arch": "x86_64",
} |
Maybe a quick win for a partial / light multi-target support would be either to have |
For posterity here is a PR allowing one to specify several times the same |
Description
I could track down there is breaking change concerning multiple cargo targets since release 0.3.2237
Issue: prior 0.3.2237 it was possible to set multiple cargo targets in
.config/cargo.toml
and rust-analyzer was working fine with it. Since the mentioned release it no longer works, at least on VSCode. One can confirm that by trying to analyze the code available in the repository referenced below with a RA version >=0.3.2237. The expected behavior is to have all the cargo targets specified in.config/cargo.toml
being analyzed correctly (code completion, hints, jumps ...).Temporary fix: revert back to rust-analyzer 0.3.2228
Additional Information
rust-analyzer version: since 0.3.2237
rustc version: rustc 1.83.0 (90b35a623 2024-11-26)
editor or extension: VSCode with official rust-analyzer extension
code snippet to reproduce: https://github.com/qjerome/rust-analyzer-repro-bug-1
The text was updated successfully, but these errors were encountered: