rust-lang / rust-lang/rust-analyzer
Custom proc macro for test functions no longer provide "Run Test" codelens
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
This regression has been there for quite some time, but I decided to report it only today, sorry...
I remember that at some point this worked and rust-analyzer showed codelens on top of a proc macro attribute that contains test in its signature.
E.g. the following code showed this codelens:

just like it shows it when I switch the proc macro to tokio::test

I even remember reviewing a PR that initially added a heuristic that searches for a substring "test" in the proc macro name to gate the addition of that codelens, but that was a long time ago and I assume this heuristic either gone broken or was changed [un]intentionally.
I suggest we fix this and return that codelens back.
Meta
rust-analyzer version:
rust-analyzer version: 34138379b 2022-02-02 nightly
rustc version:
$ rustc --version --verbose
rustc 1.58.0 (02072b482 2022-01-11)
binary: rustc
commit-hash: 02072b482a8b5357f7fb5e5637444ae30e423c40
commit-date: 2022-01-11
host: x86_64-unknown-linux-gnu
release: 1.58.0
LLVM version: 13.0.0
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
No source file or test is named. Reproduce the custom proc-macro and tokio::test examples, then trace rust-analyzer's Run Test codelens handling for proc-macro attributes; done means the custom attribute receives the codelens again and the regression is covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100