Skip to content

Add an option to stream unsorted output with --show-matches and --show-scores #192

@cptaffe

Description

@cptaffe

What

I would like fzy to be configurable to stream scored results without sorting, so that live search results can be shown for slow inputs, for use in a separate application which does not utilize a TTY.

Similar functionality has been requested in #130 and #17, in the context of streaming within the fzy TTY UI. This issue is in the context of a UNIX filter, and could even be implemented as its own command utilizing the match.c logic.

Why

I am writing a fzy-like tool for the Acme editor, acme-search. In the first iteration I've hooked into acme-lsp for global symbol search and ported VS Code's fuzzy search algorithm.

Image

A right click (button 3 in Acme-speak plumbs the address of any of the results to Acme, opening it on the correct line in a new window.

I would like to take an approach similar to Telescope, where "pickers" (sources) and "sorters" (filters and rankers) are pluggable. In the spirit of Acme and the UNIX philosophy, what better way to do this than via UNIX filters. An invocation like the following (which would be aliased to a short name or keyboard shortcut):

Search -c 'L sym -p $query | fzy -e $query -s'

would simply take the interactive user input and execute the command (after debouncing). In the example above it would be

L sym -p ScoreFuzz | fzy -e ScoreFuzz -s

Or, a different example where the source can be cached across queries:

find . | Search -c 'fzy -e $query -s'

Since acme-search stores each line of results on a score heap and renders the top n results continuously based on additional result lines or updated user input, the most responsive experience would require the scorer to stream lines of input and apply the score.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions