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: consider the methods list at the end of the hover #56331

Open
hyangah opened this issue Oct 19, 2022 · 6 comments
Open

x/tools/gopls: consider the methods list at the end of the hover #56331

hyangah opened this issue Oct 19, 2022 · 6 comments
Assignees
Labels
FeatureRequest 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

@hyangah
Copy link
Contributor

hyangah commented Oct 19, 2022

gopls version v0.10.0-pre.1
go version 1.19.1

It looks like gopls places
the type definition
list of methods (exported, and unexported)
type comments

When the list of methods is long, it needs quite some scrolling to get to the documentation. (example gopls/internal/lsp/cache/workspace.go, hover over workspace in line 160.

How about placing the method list at the end?

@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 Oct 19, 2022
@gopherbot gopherbot added this to the Unreleased milestone Oct 19, 2022
@findleyr
Copy link
Contributor

findleyr commented Oct 19, 2022

Makes sense to me, and should be straightforward.

This feature was added in https://go.dev/cl/420714.

@adonovan
Copy link
Member

adonovan commented Oct 20, 2022

Thanks for the feature request. I have assigned it to one of our experts.

@danishprakash
Copy link

danishprakash commented Oct 21, 2022

Is this something an external contributor can pick up?

@hyangah
Copy link
Contributor Author

hyangah commented Oct 21, 2022

@danishprakash Sure! Assigning this to you.

One question I have is whether we should do this conditionally or not.

In v0.10.0, the hover message over a struct type will present in the order of:

  • type spec
    • shape of the struct
    • exported methods
    • unexported methods
  • doc comment

When the number of methods are small, I think this layout works well and consistent.
Especially, when the doc comment is rather long, I appreciate the current order for me to quickly take a look at the available methods.

When the number of methods are long and the doc comment is short, placing the doc first sounds more convincing.

@hyangah hyangah assigned danishprakash and unassigned hyangah Oct 21, 2022
@findleyr
Copy link
Contributor

findleyr commented Oct 21, 2022

One question I have is whether we should do this conditionally or not.

Do you mean via configuration, or dynamically via some heuristic for the optimal layout.

I think we should be consistent with pkgsite, which would put the type definition first, followed by doc, followed by methods. Unlike pkgsite we shouldn't include documentation for the methods, as that would be too verbose.

@dle8 dle8 added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Oct 27, 2022
@hyangah
Copy link
Contributor Author

hyangah commented Oct 27, 2022

I think we should be consistent with pkgsite,
Agree. Thanks for finding a precedent case.

  • Type definition
  • Doc
  • List of methods - note: unlike pkgsite, this can include unexported methods.

@hyangah hyangah added FeatureRequest and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest 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

6 participants