rust-lang / rust-lang/rust-analyzer

Custom proc macro for test functions no longer provide "Run Test" codelens

Open
#11,396 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-ide C-bug
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:
image

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

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.