rust-lang / rust-lang/rust-analyzer

Auto import always top of file

Open
#22,569 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Sometimes in VSCode the rust-analyzer puts my auto-import in the function I am working in rather than at the top of the file. I always want them to be at the top of the file, and I don't believe there is a rust-analyzer setting to configure this, as I played with the available import settings.

So, the desired feature is: auto-import always to the top of file

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 auto-import behavior in VSCode with rust-analyzer, comparing imports inserted at the top of the file with imports placed inside the active function. Start by reviewing the available import settings and the auto-import implementation; done when a supported configuration or behavior consistently places auto-imports at the file top.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.