Quick Switcher revamp: floating panel, fuzzy engine, frecency ranking#1644
Conversation
…d frecency ranking
… demand, opens full history queries
…boost, and row actions
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1871f30b4c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| init(contentView: NSView) { | ||
| super.init( | ||
| contentRect: NSRect(origin: .zero, size: contentView.fittingSize), |
There was a problem hiding this comment.
Resize the panel after async content loads
When the quick switcher is opened before its items finish loading, the panel frame is fixed from the initial loading view's fittingSize; after QuickSwitcherPanelView switches to the taller results list there is no code that updates the NSPanel frame, and the borderless panel is not user-resizable. In that common uncached/async-load path, the list/footer can be clipped to the loading-height window until the panel is recreated, so the panel should observe the hosting view's size/preferredContentSize and call setFrame/re-anchor when it changes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f20daefd1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let openTableNames = Set( | ||
| tabManager.tabs | ||
| .filter { $0.tabType == .table } | ||
| .compactMap(\.tableContext.tableName) | ||
| ) |
There was a problem hiding this comment.
Key open-tab markers by database/schema
In contexts where tabs from another database or schema can remain open, this collects only bare table names even though tab activation later compares databaseName and schemaName. QuickSwitcherViewModel.loadItems then uses openTableNames.contains(table.name), so a closed users table in the current database/schema is shown and boosted as already “Open” whenever any other users tab exists. Please key this by the same database/schema/table identity used for tab matching.
Useful? React with 👍 / 👎.
Signed-off-by: Ngô Quốc Đạt <datlechin@gmail.com>
Signed-off-by: Ngô Quốc Đạt <datlechin@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 701f53ac3f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| case #selector(NSResponder.insertNewline(_:)): | ||
| parent.onSubmit() | ||
| return true |
There was a problem hiding this comment.
Handle modified Return in the search field
When the documented Option+Return shortcut is pressed while focus is in this NSTextField, AppKit routes it through insertNewlineIgnoringFieldEditor(_:) rather than the plain insertNewline(_:) selector handled here. Because that selector falls through, onSubmit is not called and the selected table is not opened in a new tab; handle the ignoring-field-editor selector alongside insertNewline(_:).
Useful? React with 👍 / 👎.
…lection and scope bar" This reverts commit cbe451a.
…ng a second window tab
2c59563 to
dd7c916
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd7c916eaa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if viewModel.flatItems.isEmpty { | ||
| noResultsRow |
There was a problem hiding this comment.
Show loading state before declaring no results
When the panel is opened on an uncached connection and the user starts typing before loadItems completes, flatItems is still empty while isLoading is true, so this branch renders the “No results” row for the query. The old sheet kept showing a loading state during this path, and this can incorrectly tell users that a valid table/query has no matches until the async schema/history load finishes; gate the empty state on !viewModel.isLoading or render a progress row while loading.
Useful? React with 👍 / 👎.
What
Full revamp of the Quick Switcher (Cmd+Shift+O), in 5 commits that each build and test on their own.
Matching engine
FuzzyMatcherrewritten as an fzy-style dynamic program with affine gap penalties. It finds the best alignment instead of the first one, returns matched character indices, and treats_ . - / $and camelCase transitions as word boundaries. Candidates over 1024 chars fall back to the old greedy pass.QuickSwitcherFrecencyStore: Firefox-style recency buckets (4/14/31/90 days), 10 samples per item, 100 items per connection. Migrates the old MRU list and removes it.Surface
NSPanelanchored 20% from the top of the window, not a modal sheet. It dismisses on Escape and on losing key focus.ActiveSheet.quickSwitcheris gone.NSApp.currentEvent.clickCount), double click or Return opens, Option+Return opens in a new tab, right-click for actions.NSGlassEffectViewon macOS 26,NSVisualEffectView(.popover) on macOS 14/15.Corpus and freshness
SQLSchemaProvider.loadSchemawhen the table cache is empty, so the panel no longer opens with zero tables before autocomplete has warmed up. Concurrent callers coalesce on the provider's in-flight task.SQLFavorite) join the corpus. History items carry the full query in a newpayloadfield, so opening one loads the real query instead of the 100-char preview.Actions
forceNewWindowTabonopenTableTab).Openbadge, a 1.2x rank boost, and Return focuses the existing tab.Consolidation
upvfindsuser_profile_vieweverywhere. The database switcher also ranks by score.Out of scope, deliberate
Testing
swiftlint lint --strictclean on every touched file (SidebarViewModelTests has pre-existing strict violations, untouched).