Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Oatall opened this issue Nov 29, 2024 · 3 comments
Open

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

Oatall opened this issue Nov 29, 2024 · 3 comments
Labels
A-completion autocompletion A-salsa might be a salsa issue C-bug Category: bug S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work.

Comments

@Oatall
Copy link

Oatall commented Nov 29, 2024

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.

@Oatall Oatall added the C-bug Category: bug label Nov 29, 2024
@flodiebold flodiebold added the A-completion autocompletion label Nov 29, 2024
@mfontanini
Copy link

mfontanini commented Dec 5, 2024

removed to avoid noise

@flodiebold
Copy link
Member

@mfontanini your bug is #18547. This issue here describes a different problem in the end, which is why I left it open instead of closing as duplicate.

@flodiebold flodiebold changed the title Autocomplete is wrong Ref completions break when the prefix is a keyword (e.g. mod) Dec 5, 2024
@Veykril
Copy link
Member

Veykril commented Dec 5, 2024

Regarding this issue, I think this is caused by our hack for mapiing between the adjusted syntax tree and the original one getting too out of sync. This will likely have to wait on our salsa upgrade + its database forking feature (once thats implemented), that would trivially solve this.

@Veykril Veykril added S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work. A-salsa might be a salsa issue labels Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-completion autocompletion A-salsa might be a salsa issue C-bug Category: bug S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work.
Projects
None yet
Development

No branches or pull requests

4 participants