rust-lang / rust-lang/rust-analyzer
Auto Import not working with `derive_more` proc macros
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
This is not a duplicate of #6183 because
- the import resolves.
procMacro.enableis set totrue.
rust-analyzer version: 0.3.1983-standalone (7852a4c77 2024-06-02)
rustc version: 1.78.0 (9b00956e5 2024-04-29)
editor or extension: VSCode
relevant settings:
"rust-analyzer.completion.autoimport": true"rust-analyzer.procMacro.enable": true
to reproduce:
- Create a new library crate project with dependencies
derive_moreandparse-display. - In
lib.rs, define the following struct:
struct Example(i32);
- Add
#[derive(Display)]on the line above. While typing, observe that Auto Import correctly suggestsparse_display::Display. Remove the derive attribute. - Add
#[derive(From)]on the line above the struct definition. While typing, observe that Auto Import does not suggestderive_more::From. - To fix the error, replace
Fromwithderive_more::From. Observe that the macro resolves and the code compiles.
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 behavior in a new library crate using lib.rs, the derive_more and parse-display dependencies, and the listed rust-analyzer settings. Compare completion for parse_display::Display with derive_more::From, then trace the auto-import handling for proc-macro derives; done means derive_more::From is suggested while proc macros are enabled and the existing reproduction still compiles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100