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: Bad behavior after updating gopls, duplicated suggestions and unexpected placeholders. #60959
Comments
Thank you for the report. This looks like a regression in unimported completion, however I can't quite reproduce the behavior you're seeing. I don't see the duplicated completion items, for example. I see a couple bugs, which is that we don't populate a placeholder for type parameters, and aren't honoring the usePlaceholders setting. Are you working in GOPATH mode (as it appears from the import path of the dao package)? Does the issue reproduce when you work within a module? |
Sorry English is not my native language so I'm not sure I've quite understanded what "GOPATH mode" means. Project's go.work:
There's nothing about dao in Project's go.mod. Also I've found that only the I'm not sure if I have provided enough information. Please let me know if I can provice anything else. |
Change https://go.dev/cl/506935 mentions this issue: |
Change https://go.dev/cl/506936 mentions this issue: |
I've sent CLs to fix the two problems @findleyr identified in #60959 (comment). I've reproduced the third problem (duplicates) and confirmed that the cause is the presence of test variants in the |
Change https://go.dev/cl/506937 mentions this issue: |
OMG it's Donovan!!!! |
The unimported completions logic added in CL 496596 forgot to add placeholders for type parameters. This change does so, with a test. Updates golang/go#60959 Change-Id: I4af8878787e4a229c47fb9ea85ca6b1d577e4d7b Reviewed-on: https://go-review.googlesource.com/c/tools/+/506935 gopls-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Alan Donovan <adonovan@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This change causes the unimported completion logic to honor the ui.completion.usePlaceholders setting. The tests enable it explicitly. (The disabled behavior was tested interactively.) Updates golang/go#60959 Change-Id: I38a34250a26147d98daaab9ab2eccf11ad877102 Reviewed-on: https://go-review.googlesource.com/c/tools/+/506936 gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Alan Donovan <adonovan@google.com> Auto-Submit: Alan Donovan <adonovan@google.com>
gopls version
go env
What did you do?
First, I have a project in struct like this:
I'm trying to call
dao.GWhereFirst
fromteaching_auth.go
.And I'm sure that
"ui.completion.usePlaceholders"
isfalse
in settings.What did you expect to see?
Regular suggestions, and no placeholders placed when I press ENTER.
And after founding out this issue, I rollbacked gopls to v0.11.0, which runs perfectly:
What did you see instead?
The interesting thing is that if I delete the code generated with "import dao" left, then everything works fine. Just like the gif shows.
Editor and settings
VSCode
settings:
Logs
I've added
-logFile=/Users/miranquil/go.log
togo.languageServerFlag
. But after same operations nothing was written into this file.The text was updated successfully, but these errors were encountered: