rust-lang / rust-lang/rust-analyzer
Flyimports (auto-imports) not working for modules
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
use declarations are not being automatically updated on selection of a module completion, even when the completion text includes (use ...). (additionalTextEdits is missing in the completionItem/resolve response.)
Reverting 379a1307aaf95736eecea8613ce3d408838d2ce8 (#22386) fixes this issue, but presumably the best fix would be something else.
rust-analyzer version: compiled locally from latest master (82f6a61ac038e327cfc655b2a6f0a309e6b5887c)
rustc version: rustc 1.95.0 (59807616e 2026-04-14)
editor or extension: Emacs (lsp-mode)
relevant settings: n/a
repository link (if public, optional): n/a
code snippet to reproduce:
fn main() {
// Place cursor at the end of the next line, activate completion, and select the `std::os` completion. `use std::os;` should be inserted but is not.
os
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the completionItem/resolve behavior changed in commit 379a1307aaf95736eecea8613ce3d408838d2ce8 (#22386), focusing on why additionalTextEdits are absent. Reproduce the issue with the provided Rust snippet and verify that resolving the std::os completion returns the edit and inserts use std::os; when selected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100