-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Autocomplete often fails on new version #6612
Comments
Hello. I've created #6614 that helps the issue a bit. It should be straightforward, here's the completion config: and its field usages show the rest of the places to fix. |
(notice how if you type two characters in rapid succession, autocomplete fails and VSCode reverts to string-based autocomplete) |
This may be related to #6565
…On Tue, Nov 24, 2020, 3:25 PM George Fraser ***@***.***> wrote:
(notice how if you type two characters in rapid succession, autocomplete
fails and VSCode reverts to string-based autocomplete)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#6612 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABBACRHI5ZETHLADXPO7U4LSRQJEXANCNFSM4UAALQVA>
.
|
6631: Gate autoimports begind experimental completions flag r=kjeremy a=SomeoneToIgnore Part of #6612 Adds a possibility to disable autoimports: <img width="598" alt="image" src="https://user-images.githubusercontent.com/2690773/100156673-f8037f80-2eb1-11eb-8e74-59ebe4260ba3.png"> and other experimental completions we might want to add later. Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
We've added a feature toggle to the latest nightly: #6631 It's on by default, since there is not that much feedback on the completion issues, I've decided to leave it on by default. |
Great news! Thank you, I appreciate that a lot! @georgewfraser in the meantime, until monday (unless you want to go nightly) -- you can revert the client in VSC trivially. go to the extensions panel and then right click on Rust Analyzer, and then you can change version back to last monday. However, you'll probably (not sure on the backend here) need to replace the rust-analyzer rust binary. To replace that, you'll probably need to go to the releases tag here in this repo, and download the exe (or compile it yourself) and then give the path to it in your preferences in VSC as an override for the server location. It sounds more complicated than it is; it's really just replacing a file. |
Going along with this idea here -- why do I, and the other person in this thread, sometimes get no results when we're typing? How does that RA handle that? Is there effectively some amount of time x that it will give to answer the query and then will fail? I was imagining that auto-imports, because it's necessarily a "fuzzy" operation, aren't as important as current imports. Would it be possible to suggest what RA suggested last week (the ones already in scope), and then, if there's enough time/performance is good enough, also gather the auto-imports? Apologies if this is already what you do, or this has already been thought. I'm only a user and not a contributor, so I'm sorry if I'm overstepping a bit |
That can be caused by multiple issues, a few ideas from me:
I don't have a real-world example now, but something like this (where fn test() -> Result<(), ()> {
let a = ha<|>
Ok(())
} can confuse RA, since it considers I'm afraid I cannot get more specific without any MRE that does not work for you.
We do something similar with fuzzy imports already: first (and always) we fill in the "regular" completions, the ones that were before the new feature, then we add the fuzzy ones to the same suggestion set. |
@SomeoneToIgnore does rust-analyzer have performance benchmarks to detect regressions? If not, I might be interested in setting that up...I've contributed before, in the syntax colorization area. |
It does, but they mostly track batch analysis, not interactive usage. |
@SomeoneToIgnore that makes a lot of sense. I'm about to hop onto some rust work now, and I'll try to give you repro |
Okay, so I don't have too much to add except that it's like #6612 (comment) has described. If I input a single character, and then wait, the autocomplete from the RA will eventually come up. (by eventually, I mean in the range of several hundred miliseconds -- not like, seconds or minutes or anything crazy. it's still pretty fast, all things considered!). If I press a second key before the RA returns results and VSC displays them, the whole operation fails and I just see the default text based results. This happens on a variety of projects, and doesn't seem dependent on any code features. @SomeoneToIgnore I think you were right on the money with your first guess in #6612 (comment) I can give you a video, but it looks identical to the above video. |
Does reverting #6565 help? |
6614: Improve autoimports on completion speed r=matklad a=SomeoneToIgnore Presumably closes #6594 May help #6612 * Ignore modules eaferly * Do less completion string rendering 6632: Pin cargo_metadata r=matklad a=kjeremy See: oli-obk/cargo_metadata#142 (comment) Co-authored-by: Kirill Bulatov <mail4score@gmail.com> Co-authored-by: kjeremy <kjeremy@gmail.com>
I've profiled the completion more and the main impact on the completion currently seems to be the completion change rendering (the one with the autoimport): trace
The The trace lenght looks suspiciously big for a plain import statement insert and most probably it can be optimised further, but the So I'll work on #6366 next and try to come up with something working eventually. |
6706: Move import text edit calculation into a completion resolve request r=matklad a=SomeoneToIgnore Part of #6612 (presumably fixing it) Part of #6366 (does not cover all possible resolve capabilities we can do) Closes #6594 Further improves imports on completion performance by deferring the computations for import inserts. To use the new mode, you have to have the experimental completions enabled and use the LSP 3.16-compliant client that reports `additionalTextEdits` in its `CompletionItemCapabilityResolveSupport` field in the client capabilities. rust-analyzer VSCode extension does this already hence picks up the changes completely. Performance implications are descrbed in: #6633 (comment) Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
We've landed the performance improvements, will be in the next nightly tomorrow and the next stable in 6 days. I'm inclined to close this issue, unless something ugly pops up during your tests: current set-up seems to be relatively optimised and the main performance issues that we have now are isolated in a separate request, not in the completion proposal step. |
@SomeoneToIgnore Just checked it out! I think the perf improvements are excellent, but I was disappointed to see the loss of the flag to prevent this feature. This is related to sorting imports -- right now, there are just so many imports that I get. I much prefer imports being limited to what's in scope. Could that feature flag stay in the RA? |
Apologies -- then nevermind. I am going to leave it to you to close the issue, when you're satisfied, but I'm very very pleased with this. My little mac can run the RA no problem now! |
It still at least feels a tiny bit laggier with the option active, but the auto completions do now show up at all, so for me the problem is resolved as well. |
There're definitely things to improve later, performance wise too, but let's close this, since the majority of the original responders are happy now. Thank you for the vigilance. |
I've been using a custom build of rust-analyzer for the last couple weeks, which reverts autocomplete-imports, and I tried the latest version today, with |
With this setting, not much left of the feature itself, it would be great to receive a trace of what's slow for you, you can do in the way described in #6633 Before that, you can carry out a few experiments instead, if you prefer.
|
I tried out the latest master again for the last few days, with "rust-analyzer.completion.autoimport.enable": false, and I am still seeing this bug, and the performance is still quite bad in some files. I will make a reproduceable test case at some point, I just haven't gotten to it yet. |
I have tested on a large project |
@iamwwc feel free to file a new issue, especially if your project is public. |
Hello!
Right now, having just upgraded the RA -- autocomplete often appears to fail to successfully return results while typing normally. If I hit escape, and then resume typing, it will find autocomplete solutions, though it appears slightly laggy.
I am running on a relatively slow, laptop processor, runnings VSCode, and the most recent version of the RA (the one released just a few hours ago).
I can take a video if that would help?
The text was updated successfully, but these errors were encountered: