rust-analyzer
rust-analyzer copied to clipboard
Autocomplete / code hints not working on variable names
I lose auto-complete on some variable names when trying to access the variable from multiple threads and loops. Unfortunately, I couldn't replicate it in a bare minimum example however I made a short video with the bug. The code still runs fine.
https://youtu.be/OPDkgGOr78o
Thank you very much for your time!
It's very tedious to look at a video and try to reproduce this issue. If you can minimize the repro and post the code, it would help the maintainers fix this issue.
fn main() {
let mut xx = 0;
if xx { //autocomplete does not show up for variable name "xx"
//first type if, then type x, wait for autocomplete to popup... it will not show "xx"
// now try with original rust-lang support on, it will popup correctly after typing just "x"
}
}
Thank you
Looks like this happens in general after typing if
(note the space), similar for while
. This seems to be an issue with snippets?
@Veykril Hi! Thanks for making it actionable! Also if you get a chance the video is only 1 min 33 seconds and illustrates the problem very well :)
I am still a noob in rust and programming in general, I'm not sure what a snippet is?
Thank you for the consideration, have a good day
If you type out if
you'll see completions like the following
The
if let
completion there is a snippet (it can set your cursor to a position and pre-select text after invoking the completion). To me it looks like this plays weird with completions afterwards, since typing xx
will make the completions show again for me afterwards.
I am currently in the middle of refactoring large parts of the completions code base after which I can look into this.
If you get a minute, check the video I uploaded, it also occurs without the if statement or keywords in some cases. I haven't determined what is causing that but maybe once you see the video it will make sense to you guys?
@Veykril This doesn't happen in Emacs, btw. (The if let
and while let
snippets don't work correctly though -- they replace if <|>
by if if let ...
)
@frozenranger I don't think your small example is the same problem as in your original video. Maybe try gradually removing code from the example in the video and seeing how that changes the results?
@flodiebold ok I will try that. Hopefully I can isolate the issue better. Thanks for watching the video :) I noticed a few views so that's great!
Looking into this, this seems to be a bug in VSCode. When
(space) is entered it does not re-request the completion list and keeps the old one, then on the next character input press it still does not re-request completions
Is this also related to not seeing certain variable names depending on how far away that variable name is? Sometimes when there are large amounts of code, autocomplete does not find the previous variables used? Thank you
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Lukas Wirth @.> Sent: Thursday, July 28, 2022 10:18:10 AM To: rust-lang/rust-analyzer @.> Cc: frozenranger @.>; Mention @.> Subject: Re: [rust-lang/rust-analyzer] Autocomplete / code hints not working on variable names (Issue #12557)
Looking into this, this seems to be a bug in VSCode. When (space) is entered it does not re-request the completion list and keeps the old one, then on the next character input press it still does not re-request completions
— Reply to this email directly, view it on GitHubhttps://github.com/rust-lang/rust-analyzer/issues/12557#issuecomment-1198204701, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AL54ENXWHEKW74IS3MNXOCLVWKJCFANCNFSM5ZA4CMZA. You are receiving this because you were mentioned.Message ID: @.***>
No, that's something else.
Awesome! Thanks everyone :) looking forward to seeing the next push!
On Fri, Jun 17, 2022, 6:09 PM Lukas Wirth @.***> wrote:
If you type out if you'll see completions like the following [image: image] https://user-images.githubusercontent.com/3757771/174407065-66d890d0-9084-4f81-998b-f179c4cf47ef.png The if let completion there is a snippet (it can set your cursor to a position and pre-select text after invoking the completion). To me it looks like this plays weird with completions afterwards, since typing xx will make the completions show again for me afterwards. I am currently in the middle of refactoring large parts of the completions code base after which I can look into this.
— Reply to this email directly, view it on GitHub https://github.com/rust-lang/rust-analyzer/issues/12557#issuecomment-1159265560, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL54ENR7LDMVO2XXEK5NSRTVPTZR5ANCNFSM5ZA4CMZA . You are receiving this because you authored the thread.Message ID: @.***>