Add scoring and sorting to sequence matcher#7367
Add scoring and sorting to sequence matcher#7367donkawechico merged 12 commits intohome-assistant:devfrom
Conversation
86c6dc4 to
3e82916
Compare
zsarnett
left a comment
There was a problem hiding this comment.
Since we stole this from VSCode. Lets make a comment at the top of each "stolen" file or function that is copied.
|
I meant to comment not approve... |
There was a problem hiding this comment.
Also, this is going to be difficult to review. Just as a quick glance. Do we need ALL of the checks?are we comparing case? like if case the same then if it isn't the same and comparing both. We should probably only do one or the other. But again only glanced. Vscodes implementation may be more powerful than we need.
We definitely don't need all of the checks. But we don't need all the features of fuse.js, but we import them all anyway. This is sort of just a library import. I realize that's not a water-tight argument. I'm just not sure I see the value in spending a long time deciphering the code, surgically removing the features we aren't currently using, only to later discover they'd be quite helpful. All that being said, now that I know we can get what we want using only |
ca6f8fc to
ce9da22
Compare
Confession time. HA is my first meaningful contribution to open source anything. I don't know the proper way to apply credit, so I just replaced the existing microsoft copyright declaration at the top of each borrowed file with the contents of VS Code's I didn't put any MS credit in sequence-matching.ts because that's all my code. Is that correct? |
9e0e757 to
786b096
Compare
52318f1 to
1ed0343
Compare
… best score in list of words
…ctually sorting by score
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
d21ab89 to
03c6a29
Compare
92e2cb3 to
3efa03d
Compare
3efa03d to
2581c01
Compare
Proposed change
Add scoring to the filter algorithm to make more relevant filters appear first in the list.
The current simple sequence matching algorithm doesn't score matches, so if a low-quality result is higher alphabetically, it will appear first, resulting in a confusing experience.
For example, "media" will match "automation.choose_duplicate" before it matches "media_player.bedroom" simply because "automation" starts with an "a".
This PR ports over VS Code's implementation of filter for its quick access bar.
The filter code is lazy-loaded after user launches quick bar.
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: