rust-lang / rust-lang/rust-analyzer

Support for same-prefix uses for merge-imports assist

Open
#3,749 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Follow-up from https://github.com/rust-analyzer/rust-analyzer/pull/3745#issue-394855923

I believe it might be a low-hanging fruit to add support for merging same-prefix uses as pointed out in linked PR:

use foo::Bar;
use foo::*;

transformed into after the assist call:

use foo::*;

There are few concerns I'd like to point out here:

  1. I've not investigated the effort which would have to be done to implement it.
  2. I'm not entirely sure if it's a responsibility of this assist
  3. There might be an edge case where separate use along with wildcard use makes something work(?)

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 reading the linked PR #3745 and locating the merge-imports assist and its existing tests. Check whether the assist owns same-prefix merging and investigate the wildcard-use edge case described here. Done means the assist transforms use foo::Bar; plus use foo::*; into only use foo::*;, with coverage for the relevant behavior.

Written by the indexing model from the issue text.

Assessment

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