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: add type parameters/placeholders in function calls #51544

Closed
rkfg opened this issue Mar 8, 2022 · 2 comments
Closed

x/tools/gopls: add type parameters/placeholders in function calls #51544

rkfg opened this issue Mar 8, 2022 · 2 comments
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

@rkfg
Copy link

rkfg commented Mar 8, 2022

I'm using gotip and gopls@latest build with it. When completing generic functions gopls omits type parameters. If possible it would be nice to add placeholders for the user to fill.

Test case:

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

func NewSyncMap[K comparable, V any]() (result *SyncMap[K, V]) {
	return
}

func main() {
	sm := NewSyncMap()
}

I expect NewSyncMap in main to complete as NewSyncMap[K, V]() with K and V being highlighted placeholders that I can edit and switch between them with Tab (like in snippets). I don't know if it's possible in gopls but for now I need to go back and type [type1, type2] manually which is slightly annoying.

@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 Mar 8, 2022
@gopherbot gopherbot added this to the Unreleased milestone Mar 8, 2022
@findleyr
Copy link
Contributor

findleyr commented Mar 8, 2022

Thanks for the issue!

I agree that this would be helpful, we'll prioritize it.

@findleyr findleyr modified the milestones: Unreleased, gopls/v0.8.1 Mar 8, 2022
@gopherbot
Copy link

Change https://go.dev/cl/390854 mentions this issue: internal/lsp: add snippet completion for function type parameters

@golang golang locked and limited conversation to collaborators Mar 9, 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