rust-lang / rustlings

:crab: Small exercises to get you used to reading and writing Rust code!
https://rustlings.cool
MIT License
53.83k stars 10.13k forks source link

LSP issues because of too many errors #2072

Closed senekor closed 2 months ago

senekor commented 2 months ago

Hello, I'm testing rustlings for a workshop I'm organizing. Version 6 looks like it has a lot of improvements! One of them seems to be that rust-analyzer should work out of the box. However, it seems to be a little overwhelmed. There are so many errors in the workspace that it doesn't show all of them and it seems basically inactive on some exercises. I was able to observe this with the first few "variables" exercises already.

For me, from the perspective of a workshop organizer, there are two options that make sense:

  1. Somehow fix this to ensure the LSP experience is top-notch.
  2. Instruct my students to disable LSP alltogether.

The friction of fiddling around with LSP is enough to leave a bad first impression and suck the fun out of the first few minutes of writing Rust code. At the same time, the terminal output of rustlings is quite decent, making LSP support not absolutely required.

One experiment I've done is to edit the list of binaries in Cargo.toml. That actually works. If I only include the one currently being worked on, LSP is fine. So, it might be possible to have rustlings edit Cargo.toml as the student progresses through the exercises? I'm happy to try to contribute this if you think it could be the right way forward.

mo8it commented 2 months ago

That's weird because I fixed this issue in Rust-Analyzer a month ago: https://github.com/rust-lang/rust-analyzer/pull/17561

Are you sure that you have the latest Rust version 1.80 and that your Rust-Analyzer plugin is up-to-date (in case you use VS-Code)?

senekor commented 2 months ago

Weird. I am using helix with the rust-analyzer from rustup. I know that isn't as up-to-date as the vscode extension. But I'm pretty sure I also tested it with vscodium yesterday, which should've been up-to-date. Anyway, the latest binaries work with helix and vscodium is also working now. Sorry for the false alarm.

By the time my workshop starts, Rust 1.81 should be released and with it a version of rust-analyzer that includes that patch, hopefully.