-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/tools/gopls: test completions duplicates text #56852
Comments
CC @pjweinb |
That sounds right, the selection range for this type of completion is set here. I think we would welcome a patch. |
Change https://go.dev/cl/453335 mentions this issue: |
@jamalc I opened a CR, maybe you can assign me. Let me know if there is anything else to consider issue-wise. |
I stumbled across another problem when my test failed in go <= 1.16. With older versions of go, most of the completions here will not add function parameters.
From go 1.17.1 and later
but in go 1.16.15 or earlier,
Any advise on how to approach this would be most welcome. edit: For now I just added a |
Thanks for filing this issue, and sending a fix. Per discussion at #57384 (comment), I think what gopls does is technically correct, but as it appears multiple LSP clients disagree, we should do something like the associated CL. |
Err, I just tested this in VS Code and it is broken: The inserted text I get is this:
Reassigning to pjw to investigate. |
Correction: it works as expected if typing |
Oh that's not good. I see the same problem in my editor before and after the patch. pjw probably has things covered but let me know if I can assist in fixing this. edit: I installed VSCode (1.73.1) and got similar wonky results with and without gopls patched. I tried to make extra sure that VSCode was using my latest local Go installed |
Yep, I think I only noticed it as I was re-testing the feature. May have existed for a while. In that case, I'll open a separate bug. |
Hi,
I have the same problem as @vadimi reported here: emacs-lsp/lsp-mode#3699
In brief, when editing a test, writing
suggests the completion
but when goign through with that completion the actual result is
If my fault tracing is correct, I would like to make a patch for this.
gopls version
go env
What did you do?
I tried finding the root cause and think it can be condensed into this unit test:
which fails with
Since the completions
TextEdit
has start == end, the suggestion is just inserted.Editor and settings
Logs
Emacs logs the interaction like this:
The text was updated successfully, but these errors were encountered: