rust-lang / rust-lang/rust-analyzer

"Replace qualified path with use" not offered on qualified derives

Open
#10,613 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Example:

#[derive(serde::Deserialize)]
struct Foo {}

When the cursor is on Deserialize and I open the assist menu, I would expect a "Replace qualified path with use option" that updates the code to

use serde::Deserialize;

#[derive(Deserialize)]
struct Foo {}

and updates any other uses of serde::Deserialize (both the derive macro & trait) in the same file to just Deserialize.

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

Reproduce the example in rust-analyzer and trace the assist-menu handling for qualified paths, focusing on derive macro and trait paths. Done means the assist is offered for serde::Deserialize, inserts the use declaration, shortens the derive, and updates other matching uses in the same file.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Feature
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.