Rust-analyzer can barely import anything

Hi, I'm helping someone learn Rust. They are currently going through the book and they are complaining about how annoying it is that you need to write out the imports all the time. At which point I told them that their rust-analyzer should be doing that automatically... And apparently all of rust-analyzer is working for them, except any auto importing. Neither the code lens that lets r-a auto import an item nor the extended auto completions that do the auto importing seem to appear:

They tried commenting out all their VSCode settings and it still doesn't seem to work.

Have they installed r-a through rustup or their editor? I know there was an issue a little bit ago regarding imports, which could plausibly still be around on rustup.

This is most likely due to the println usage in that code. There was a bug with macros in scope regarding this which got fixed yesterday, see No autoimports in functions with macros · Issue #8519 · rust-analyzer/rust-analyzer · GitHub and Fix some find_path bugs around inner items by jonas-schievink · Pull Request #8587 · rust-analyzer/rust-analyzer · GitHub. This should be fixed on the current RA nightly/next stable.

Thanks that seemed to be it. :slight_smile: