rust-lang / rust-lang/rust-analyzer
rust-project.json runnable filtering always selects the first `Run` runnable
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
The filtering of bin runnables from the rust-project.json always selects the first Run runnable. In a project with a lot of runnables, this breaks the Run / Debug integration in VSCode.
rust-analyzer version: 3d2c40d705f5663fccf4a4d89ea457876ac32df6 (2025-08-11)
- In target_spec_for_crate()
runnablesare copied over instead of selected by current crate / build info. This is one place where filtering could be expected. - In runnable_args() the first
RunnableKind::Runis selected. This is another place where filtering could be expected.
Related:
- https://github.com/rust-lang/rust-analyzer/issues/20359
- https://github.com/rust-lang/rust-analyzer/pull/20396 (with this PR the
rust-project.jsongeneration could be simplified. Though the filtering bug would still be present.)
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 tracing runnable_args() in crates/rust-analyzer/src/target_spec.rs and target_spec_for_crate() in crates/rust-analyzer/src/global_state.rs, then read the related issue and pull request for context. Determine how the current crate or build information should select a runnable, and verify that rust-project.json no longer makes VSCode Run/Debug use the first Run runnable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100