-
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
WIP: Improve completion performance through caching #11269
Conversation
The caching system mostly works with mainly method completions. |
c5a8c54
to
5b4fe7f
Compare
The main reason tests are failing is the lack of automatic imports. The automatic import is still working in VSCode. |
TIL, I always thought that was required for completion resolving but turns out it isn't. I wonder if would make sense That aside, have you benchmarked this(via manual testing), that is has this improved out completion times noticably? This adds a lot of complexity and I believe this currently won't improve completion times too much given most of our issues come from salsa query revalidation. This will also behave rather oddly with flyimport completions given how they currently work I believe, we only kick these off at 3 characters typed as it is right now, and afterwards we can get new completions as we cap the maximum number of flyimport completions we generate, so this cache will limit our completion capabilities quite significantly in this regard. So while we definitely do want to do some form of caching at some point, given how flyimport currently works for us I am not sure if this is feasible at the moment. |
This implementation of caching does feel pretty hacky.
The main purpose of the caching is to prevent typing from causing the completion to "reset". For example, in VSCode, typing a single letter would cause the extension to "recalculate" the completions, which would cause VSCode to stop showing the completions after typing (since the second letter is typed before the calculation finishes). The caching would re-emit the previously calculated completions which would allow VSCode to continue showing the completions. I've also tried Rust development in CLion (using IntelliJ Rust) and GNOME's Builder (using rust-analyzer). Both of these editors appear to perform this type of caching on the client side (the backend will only perform the calculation a single time after typing |
what is Caching |
37b6d46
to
d270152
Compare
I've been trying different attempts. I will close this for now. |
Contains very poorly written code.
#7542