Skip to content

Ref completions break when the prefix is a keyword (e.g. mod) #18572

Open
@Oatall

Description

@Oatall

rust-analyzer version:
rust-analyzer 0.3.2196-standalone (327ab29 2024-11-24)
and nightly: rust-analyzer 0.4.2200-standalone (ab44866 2024-11-28)

rustc version:
rustc 1.83.0 (90b35a623 2024-11-26)
1.82 also

editor or extension:
VSCodium + rust-analyzer-no-server.vsix (friend: VSCode + ? This bug also exists)

relevant settings:

repository link (if public, optional):

code snippet to reproduce:

use std::{fs::File, io::{BufReader, Read}};

fn main() {
    if let Ok(file) = File::open("bug.txt") {
        let mut reader = BufReader::new(file);
        let mut mod_info = String::new();
        reader.read_to_string();
    }
}

When I use helix, I encountered the bug #18547,
Image
I switched to VSCodium, it's Ok. I think that bug may be Helix's bug. Not working properly with new version of RA.

But now I encountered this bug, I think this bug may be RA's bug.
Image
When I type mod and then select &mut mod_info and confirm, it becomes mod&mmod_info
code snippet to reproduce is above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-completionautocompletionA-salsamight be a salsa issueC-bugCategory: bugS-blockedStatus: marked as blocked ❌ on something else such as an RFC or other implementation work.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions