-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
proposal: x/tools/cmd/gopls: provide config option for hover documentation placement #33352
Comments
I have an open issue with LSP about |
Thinking about #33550 made me realize that there are some additional issues here.
|
Sorry I don't understand, why don't just make it in same way, as it was done in all other versions/editors listed in #33550: sourcegraph's |
Small nit: I'd say "possibly" rather than "probably". Reason being, popup placement (at least in my experience with Completely agree this is more complex than simply putting the signature at the top or bottom.
I think we need to determine the structure of what we are returning. There are effectively two parts:
Currently the hover API bundles all this content together, which I think is part of the issue. The ultimate UI/UX from my perspective would be to have the type/signature always visible, and the associated documentation scroll as required. This might well be implemented using two popups; one for the type/signature, the other (immediately below/above) a max-height X-lines scrollable popup the same width as the type/signature popup, but I only mention this in passing because I think the structure point needs to be established first, the implementation is just a detail This might even make my request to have the type/signature "at the bottom" redundant, because the max-height of the scrolling would mean the distance between the hover trigger and the type/signature is limited. |
@inliquid: I think my main issue with this solution is that, in some cases, as @myitcv said, it's nicer to have the signature of the function pop-up right next to the function call in your code (so, at the bottom). I certainly prefer the solution of having 2 windows, and I really do think that the best fix is to have structured types for hover. Perhaps a reasonable temporary solution is to add a configuration, and meanwhile to work with the LSP folks on resolving microsoft/language-server-protocol#772. |
Sorry I don't understand "it's nicer to have the signature of the function pop-up right next to the function call in your code (so, at the bottom)". Where is it "nicer"? I was wondering why it's moved to the bottom from the very beginning with a single line doc approach, now it just made UX even worse than it was, because user have to scroll every time text is long enough. |
From @myitcv's comment:
It can be helpful to minimize the distance between the identifier and the signature, to make things clearer to the user. I agree that this is not always the case, particularly when the documentation is long. My current opinion on this issue is that we should:
|
Another option: provide a config option that would tell |
Change https://golang.org/cl/189943 mentions this issue: |
Change https://golang.org/cl/189977 mentions this issue: |
This change configures the ordering of documentation on hover. If the user has requested full documentation, the signature appears at the top, to avoid the user having to scroll. Otherwise, the signature appears at the bottom, to minimize the distance between the triggering identifier and the signature. Updates golang/go#33352 Change-Id: I017baaabd0ee0c31cb13cb6abdda296782929823 Reviewed-on: https://go-review.googlesource.com/c/tools/+/189943 Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
Updates golang/go#33352 Change-Id: Ibf18e2529c9ba8c94c66942ea6f2c27f047ed285 Reviewed-on: https://go-review.googlesource.com/c/tools/+/189977 Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
It sounds like this discussion has converged to a result. Is this proposal issue still worth keeping open? |
I think we can close this. We added workarounds to gopls to handle different cases for hover, and we can wait on responses from the LSP team on microsoft/language-server-protocol#772. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I believe (from a quick test) that VSCode places hover-popups above-and-to-the-right of the mouse.
In Vim such popups have historically been below-and-to-the-right.
The text returned for a hover is as follows:
This ordering works well when the popup is show above-and-to-the-right, because the signature is near the identifier that trigger the hover.
It doesn't work so well for below-and-to-the-right popup placement, because the distance between signature and identifier is at its maximum.
Could I suggest therefore we have a config option to configure this, to place the type before/after the documentation?
Related discussion: govim/govim#421
cc @stamblerre @ianthehat
The text was updated successfully, but these errors were encountered: