rust-lang / rust-lang/rust-analyzer

Extract Module assist misses usage of "ignored" attribute macro

Open
#14,993 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-assists C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

When extracting a module that uses #[async_trait], the async_trait import is not carried over to the extracted module (or removed from the parent if it's not otherwise used). This seems to be related to having that crate "ignored" such that IDE features work better within trait definitions and impls annotated with it.

rust-analyzer version: 0.4.1542-standalone
rustc version: 1.71.0-beta.1 (eff24c06d 2023-05-29)
relevant settings:

"rust-analyzer.procMacro.ignored": {
    "async-trait": [
        "async_trait"
    ]
},

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

Start by reproducing the Extract Module assist with an #[async_trait] use and the shown rust-analyzer.procMacro.ignored setting. Trace how the assist handles the async_trait import in the extracted module and parent; done means the import is carried over or removed when no longer used.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.