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

Open
suzmue opened this issue Sep 22, 2021 · 2 comments
Open

x/tools/gopls: multiple "Fill anonymous struct" quick fixes are confusing #48563

suzmue opened this issue Sep 22, 2021 · 2 comments

Comments

@suzmue
Copy link
Contributor

@suzmue 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 this to the Unreleased milestone Sep 22, 2021
@suzmue suzmue removed this from the Unreleased milestone Sep 22, 2021
@suzmue suzmue added this to the gopls/unplanned milestone Sep 22, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Sep 22, 2021

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

@suzmue
Copy link
Contributor Author

@suzmue 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants