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: avoid including explicit type parameters in completion if they will be inferred #64480

Closed
d-enk opened this issue Nov 30, 2023 · 3 comments
Labels
FeatureRequest 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

@d-enk
Copy link

d-enk commented Nov 30, 2023

Every time you have to remove them, because in most cases they are not needed

Peek 2023-11-30 12-41

There may already be a way to disable them, but then it is not obvious

@findleyr
Copy link
Contributor

If type parameters are not needed most of the time, let's just fix the default behavior. Adding an option doesn't really solve the problem -- it only pushes the problem onto the user.

It would be even better if we could detect whether explicit type parameters are likely to be required, for example because they do not unify with the function arguments. I think this is feasible: we don't need to implement the complete unification algorithm in order to have a pretty accurate heuristic: simply walk the structure of the argument types (and then, recursively, constraints) in order to check that all type parameters are reached.

@hyangah hyangah added FeatureRequest gopls/completion Issues related to auto-completion in gopls. labels Nov 30, 2023
@adonovan adonovan transferred this issue from golang/vscode-go Nov 30, 2023
@adonovan adonovan changed the title Option to exclude type parameters from completion. x/tools/gopls: option to exclude type parameters from completion Nov 30, 2023
@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 Nov 30, 2023
@gopherbot gopherbot added this to the Unreleased milestone Nov 30, 2023
@findleyr findleyr changed the title x/tools/gopls: option to exclude type parameters from completion x/tools/gopls: avoid including explicit type parameters in completion if they will be inferred Nov 30, 2023
@rogeryk
Copy link
Contributor

rogeryk commented Dec 1, 2023

This problem is same as #51783.

@hyangah hyangah modified the milestones: Unreleased, gopls/backlog Dec 7, 2023
@hyangah
Copy link
Contributor

hyangah commented Dec 7, 2023

Duplicate of #51783

Thanks for finding the previously filed issue. @rogeryk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest 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

5 participants