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: improve completion for variadic params #34334

Closed
muirdm opened this issue Sep 16, 2019 · 2 comments
Closed

x/tools/gopls: improve completion for variadic params #34334

muirdm opened this issue Sep 16, 2019 · 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

@muirdm
Copy link

muirdm commented Sep 16, 2019

In cases like this:

foo := func(...string) {}
var myStr string
foo("hi", <>)

we should prefer "myStr" since we know we are completing an individual string.

Also, we should add "..." to variadic completion items:

foo := func(...string) {}
var myStrs []string
foo(mySt<>) // complete to "myStrs..." instead of just "myStrs"

Consider whether we should do it for cases like this:

foo := func(...interface{}) {}
var myIntf []interface{}
foo(myIn<>) // should this complete to "myIntf..." or just "myIntf"?

Personally I think it should still expand in this case to myIntf... because that is more likely what you want vs passing the []interface{} as the first variadic interface{}.

@gopherbot gopherbot added this to the Unreleased milestone Sep 16, 2019
@gopherbot
Copy link

Thank you for filing a gopls issue! Please take a look at the Troubleshooting section of the gopls Wiki page, and make sure that you have provided all of the relevant information here.

@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 16, 2019
@gopherbot
Copy link

Change https://golang.org/cl/205117 mentions this issue: internal/lsp: improve variadic completion

@golang golang locked and limited conversation to collaborators Nov 6, 2020
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

2 participants