rust-lang / rust-lang/rust-analyzer
`completion.addColonsToModule` is always `true` for `crate`, `self` and `super`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
completion.addColonsToModule controls ::-suffix-emitting only for module in a path, but doesn't control same behavior for crate, self and super — they always have the form of "token::". The crate/self/super is a special cases of the module.
Use-case, current behavior
Legend: <|> — cursor position, completions requested by ra ls.
- Call:
cra<|>::module::thing();— completion is alwayscrate::, adds extra path-delimiter, it's a PITA to delete it every time; - Attr:
#[crat<|>::thing]— same as above - Use:
use crat<|>::*— same as above, we'll getuse crate::::*
Expected behavior
Setting completion.addColonsToModule controls crate, self and super in same way as other mod- parts of a path.
So, for completion.addColonsToModule = false expected behavior is:
supe<|>and acceptingsuper-completion, expected final result should besuper;supe<|>::and acceptingsuper-completion, expected final result should besuper::;
rust-analyzer version: rust-analyzer 1.98.0-nightly (57d06900 2026-05-27)
rustc version: rustc 1.98.0-nightly (57d06900f 2026-05-27)
editor or extension: any (VSCode, Gram, Zed, etc..)
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 tracing the completion.addColonsToModule handling for crate, self, and super, then reproduce the call, attribute, and use examples from the issue. Done means the setting controls whether these completions add ::, including the different results when the typed path already ends with ::.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100