Skip to content

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

@boozook

Description

@boozook

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions