Skip to content

x/tools/gopls: Display struct methods #54008

@MathiasHandle

Description

@MathiasHandle

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

I have difficulties finding all available methods for given struct, hence this request.

Describe the solution you'd like

When on hover on struct I'd like to display all methods belonging to that struct.

This should work across files. As currently the outline view displays only types defined in currently opened file.

There are 2 solutions that come to my mind:

1) Display methods in hover docs (preferred solution)

  • I've took this implementation from JetBrain's Goland IDE as I find it as a best solution

method_overview3

2) Sort methods in outline view

  • If the first implementation wouldn't be possible, I think this could still make code navigation easier.

Currently the outline view can be sorted by
1.) position
2.) Name
3.) Category

But the methods aren't visually assigned to struct they belong to.
outline

Additional context

These proposed changes don't make sense in this simple example, but in real project with a lot of types, methods, packages, etc.. it would make better & cleaner code navigation.

Metadata

Metadata

Assignees

Labels

FeatureRequestIssues asking for a new feature that does not need a proposal.FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.help wanted

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions