rust-lang / rust-lang/rust-analyzer
rust-analyzer.references.excludeTests should exclude `#[cfg(test)]`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
#16441 added an awesome new feature to "Find References" to let you ignore tests, and #18212 extended that to "Show call hierarchy" as well.
The goal of this is to help you find where a symbol is used in non-test code. However, the implementation only looks for #[test], and not for #[cfg(test)]. It would be more helpful if this feature also let you skip your test-only test support functions that are not themselves tests: blocks annotated with #[cfg(test)].
@Young-Flash, the author of that PR, agrees: https://github.com/rust-lang/rust-analyzer/pull/16441#issuecomment-2503947097
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 with the Find References and Show call hierarchy entry points controlled by rust-analyzer.references.excludeTests, and trace how #[test] items are filtered. Add equivalent handling for #[cfg(test)] blocks, then verify that both features omit test-only references when the setting is enabled.
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