-
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
autocompletion results occasionally fail to show if one types too fast #12153
Comments
Presumably this is #7560; you could try the settings mentioned in #7560 (comment). |
The suggestions help, but are not a total panacea. For example: Screen.Recording.2022-05-05.at.10.26.49.AM.movThat is, if a completion list is already being shown as via a trigger character ( In this case, I again see that completions were canceled, e.g.
Do you know if this is a limitation of rust-analyzer, or is it in VSCode's LSP implementation? (Who is cancelling the request here?) |
We are, there's a related discussion here. |
Is that discussion public? It looks like it just brings me to the set of recent topics. (It's my first time using Zulip; forgive me if I'm missing something) For this particular context, I think it should be okay to serve the completion request if the only document changes are insertions of "identifier" characters at the cursor position (ie: it looks like the user is typing the name of a method / symbol). |
Sorry, can you try https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/LSP.20cancellation instead? |
Following up from the discussion, some other things to note: The issue reproduces quite a bit more readily in debug builds of rust-analyzer; presumedly, because the language server is now quite a bit slower. That is, it's a lot easier to modify the document while rust-analyzer is servicing a completion request, and so trigger the behavior described here. It seems like completions are normally requested on every keystroke -- but only if there isn't already a pending completion request. In other words, the following sequence of events is pretty common:
This gives the following trace:
(Note: sometimes, I also see an interleaving The fact that VSCode never asks for new completions following the document modification makes me think (assuming the behavior is intentional) VSCode would've been happy with a response from the original completion request, and expects the language server to handle or recover from the case where there are some interleaving document edits. |
Awesome!! Thank you @Veykril :-) |
rust-analyzer version: rust-analyzer version: 5dce1ff 2022-05-02 stable
rustc version: rustc 1.60.0 (7737e0b5c 2022-04-04)
relevant settings: (not sure if anything relevant here?)
The following uses VSCode For example, with the code:
If you type
un
quickly (e.g. to trigger completions forunwrap()
and friends), on occasion, relevant completion results will fail to show:Screen.Recording.2022-05-04.at.12.30.34.PM.mov
It's not clear to me if this is an issue in rust-analyzer, VSCode, or something else -- please let me know.
From what I can see in the trace logs, it seems like the language server is receiving a
textDocument/didChange
notification just after the completion request, and that's causing the language server to give up when producing completion results:I'm not sure what the best option here is, but the user experience is a little unfortunate. Could rust-analyzer provide completion results relevant for
x.
regardless, and rely on the front-end to filter the completion results as appropriate?For what it's worth, it seems like the completion results in
x.u
produced by rust-analyzer include all relevant methods on thex
object; not just those with au
prefix. So presumedly, VSCode is responsible for filtering the completion results produced byrust-analyzer
anyhow, so it could still feel comfortable producing completion results even if the document were modified after the request was received?VSCode version:
The text was updated successfully, but these errors were encountered: