atom / fuzzaldrin

Fuzzy filtering and string scoring
MIT License
319 stars 28 forks source link

Pre-select last used result for input #25

Open kausters opened 9 years ago

kausters commented 9 years ago

Coming from Sublime Text to Atom, a major stumble for me is, from what I gather, that fuzzaldrin never learns from my usage and returns only results sorted by their match score. However, Sublime both in command palette and autocomplete menu would pre-select the last used result I selected the same input.

I'll illustrate the need with two examples.


First up, autocomplete. When writing CSS, I previously would use sort of a shorthand, say, bcotab for background-color. When I use the shortcut, the editor should remember the option I picked and the next time I use the exact same input (bco) it should pre-select the exact same result (background-color).

This is a massive time-saver that lets me have pseudo-snippets of sorts, where I would write CSS properties just by 1-to-3 letter combinations, with results coming straight from autocomplete's memory of my last usage. Fast, easy to remember and, best of all, simple.


Second, command palette. There are a couple of commands that aren't used constantly (and I don't want keyboard shortcuts for such commands) but come in handy once or twice a month, like converting the current file buffer from spaces to tabs or the other way around.

To do this, I'd open the command palette, type in "tabs" or "spaces" and choose the appropriate command from the list. In Sublime, I'd already have preselected the command I chose the last time I typed the same input: tabs would pre-select "Indentation: Convert to Tabs" and spaces would pre-select "Indentation: Convert to Spaces". And even though there are other results for those queries, and some of them may be higher-scoring (as indicated by the order of items), the default command when I hit Return is the one I actually use out of those results.

Instead, in Atom when I type tabs into the command palette, I have to scroll or arrow-down to 10 items lower to get the one I wanted, it's ridiculous.


Right now, Atom doesn't do this. Instead every time I run an often-used autocomplete input or search for a command in the command palette, I get the same ordered-by-score results and have to select the one that I want, which in most cases would have been the same one as always. Sublime does this and it's a huge time saver, I'd love to see Atom add this functionality.

And yes, I could add obscure keyboard shortcuts and manually type out snippets for every single shortcut, but that wouldn't be very productive or flexible.

swrobel commented 8 years ago

:+1:

pycckuu commented 8 years ago

👍

50Wliu commented 8 years ago

fuzzaldrin-plus (https://github.com/jeancroy/fuzzaldrin-plus) is the new default algorithm used by most of Atom for fuzzy searching. If this issue still exists with fuzzaldrin-plus, please file it over there. Thanks!

swrobel commented 8 years ago

@50Wliu where is that reflected in the code? I still see it as an option, default off: https://github.com/atom/fuzzy-finder/blob/master/lib/fuzzy-finder-view.coffee#L71

50Wliu commented 8 years ago

The option is now on by default: https://github.com/atom/fuzzy-finder/blob/master/package.json#L44

jeancroy commented 8 years ago

Yes, this is a still a issue in fuzzladrin-plus because learning from history is a completely new feature. It's a bit unclear how to best implement that feature. Help / discussion welcome (maybe on the plus package)