-
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 suggestion changes to something random once selected #18547
Comments
Doing some light bisection. I have not been able to reproduce with these versions:
With these, I have been able to cause the behavior pretty easily:
|
experiencing this too, on helix as well (but helix master, thought that might be causing it but apparently not), on the last mentioned rust-analyzer version |
same exact problem here |
Same problem on nvim after updating my rust-analyzer. Solution on #18536 did not work for me. neovim version:
rust-analyzer version: |
@SomeoneToIgnore is this issue what was caused by your changes last month? (and hence was this fixed by #18503?). Pinging mainly because I have not been following up on the completions issues that occured while I was away :) |
Yes, this got exposed due to my changes, alas.
While being caused by different approaches, both cases boil down to a microsoft/language-server-protocol#2060 question but that is not answered still. (Also, to me, it's not very clear how the More general context can be found from |
Do both of these editors announce what they are in the handshake? If yes we could temporarily disable resolve support for them within the server. |
Helix does: https://github.com/helix-editor/helix/blob/fc9968bd4bbc5adbcc35bb2fa40515dbb96a3a36/helix-lsp/src/client.rs#L682 I love the approach too, had proposed it in https://rust-lang.zulipchat.com/#narrow/channel/185405-t-compiler.2Frust-analyzer/topic/Completion.20IDs/near/484683744 |
While adding incomplete completion requests to helix (in part as a response to this breakage) I investigated this closer and don't think what you are doing here is spec compliant:
the second point is the most relevant. When a client needs to apply a completion it will send a resolve request to the server (especially if the edit itself needs to be resolved). However, clients do not and cannot wait for incomplete completion list requests to complete at this point:
To demonstrate that this is also how VSCode behaves I have pushed a small demonstrator: d2f69ee
with this change I can observe this issue in VSCode (if you look at the log completions clearly get resolved to the wrong thing), demonstrating that this only works in vscode because the response to incomplete completion responses happens to be handled fast enough (aka a race condition). This makes sense to me because from the clients perspective, I expect the server to really have some stable definition of completion items that does not change between edits (in simple/most cases the label) that allows me to perform a lookup/completion resolve. Instead, You could use a combination of label plus some extra data (for disambiguation) to look up more similar to the old code. You are already shipping the imports along in the item data, that may be sufficient. Otherwise, you could hash some properties of the item with a reasonably collision-resistant hash like sha1 or tenthash |
Frankly if this is that complex I'd prefer to just revert the change. |
what's the pr that merged the changes to the completion so that i can just clone and manually remove the specific changes |
This comment has been minimized.
This comment has been minimized.
Hello everyone! There's been a fair amount of useful discussion but I think it might be best to avoid making statements that might be confused with factual claims about what the spec is or is not, when the ambiguity in the spec might be resolved in a different direction: microsoft/language-server-protocol#2060 This is less about what anyone has said so far here and more about noticing that this has been a tempting distraction in other discussions about this. |
To note, So, while things are being clarified for the spec part, nothing should be broken for the client anymore. |
You are unlikely to grt an answer from the spec anytime soon given past precedence. What I saying is that:
|
Fwiw, r-a does all the eager work whether you enable resolving or not currently, so the only thing that's worse off for clients that don't resolve is that the completion result is bigger in terms of json size. (for now) Also just to clarify I hope you don't take us force disabling completion resolve for helix in a bad intent, it was just the fasted way to get things working for people again for now until we sort this out! |
yeah I understand but with incomplete completion requests that is still a bunch of back and fourth so would still be nice to avoid.
No I actually think that was a good initial response, it stops the flood of bug reports for us and keeps things working for people. So no worries about that! I just wouldn't want things to stay this way permanently (particularly since it's also an issue for vscode). |
@pascalkuthe , I have created a hash proposal impl (thank you for the idea), if you want to double check I'm not doing anything ridiculous there: #18653 |
The newer versions have a faulty rust-analyzer which does not work well with the Helix editor. The auto completion sometimes changes while cycling through them. We need to wait until this is fixed either here helix-editor/helix#12119 or here rust-lang/rust-analyzer#18547
The newer versions have a faulty rust-analyzer which does not work well with the Helix editor. The auto completion sometimes changes while cycling through them. We need to wait until this is fixed either here helix-editor/helix#12119 or here rust-lang/rust-analyzer#18547
The issue with the LSP autocomplete is fixed as mentioned in rust-lang/rust-analyzer#18547
rust-analyzer version: rust-analyzer 1.84.0-nightly (b19329a3 2024-11-21)
rustc version: rustc 1.84.0-nightly (b19329a37 2024-11-21)
editor or extension: helix 24.7 (079f5442)
relevant settings: (eg. client settings, or environment variables like
CARGO
,RUSTC
,RUSTUP_HOME
orCARGO_HOME
)repository link (if public, optional): reproduced in multiple repositories
code snippet to reproduce: working on minimal repro
Since about the past week I have been dealing with an issue where autocomplete suggestions change when I highlight them. This video explains it better:
The video shows the following:
let mut px = PCt
PCtx
PCt
withPCtx
which is expected. However, it deletes the space between=
andPCt
- that is weird.PCt*
PCt
again. RA again suggestsPCtx
PCtx
in the dropdown. RA replaces it correctly this timePCtx
in the dropdown has changed toEither
. This is completely random and makes no sense in the context (though what it suggests does seem to be consistent)PCtx
withEither
My only RA config is pretty minimal:
I am assuming this came from an RA update since it started somewhat recently (past week or two) and Helix hasn't had an update in a few months, but I haven't yet had a chance to see if it still happens with older versions. This problem happens pretty consistently across multiple repos.
Edit: this happens with other kinds of autocomplete suggestions too, it is doing things like changing
some_func
topanic!()
.The text was updated successfully, but these errors were encountered: