-
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
VSCode should honor toolchain overrides that contain a rust-analyzer component for server spawning #17663
Comments
Thanks for raising this.
Just on the subject of "old toolchains", it is of course quite common for projects to pin their toolchains, particularly once deployed to production. My point is that past toolchain usage is a fact of life and so pointing out to the developer that their toolchain is old is probably not useful. :-) |
Too old for the current rust-analyzer server that is running, it is useful to point that out, because otherwise we just get issue reports for issues caused by us not supporting something wrt to that old toolchain. If we have a way to let people pin their version to an older compatible toolchain then we can just point them to that and everything is fine. |
I don't see that this issue is resolved. I've updated by VSC environment to use the nightly RA. Here's its version info:
So the PR commit is part of this. Yet, if I now add RA to my toolchain files e.g.:
...then I'm still seeing errors in the RA output:
As a consequence, I continue to get:
I've also tried cleaning project folders and restarting RA. Additional info: My project has a VSC workspace file and each project within is relatively independent of the other. Some of the projects have a toolchain file, some do not. There's a blend of embedded and non-embedded Rust projects here. |
Is it that the VSC integration design only facilitates one RA per workspace? If I open a specific project i.e. avoid opening up my workspace, then I think the changes in the associated PR are working. This is the code that leads me to think that there's a restriction on the RA in that it is just one per workspace: https://github.com/rust-lang/rust-analyzer/pull/17667/files#diff-4023aad9450babbfcc30b89d5bf1fe604d569d67ff8c3232b783e8666c41eb0dR55 Perhaps an improvement on that would be to iterate through the workspaces and use the oldest RA found. WDYT? The way it stands now is that opening up my workspace is no longer viable. |
This is the reason. The toolchain pickup only works when there is a single folder opened within a VSCode workspace. The reason for that is that extensions are loaded per VSCode workspace and the toolchain override happens per cargo workspace/folder within a VSCode workspace.
Ye I suppose this would work? |
Would also be good to attach a "reason" to why we chose the current running server version when telling the user about the running server then. |
Well, it’s better than the current situation. ;-) Do you want me to have a go?
Sure. Where would that be displayed? In the RA output? |
We have a status bar item that shows some info on hover, we should probably show that there rust-analyzer/editors/code/src/ctx.ts Lines 402 to 481 in 62a7468
(we also have a command but the notification that pops up from that isn't really nice for that). |
…kril Use rustup rust-analyzer component when there is a toolchain file override for the opened workspace Fixes rust-lang/rust-analyzer#17663
Is this really closed given my PR, or is my PR now obsolete? |
No this got closed incorrectly by the repo sync, your or is still relevant
…On Thu, Aug 1, 2024, 9:40 PM Christopher Hunt ***@***.***> wrote:
Is this really closed given my PR, or is my PR now obsolete?
—
Reply to this email directly, view it on GitHub
<#17663 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA4VNS4LMTZD4MFNLJZBDJLZPKFJBAVCNFSM6AAAAABLHXDRFGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRTHAZTCOJZGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
feat: Use oldest rustup rust-analyzer when toolchain override is present Selects a rust-toolchain declared RA based on its date. The earliest (oldest) RA wins and becomes the one that the workspace uses as a whole. In terms of precedence: nightly > stable-with-version > stable With stable-with-version, we invoke the RA with a `--version` arg and attempt to extract a date. Given the same date as a nightly, the nightly RA will win. Fixes #17663
We tend to drop support for stable releases somewhat frequently as its difficult to really support more than a handful of rust versions with a rolling release model. This means it becomes the job of the user to pin their rust-analyzer somehow to some version that fits their current roolchain install, that's not ideal. We should offer a setting that when enabled checks for a toolchain override in the workspace and attempts to use its rust-analyzer component if installed when spawning the server.
Addtionally we should probably attempt to let the server know its MSRV and inform the user if their toolchain looks too old.
The text was updated successfully, but these errors were encountered: