rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.31k stars 1.62k forks source link

Cancel Clippy/Check When Running Test #18515

Open arendjr opened 6 days ago

arendjr commented 6 days ago

When using VS Code, I regularly find myself in a workflow where I'm writing tests, making adjustments, and running the tests. In this scenario I regularly find myself in a situation where my test run is temporarily blocked by Cargo because a cargo check or cargo clippy is still running.

If my understanding is correct, both the request for running the test and the request for Clippy is submitted by Rust Analyzer. Would it be possible for Rust Analyzer to prioritize the test run so I don't have to wait for Clippy to finish first? I would even be content if it means killing the Clippy request and restarting it when the test run is complete.

Giga-Bowser commented 4 days ago

For what it's worth, in VS Code you can fix this by adding "rust-analyzer.server.extraEnv": { "CARGO_TARGET_DIR": "target/rust-analyzer" } to your settings.json. This will make rust-analyzer use a separate target directory, which does waste disk space, especially on larger projects, so I wouldn't be opposed to a better solution as a feature.

arendjr commented 4 days ago

Thanks for the suggestion, but unfortunately it doesn't seem to work with the project I'm working on. There's a custom build.rs responsible for building C dependencies and it makes some assumptions about the layout for the target directory which are broken if I do this...