rust-lang / rust-lang/rust-analyzer

`completion.addColonsToModule` is always `true` for `crate`, `self` and `super`

Open
#22,479 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-completion C-bug
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 always crate::, 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 get use 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:

  1. supe<|> and accepting super-completion, expected final result should be super;
  2. supe<|>:: and accepting super-completion, expected final result should be super::;

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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.