rust-lang / rust-lang/rust-analyzer

Feature Request: Custom auto-import order

Open
#13,960 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-config C-feature E-has-instructions
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

My favour is the following order, sorted by priority.

  1. Sub module
  2. Super module
  3. Current crate
  4. Workspace crates
  5. std/alloc/core items
  6. External crates

However, the current auto-import feature enforces a built-in order which I cannot adjust.
https://rust-analyzer.github.io/manual.html#auto-import

It would be better if I don't have to reorder imports manually.

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 with the auto-import section of the rust-analyzer manual linked in the issue and trace how its built-in ordering is implemented. Define how users would configure the requested priority order, then verify that submodules, super modules, the current crate, workspace crates, standard-library items, and external crates are ordered accordingly.

Written by the indexing model from the issue text.

Assessment

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