-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Fix rust analyzer #911
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
Fix rust analyzer #911
Conversation
Looks good! Thanks for finally solving this long-standing issue. One thing: You've committed your own |
Thanks @diannasoreil all fixed |
I have another solution for this (see my PR #917). |
pub fn get_sysroot_src(&mut self) -> Result<(), Box<dyn Error>> { | ||
let mut sysroot_src = home::rustup_home()?.to_string_lossy().to_string(); | ||
|
||
let output = Command::new("rustup").arg("default").output()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use rustc --print sysroot
instead. This also works when you don't have rustup installed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks I changed this in new pr: #1026
#917 does seem a bit nicer. |
Superseded by #917. |
I'm considering reversing course on this, removing the solution I ended up going with (or at least un-documenting it), and putting this functionality into a new subcommand (e.g. |
Fix
rustlings
exercises to work with rust-analyzer if it's installed.It generates a
rust-project.json
and links to the defaultrustup
toolchain if it exists.If there are any errors e.g.
rustup
orrust-analyzer
don't exist, the fix is skipped with a message saying so.When there is a success it will generate the file and will no longer run.
New argument --skipfix (-x for short) so that the file isn't generated e.g. when developing the main binary you don't want this file in the project root or
rust-analyzer
won't work.Added tests for the functionality.