Skip to content
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: multiple "Fill anonymous struct" quick fixes are confusing #48563

Closed
suzmue opened this issue Sep 22, 2021 · 3 comments
Closed
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@suzmue
Copy link
Contributor

suzmue commented Sep 22, 2021

What version of Go are you using (go version)?

$ go version
go version go1.17.1 darwin/amd64
$ gopls version
golang.org/x/tools/gopls v0.7.2
    golang.org/x/tools/gopls@v0.7.2 h1:kRKKdvA8GOzra8rhSFDClOR7hV/x8v0J0Vm4C/gWq8s=

When the cursor is inside multiple anonymous structs, the quick fixes for "Fill anonymous struct" do not differentiate between the two.

Screen Shot 2021-09-22 at 4 12 32 PM

This is confusing, as its impossible to tell which is for which struct.

What did you expect to see?

I would expect to see more detail about the anonymous structs or only a single "Fill anonymous struct" quick fix.

Example:
Screen Shot 2021-09-22 at 4 14 01 PM

@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Sep 22, 2021
@gopherbot gopherbot added this to the Unreleased milestone Sep 22, 2021
@suzmue suzmue modified the milestones: Unreleased, gopls/unplanned Sep 22, 2021
@gopherbot
Copy link

Change https://golang.org/cl/351591 mentions this issue: internal/lsp: add fields to anonymous struct info

@suzmue
Copy link
Contributor Author

suzmue commented Sep 22, 2021

This is related to #42818, but this issue addresses a more specific issue with anonymous structs.

gopherbot pushed a commit to golang/tools that referenced this issue Sep 24, 2021
Anonymous struct quick fixes should provide more information on
which struct they will fill. This adds the first fields of an
anonymous struct to the fill title.

Updates golang/go#48563

Change-Id: I42cee2e8b1b9405ac2e2e8cfb8deb2c7710c3056
Reviewed-on: https://go-review.googlesource.com/c/tools/+/351591
Trust: Suzy Mueller <suzmue@golang.org>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
@suzmue
Copy link
Contributor Author

suzmue commented Dec 22, 2021

The quick fixes now include the first couple of fields for each anonymous struct to help differentiate between structs.

@suzmue suzmue closed this as completed Dec 22, 2021
@golang golang locked and limited conversation to collaborators Aug 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants