Skip to content

x/tools/gopls: fails to generate proper func signature when autocompleting parameters for generic functions #79187

Description

@igadmg

What version of Go, VS Code & VS Code Go extension are you using?

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.
    • go version go1.26.2 windows/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • golang.org/x/tools/gopls v0.21.1
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    • Version: 1.118.1 (system setup)
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.52.2

Share the Go related settings you have added/edited

Describe the bug

When autocompleting code for parameters to functions reveiving functions vs code fails to figure out parameters.
For example

	var s []int
	slices.SortFunc(s, func() int {})

So instead of figuring out that func() int should accept parameters a,b int vs code fails to do so.
Expected to have autocomplete of

	var s []int
	slices.SortFunc(s, func(a, b, int) int {})

PS: it feels that at some stage long ago it was working and then was broken maybe half year ago or so.

Metadata

Metadata

Assignees

Labels

BugReportIssues describing a possible bug in the Go implementation.FixPendingIssues that have a fix which has not yet been reviewed or submitted.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.gopls/completionIssues related to auto-completion in gopls.

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions