-
Notifications
You must be signed in to change notification settings - Fork 784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sorting to command palette #4927
Comments
This might be an issue with the matcher scoring? from textual.fuzzy import Matcher
def test_match():
matcher = Matcher("hel")
help_match = matcher.match("Show keys and help panel")
quit_match = matcher.match("Quit the application")
assert help_match > quit_match |
I don't fully understand the scoring, but I suspect the problem is the first character match:
|
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
Sorry just to clarify for future reference, I'm a bit confused why this issue is closed? The command palette sorting described in the original issue is still the same on main?
|
I made it sort using the match score (I believe!), but never looked into any deficiencies in the scoring algorithm itself, as it seemed to give better results and I never checked the specific example in the original issue. |
Shall we create a separate issue to cover improving the scoring and link to this? |
The command palette doesn't sort the matches other than alphabetically.
There does seem to be code in there to rate matches, and the docs do say the score is used in sorting. But no sorting occurs.
You can see this with the current system commands. If I type hel I get two results:
Quit the application
andshow keys and help panel
, in that order. I would expect the help panel to be on top as it is a better match according to the code in fuzzy.py.The text was updated successfully, but these errors were encountered: