Add fuzzy name matching tool for inspector#25028
Open
alice-i-cecile wants to merge 5 commits into
Open
Conversation
cookie1170
reviewed
Jul 17, 2026
cookie1170
left a comment
Contributor
There was a problem hiding this comment.
why not use a dedicated fuzzy matching crate, such as fuzzy-matcher or nucleo-matcher? they're specifically meant for fuzzy finding, and have niceties such as getting the indices of the matched characters, which can then be highlighted to make it easier to see where the item matches what you're searching for, like shown here:

Member
Author
|
I didn't realize such a thing existed! I'll swap over. Quick skim suggests that nucleo-matcher is the most mature. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
When working with entity inspectors and similar tools (tracked in #23013), users want to enter strings and get a quick, approximate match.
We should PR this work separately for ease of review.
Solution
Provide the following APIs:
fuzzy_match_component_name: for looking up the metadata and summary statistics for component typesfuzzy_match_resource_name: same, but for resources.fuzz_match_entity_label: look up entities by their entity label (Name, with fallbacks) per Add entity label resolution infrastructure for entity inspectors #25007.Those should provide a solid foundation for lookups in interactive inspectors and editor tools (now that we finally have text input!).
There were a few meaningful design choices:
Vecof results: this lines up with the standard tab-completion candidates UX.ComponentIdand the entity label method returns anEntity. These serve as the primary keys into various inspector-flavored databases of this data, so were more appropriate than returning e.g. anEntityLabel.strsimdependency over reimplementing Jaro-Winkler from scratch. If you really want we can vendor their battle-tested implementation but that mostly seems like dependency metric gaming vanity to me.EntityLabelsin this PR: that's fundamentally a front-end concern IMO in order to determine the filtering they want (e.g. no inspector entities, pagination). By contrast, the component / resource type searches should basically always just be globally so that's a&Worldfunction.Testing
The underlying algorithms are tested extensively in
strsim.I can add more unit tests if y'all think it's appropriate but Bevy's logic here is pretty simple and should be stable, other than swapping out the distance metric if we want to.