unison icon indicating copy to clipboard operation
unison copied to clipboard

fzf preview for definitions

Open ceedubs opened this issue 3 months ago • 1 comments

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

When I run a command like view or edit, I often need a bit more context to figure out which definition I want to select. For example I might narrow down on List.iterate, List.tabulate, and List.unfold as the potential definition that I need, but the name alone isn't enough to remind me which one I am seeking.

Describe the solution you'd like

It would be nice if having the cursor over a definition showed a preview of the definition using fzf's --preview support. It should at least contain the type signature, but could potentially include the pretty-printed implementation as well.

The fzf support for preview runs an external process with the current line as an argument (ex: fzf --preview 'cat {}'). I'm not totally sure how ucm should plug into this. Should it call into curl using the host:port that it is bound to? @ChrisPenner is much more equipped than I am to know the right approach. Personally I think it's okay to implement it in a way that won't work on all systems (ex: don't have curl installed) as long as it gracefully degrades, since this is already in a path where we rely on the user having fzf installed.

Describe alternatives you've considered

You could provide a bit more context by providing the type signature directly in the fzf result line but this gets really noisy and often requires multiple lines. I also don't know whether it's possible to do this without messing with fuzzy finding.

ceedubs avatar Oct 09 '25 19:10 ceedubs

Yeah either curl or just piping through a fifo or something would be a reasonable enough approach. I can't promise I'll get to this any time soon, but probably wouldn't be too hard to knock out some day :)

ChrisPenner avatar Oct 12 '25 18:10 ChrisPenner