Skip to content

Promote gopls implement interface through command palette #4063

Description

@h9jiang

Feedback provided through CL 807340.

I see there are actually two paths for "implement interface" in vscode-go:

command palette: "Go: Generate Interface Stubs": This approach uses the external impl tool, requires manual input like "f *File io.Closer".
code action via Ctrl + . : gopls approach
The main gap I see is discoverability: the gopls-powered version is only reachable via the code action when the cursor is inside a type declaration. There's no command palette entry or keyboard shortcut for it. Users who search the command palette for "implement interface" land on the go.impl.cursor command, which has a different UX (text input box rather than the searchable interface picker that gopls provides).
If the gopls were also exposed as a command palette entry (e.g., "Go: Stub Methods to Implement Interface"), it would bridge that gap and give users a consistent entry point.
Ideal solution would be expose the gopls-powered code action as a dedicated command palette entry so it's more discoverable, rather than only appearing as a code action when cursor is on a type declaration. And if we want to enforce gopls approach, we can mark one as legacy like how we have for generating unit tests.

Let's investigate if there is any missing support for gopls functionality, if there is non, we can consider swapping the underlying implementation of the command.

Or a smoother migration by keeping two commands:

  • Go: Generate Interface Stubs
  • Go: Generate Interface Stubs (Legacy)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions