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
Milestone

Comments

@muirdm
Copy link

@muirdm 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

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Sep 16, 2019

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

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 4, 2019

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

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