Skip to content

Contextually irrelevant snippet completions suggested #19968

Closed as duplicate of#19906
@WhyNotHugo

Description

@WhyNotHugo
> rust-analyzer --version
rust-analyzer 2025.05.19
> rustc -V
rustc 1.87.0 (17067e9ac 2025-05-09) (Alpine Linux 1.87.0-r0)
> nvim --version
NVIM v0.11.1
Build type: MinSizeRel
LuaJIT 2.1.1723681758
``

**code snippet to reproduce**:
```rust
fn main() {
    let s = String::new();
    s.
}

Please the cursor at the end of line s. and trigger auto-completion. rust-analyzer suggests a bunch of snippets: let~ letm, ref~, box~, etc…

When using the "expand" shortcut, these snippets are expanded to things like Box::new(s).

These suggestions don't make sense in this context; if I type s., I expect to see completion for associated function calls, not potential re-writes for this.

The main issue at hand, is that these suggestions (about a dozen) drown out the actually relevant suggestions; one that are consistent to what I've just typed.

These suggestions should only be shown when they are consistent with what one has typed in the code editor.


Somewhat related to #19906, which derailed due to a tangential detail, then locked and my last reply silently discarded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions