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: add configuration for single-line hover #32561

Open
inliquid opened this issue Jun 12, 2019 · 8 comments

Comments

Projects
None yet
5 participants
@inliquid
Copy link

commented Jun 12, 2019

Right now gopls returns only first sentence from the symbol documentation, please make it return full docs.
изображение

@gopherbot gopherbot added this to the Unreleased milestone Jun 12, 2019

@stamblerre stamblerre changed the title x/tools/cmd/gopls: make quick documentation return full docs, not just first sentence x/tools/cmd/gopls: show full docs, not just first sentence, on hover Jun 12, 2019

@stamblerre

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2019

This is intentional. Often, documentation can be lengthy and overwhelming (token.Pos is a good example), so we try to avoid showing it all on hover. My assumption was that, if the user wanted to see more detail, they could jump to the definition of the identifier.

However, if this is not the case, and other people are also interested in this behavior, I'd be willing to make this change.

If you want to see full documentation on hover, please upvote this issue or comment with your reasoning.

@inliquid

This comment has been minimized.

Copy link
Author

commented Jun 12, 2019

Actually full docs on hover was available with all editors/tools that I was using so far:

  • VS Code + default command line tools
  • VS Code + go-langserver
  • VS Code + bingo
  • Goland

From my experience it's one of the most useful and demanded features. I wouldn't mind that gopls will have a config option to disable documentation on hover. Right now cutting it to first sentence is confusing and wrong because it creates wrong understanding by putting first phrase out of context and creating wrong impression for a developer that this first sentence IS the description, while it's not. It must either be full docs or no doc at all.

@marwan-at-work

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2019

I like the small doc to not clutter everything. Before Gopls, when you hover over a signature you get a mini version of the doc (or none), but if you cmd+hover you get the full doc/definition. That was quite useful, because sometimes I just want to see the signature without having to recognize it from the docs...and sometimes I want to read the docs so I just cmd+hover

@stamblerre

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2019

Filed microsoft/language-server-protocol#772 to get more clarity on textDocument/hover.

@stm9443

This comment has been minimized.

Copy link

commented Jun 27, 2019

I personally would prefer to have full comments over the single line version, but I can understand the desire to only see the signature at times. Is it possible to add a configuration that will change the length of comments that you see on hover?

Something like: showFullComments: true (default: false)

A setting like this would allow each developer to decide the style of comments they see when hovering.

@stamblerre

This comment has been minimized.

Copy link
Contributor

commented Jun 27, 2019

That does seem like a reasonable solution while we wait on modifications to the LSP specification. I think the options should be 1) full, 2) shortened, 3) single line (to support clients like vim-go, which currently trims to a single line).

@stamblerre stamblerre changed the title x/tools/cmd/gopls: show full docs, not just first sentence, on hover x/tools/cmd/gopls: add configurations for level of documentation on hover Jun 28, 2019

@stamblerre stamblerre changed the title x/tools/cmd/gopls: add configurations for level of documentation on hover x/tools/gopls: add configurations for level of documentation on hover Jul 2, 2019

@gopherbot

This comment has been minimized.

Copy link

commented Jul 2, 2019

Change https://golang.org/cl/184797 mentions this issue: internal/lsp: add configuration for hover levels

gopherbot pushed a commit to golang/tools that referenced this issue Jul 3, 2019

internal/lsp: add configuration for hover levels
Instead of defaulting to a one sentence synopsis for documentation on
hover, allow the user to configure the amount of documentation they want
to see. Right now, the options are none, some (using go/doc.Synopsis),
or all. We should add a 4th, single-line, mode, which will allow clients
like vim-go to stop stripping off documentation on hover.

Updates golang/go#32561

Change-Id: I529242da84b794636984d5ef2918b7252886f0ef
Reviewed-on: https://go-review.googlesource.com/c/tools/+/184797
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>

@stamblerre stamblerre changed the title x/tools/gopls: add configurations for level of documentation on hover x/tools/gopls: add configuration for single-line hover Jul 8, 2019

movie-travel-code added a commit to movie-travel-code/tools that referenced this issue Jul 11, 2019

internal/lsp: add configuration for hover levels
Instead of defaulting to a one sentence synopsis for documentation on
hover, allow the user to configure the amount of documentation they want
to see. Right now, the options are none, some (using go/doc.Synopsis),
or all. We should add a 4th, single-line, mode, which will allow clients
like vim-go to stop stripping off documentation on hover.

Updates golang/go#32561

Change-Id: I529242da84b794636984d5ef2918b7252886f0ef
Reviewed-on: https://go-review.googlesource.com/c/tools/+/184797
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
@inliquid

This comment has been minimized.

Copy link
Author

commented Jul 20, 2019

I think gopls must either not show doc at all or show full docs. Cutting first sentence out of the context is simply wrong. There a lot of cases where first sentence is smth like You can use that method for anything you like. and second But do it at own risk. It's not supported. It's DEPRECATED. (exaggerating)
Adding additional click to this flow is also wrong. It's degraded user experience. Documentation on hover vs documentation on hover + CLICK is HUGE difference. In the last case you'll put VS Code with vscode-go down the bottom of rank of good Go editors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.