feat(sidebar): typo-tolerant fuzzy matching for the table & trigger filters#417
Open
Davydhh wants to merge 2 commits into
Open
feat(sidebar): typo-tolerant fuzzy matching for the table & trigger filters#417Davydhh wants to merge 2 commits into
Davydhh wants to merge 2 commits into
Conversation
…ters Replace the substring filter with Fuse.js so misspellings still match (e.g. "ordrs" finds "orders") and the closest names rank first. Applied to the table and trigger filters across the schema, database, and flat layouts via a shared fuzzyFilter helper. Adds the fuse.js dependency.
Collaborator
Contributor
Author
|
Hi @debba, |
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.
Summary
The sidebar "Filter tables…" boxes currently do a strict, case-insensitive substring match. This switches them to typo-tolerant fuzzy matching via Fuse.js — so a misspelling like
ordrsstill findsorders, and results are ranked best-match-first.Changes
src/utils/fuzzy.ts— a smallfuzzyFilter(items, query, getText)helper wrapping Fuse.js (threshold: 0.4,ignoreLocation: true), with tests.fuzzyFilterin the table and trigger filters across all three sidebar layouts: schema (SidebarSchemaItem), multi-database (SidebarDatabaseItem), and flat (ExplorerSidebar).New dependency
Adds
fuse.js(^7.4.2) — a small, zero-dependency package (~few KB gzipped) and the most widely used JS fuzzy-search library; it provides the typo tolerance. Flagging explicitly since it's a new runtime dependency — happy to swap in a dependency-free implementation instead if you'd prefer to avoid it.