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: fix autocompletion of structs in slices #33211

Closed
WOo0W opened this issue Jul 22, 2019 · 3 comments
Closed

x/tools/gopls: fix autocompletion of structs in slices #33211

WOo0W opened this issue Jul 22, 2019 · 3 comments

Comments

@WOo0W
Copy link

@WOo0W WOo0W commented Jul 22, 2019

go version

go version go1.12.5 windows/amd64

gopls version

version v0.1.3, built in $GOPATH mode

On VSCode:
This seems OK (ctrl + space):
image

After deleted &cli.Command before Name:, press ctrl + space:
image

It will not show the completions of the struct. It should show completions like the first one.

@gopherbot gopherbot added this to the Unreleased milestone Jul 22, 2019
@gopherbot gopherbot added the gopls label Jul 22, 2019
@stamblerre stamblerre changed the title x/tools/gopls: Auto completion not working in this situation x/tools/gopls: autocompletion of structs in slices Jul 22, 2019
@stamblerre stamblerre changed the title x/tools/gopls: autocompletion of structs in slices x/tools/gopls: fix autocompletion of structs in slices Jul 22, 2019
@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Jul 22, 2019

Thank you for reporting this issue. We will investigate.

@ajjensen13

This comment has been minimized.

Copy link

@ajjensen13 ajjensen13 commented Aug 29, 2019

Hey! I'm looking for a good way to start contributing to the Go project. I spent a little time looking into this issue. It appears that the root of the issue is that it is a slice of pointers, which confuses the code in completion.go:enclosingCompositeLiteral(). The suggestions work correctly if it is a slice of structs (not pointers to structs).

I'll try to put together a fix for this unless someone does first.

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Aug 29, 2019

Change https://golang.org/cl/192277 mentions this issue: gopls: fixes completion for pointers to structs in slice literals

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
4 participants
You can’t perform that action at this time.