rust-lang / rust-lang/rust-analyzer
`buildBeforeRestart` does not trigger rebuild of project in tests
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: rust-analyzer version: 0.3.2228-standalone (fa4a40bbe8 2024-12-22)
rustc version: rustc 1.83.0 (90b35a623 2024-11-26)
editor or extension: VSCode
relevant settings:
{
"rust-analyzer.debug.buildBeforeRestart": true
}
code snippet to reproduce:
// Run Test | Debug
#[test]
fn my_test() {
...
}
Description of the Issue:
When debugging a Rust test in VSCode by clicking the "Debug" button above the test function, and then subsequently hitting the "Restart" button in the debug controls, rust-analyzer does not appear to recompile the code. This means that if changes have been made to the code since the initial debug launch, those changes are not reflected when the debug session is restarted.
The rust-analyzer.debug.buildBeforeRestart setting is set to true, which according to the documentation, should trigger a rebuild before restarting a debug session. However, this is not the observed behavior.
Steps to Reproduce:
- Have a Rust project with a test function like the example provided.
- Ensure
"rust-analyzer.debug.buildBeforeRestart": trueis set in your VSCode settings (preferably workspace settings). - Click the "Debug" button above the test function to start a debug session.
- Make a change to the code that would affect the test's execution
- Click the "Restart" button in the debug controls.
- Observe that the debug session starts without recompiling the code, and the changes made in step 4 are not reflected in the restarted debug session.
Expected Behavior:
When the "Restart" button is clicked during a debug session, and rust-analyzer.debug.buildBeforeRestart is set to true, rust-analyzer should trigger a recompilation of the project before starting the new debug session, ensuring that the latest code changes are included.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the VSCode test-debugging flow with rust-analyzer.debug.buildBeforeRestart enabled, then trace the setting's handling through the debug restart path. Done means restarting a debug session recompiles the project and uses changes made after the initial launch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100