rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
13.68k stars 1.5k forks source link

Ability to quality all imports for a given import #17209

Open jun-sheaf opened 3 weeks ago

jun-sheaf commented 3 weeks ago

When working with a large codebase with many different types, types often need to be aliased or partially/fully qualified to distinguish it from a different type of the same name.

For example,

use geo::Point;
use a::b::generated::Point;

let x: Point; // Eh? Which one?

User flows

This issue proposes the following flow:

Replace use with qualified path

For qualifying a useed type, one would:

  1. Right-click a used type.
  2. Click "Replace use with qualified path".
  3. Observe that all imports are fully qualified.