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: include receiver type parameters when completing receivers #50684

Closed
findleyr opened this issue Jan 19, 2022 · 6 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

@findleyr
Copy link
Contributor

Reported in #50623 (comment): when completing generic receivers, we omit receiver type parameters. It would be helpful if we could include them, with placeholders, rather than force the user to type them every time.

@findleyr findleyr added this to the gopls/v0.8.0 milestone Jan 19, 2022
@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 Jan 19, 2022
@gopherbot gopherbot modified the milestones: gopls/v0.8.0, Unreleased Jan 19, 2022
@rkfg
Copy link

rkfg commented Jan 19, 2022

Thank you! A test case to demonstrate the issue:

type SyncMap[K comparable, V any] struct {}

func (s *Syn

Here gopls completes to SyncMap and I expect it to be SyncMap[K, V]

@pjweinb
Copy link

pjweinb commented Jan 22, 2022

"A parameterized type may also have methods associated with it. In this case, the method receivers must declare the same number of type parameters as present in the parameterized type definition." from the draft language definition confirms that this is the right choice.

@gopherbot
Copy link

Change https://golang.org/cl/380354 mentions this issue: internal/lsp: include receiver type parameters when completing receivers

@rkfg
Copy link

rkfg commented Feb 1, 2022

I'm not sure if I do something wrong but this doesn't completely fix the bug. I'm testing it in VS Code. Yes, it now says SyncMap[K,V] in the popup but when I confirm this completion I only get SyncMap without type parameters:
record

@pjweinb
Copy link

pjweinb commented Feb 1, 2022 via email

@pjweinb
Copy link

pjweinb commented Feb 1, 2022 via email

@rsc rsc unassigned pjweinb Jun 22, 2022
@golang golang locked and limited conversation to collaborators Jun 22, 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

4 participants