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: func parameter completions should pick up accessible type aliases of a parameter type #67219

Open
frankli0324 opened this issue Apr 17, 2024 · 0 comments
Labels
gopls/completion Issues related to auto-completion in gopls. 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

@frankli0324
Copy link

frankli0324 commented Apr 17, 2024

Is your feature request related to a problem? Please describe.

When a module provides an API that takes a private type parameter in an internal package, and exports that type with type alias in public packages, currently the code completion simply copies the literal func definition:

image

image

Describe the solution you'd like

I think the golang extension should be smarter in completion and use gopls to understand the function signature and replace the inaccessible types with accessible ones if possible.

image

That is already the case where type aliases are used in simpler cases, under which the extension could find the correct type

image

Describe alternatives you've considered

I find that if I create a package with the same name of the public package my type alias is in, I could workaround this thing, but still, it's a literal copy of the func signature.

Additional context

None

@ansaba ansaba added the gopls Issues related to the Go language server, gopls. label Apr 17, 2024
@suzmue suzmue changed the title func parameter completions should pick up accessible type aliases of a parameter type x/tools/gopls: func parameter completions should pick up accessible type aliases of a parameter type May 7, 2024
@suzmue suzmue transferred this issue from golang/vscode-go May 7, 2024
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label May 7, 2024
@gopherbot gopherbot added this to the Unreleased milestone May 7, 2024
@suzmue suzmue modified the milestones: Unreleased, gopls/backlog May 7, 2024
@suzmue suzmue added the gopls/completion Issues related to auto-completion in gopls. label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls/completion Issues related to auto-completion in gopls. 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