-
Notifications
You must be signed in to change notification settings - Fork 43
Automatically reload RLS when Cargo.toml changes, or when the git branch changes #98
Comments
I think ide-rust is actually doing as much as it can right now, and this does actually work at the moment to a certain extent. If I comment out a dependency in Cargo.toml, I'll see a red However, the rest comes down to what rls actually does with that. Generally it should try to rebuild the project. There are some issues, for example it's hard for rls to "know" that a path-dependency has changed and it should do a full rebuild but if you change the Cargo.toml it should work. Can you give me some more precise scenarios and we can figure out if they're something we can improve here or over at rls? |
@alexheretic What happens for every project I've worked on is that adding a new crate or modifying an existing one breaks RLS completely. Likewise with changing git branches. It's not able to recover from the changes, so restarting RLS is required to get things working again. Same thing happens with VS Code, too. Having to |
Yep there are definitely times where that's happened to me before too, though I thought mostly with path = ".." dependencies. If I take a simple project add or remove a dependency it seems to work fine, so I think we need concrete steps to reproduce in order to improve here. |
@alexheretic It's happened with every project we have at System76, which are each around the vicinity of 500-15,000 lines of code per project. You're free to clone any of the repos we have, such as Popsicle, Distinst, and debrep. |
We need to nail down proper steps to reproduce before this can be traced to either rls not being notified of a change, or rls not properly rebuilding for some reason. This isn't trivial. I checked out debrep, had two branches one of which I broke by commenting a dependency out. Switching between the branches correctly triggered a rebuild. This also works when Cargo.toml is not open in the editor. |
I think there are some issues around rls modifying Cargo.lock. rust-lang/rls#1020 may improve the situation. |
ide-rust has moved to using rust-analyzer instead of RLS. I'll close this issue for now, please reopen if this still applies to the new stack. |
This has to be done manually at the moment, else erroneous results will occur.
The text was updated successfully, but these errors were encountered: