feat: new command to goto hover (like goto definition) - #12208
Conversation
|
trying this feature out in my fork and loving it! except, I'd rather it be a horizontal split. I could also see an argument for |
Adding configuration for this small thing is easily going to be rejected by the maintainers. Other adjustments would also be increasing complexity and could delay this PR from being merged |
|
fair enough. let's get this merged first |
What you can also do, at least, if you are working with one pane, is transposing your layout with |
|
@TornaxO7 yep thank you! I am aware |
|
I just fixed it with merge conflicts since #10122 added support for hover with multiple language servers. This is how it looks like with multiple language servers: |
|
@nik-rev What do you think about making this work in-place instead of opening a new split? Similar to [keys.normal.g]
H = ["vsplit", "goto_definition"]Inspired by https://matklad.github.io/2024/10/08/two-tips.html, immediately thought of this PR while reading it :) |
That is definitely better! feels more natural, especially since it is very similar to other commands like "goto reference", but its "goto hover" |
|
This feature seems cool! When is this more useful than simply |
|
more convenient formatting |
Not all languages have the docs right there. Rust is pretty special in that regard And in Rust this is also useful, e.g. copy the inferred type of a local variable |
|
This would be quite useful, thanks for the PR! :) A bit of brainstorming - hope this is not out of place, if it is, apologies. I wonder if this could be made even more general though - this is a specific case of wanting to jump to the text viewed from the popup when the popup is just a peak into a given location of source code, but what if the popup does not correspond to a source text (guess this can happen with some LSPs if for example interacting with a binary and not source code, or some other kind of documentation / other popup that is not just obtained from reading a given file?), and / or if a similar use case happens in other contexts where a popup shows up? So I wonder if it could be useful to make this even more general by making a few additions to the popup functionalities. I.e. for now, when a popup shows up, we can just navigate it with What about adding, when a popup is opened:
From there, the popup content just becomes usual text, and we have all the tools of usual helix available. I had started playing a tiny bit with these ideas in #9311 . But i) I am a rust n00b, ii) I am a helix user but not well known with the codebase, iii) I have not had the time to follow up. But still wonder if a functionality along these lines could be good. A few questions to solve would be:
|
|
I can't wait to have this merged. |
|
Closing! Reason: State of my Helix PRs |
|
I love this PR, unfortunately I am not competent enough in rust and I will probably not have time to become so. Anybody willing to pick this up and / or just open a copy of this PR so that it gets "re-opened" and kept in the "book-keeping of PRs"? |
|
yes! I'm in the middle of picking this up. just wasn't ready yet to proclaim it; but I was able to make it work. some more cleanup to do and I'll publish it; I'll link to it here so that people subscribed to this pr will know about it |
|
I might take on some other unmaintained prs under my wing now that I'm more helix codebase capable. Wanna carry the torch of the sunshine nik brought to the helix community; such a legend! People reading this, feel free to ping me under particularly useful / significant but unmaintained prs. I might go "omg yeah I want that actually!" and take it on perhaps. The author needs to be very obviously away, though; I don't wanna just be stealing work. |
|
I took on maintaining this pr in #15187 |

So, you can use
Space + kto hover documentation which opens a popup.However, sometimes it's really useful to be able to search inside this popup. Or go into it, move around, copy some text, etc. Some hover-docs can be quite long.
This PR adds a new command called
goto_hover, which dumps the "documentation on hover" into a new scratch buffer (replacing the current buffer, similar togoto_definition), where you can use your usual Helix motions. this is how it looks like (after I created a new split):I bound
goto_hovertoSpace + K, whereashoverwasSpace + k.Closes #12206
Closes #8134
Closes #9455