am-impact / amcommand

Command palette in Craft; Because you can
Other
87 stars 8 forks source link

UX: Change default order of some results #31

Closed RobErskine closed 6 years ago

RobErskine commented 6 years ago

Hey there,

Just want to say as an avid Alfred user, I LOVE this plugin. I've already memorized the key command by heart.

I've been using it a bit and noticed that the default order of some listings for popular queries is a bit odd. For example, when typing in "entries" instead of it taking you to the whole entries list, the default is to delete all entries! I've accidentally hit enter a few times and almost deleted entire sections by accident.

like this

Is it possible to reorder the results somehow? I'm happy to take a stab at this if you're accepting PRs.

Thanks, Rob

hubertprein commented 6 years ago

I'm glad you like it!

Regarding the issue; it's happening because of the way the plugin currently sorts the commands. Because you're searching for entries, the above results probably all have the same score. Because they are sorted in alphabetic order, the delete command comes first.

I'm thinking about using a different library when it comes to searching and giving an additional score to new/edit commands, to make sure the delete comes after them.

I'll get back on this.

hubertprein commented 6 years ago

@RobErskine I haven't touched the results yet, by adding an additional score of some sorts, but the fuzzy search engine has been swapped for another. The results of this engine look promising. Could you try this version out? It's already in the master branch.

RobErskine commented 6 years ago

@hubertprein Thanks for taking a stab at that. Eager to try it out. Candidly Craft 3 is my first real foray into Composer. To try your update do do I need to update my composer.json from "am-impact/amcommand": "dev-craft3", to "am-impact/amcommand": "dev-master", and then run composer update? Not sure if I need to install it another way or not.

hubertprein commented 6 years ago

This update isn't in the Craft 3 version yet. It's for Craft 2 at the moment. If it's suitable, it'll be ported to Craft 3 shortly after.

hubertprein commented 6 years ago

Updated for Craft 3. Simply use composer update.

It now searches in command descriptions as well.

RobErskine commented 6 years ago

Ah yeah I see. I knew about composer update, but didn't realize the new fuzzy engine was only implemented for Craft 2 (I had no idea it worked with Craft 2, gonna have to go back and install this on all my old builds!). Thank you for porting it to Craft 3. I love the new results!

yaaaassssss