public static class FuzzyMatcherScores how well a typed fragment matches a candidate.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Subsequence matching with position bonuses — the shape every editor's palette uses, because it is what makes rl find "Reset Layout" and opj find "Open Project". A substring search would find neither, and a search that ignored order would find everything.
⚠ The bonuses are what make it usable, not the matching. Every candidate containing the letters in order matches; the ranking is the product. A hit at the start of a word beats one in the middle, a run of adjacent hits beats the same letters spread out, and a shorter candidate beats a longer one that matched equally well — so save puts "Save" above "Save All" above "Autosave Interval" rather than in whatever order the registry happened to be in.
⚠ The scan is greedy and takes the first match for each query character. Optimal alignment is a dynamic program over the whole string, and for candidates that are two or three words long the difference never shows — while the cost does, on every keystroke, against every command, asset and setting in the project.
Fields and properties (1)
public const int NoMatchWhat a candidate that does not match at all scores.
Methods (2)
public static int Score(string? query, string? candidate)Scores a candidate against a query.
public static bool Matches(string? query, string? candidate)Whether a candidate matches at all.
Used by (5)
- AssetSearchSourceVixen.Editor.App
- CommandPaletteSourceVixen.Editor.Ui
- DelegatePaletteSourceVixen.Editor.Ui
- EntitySearchSourceVixen.Editor.App
- PaletteTestsVixen.Editor.Ui.Tests