Add additionalKeywords to action types and command palette for enhanced search functionality#8600
Add additionalKeywords to action types and command palette for enhanced search functionality#8600
Conversation
…ed search functionality - Introduced `additionalKeywords` property in various action types and panel descriptors to improve command palette search capabilities. - Updated `useNotebookActions` and `CommandPalette` components to utilize the new keywords for better matching. - Implemented `smartMatch` utility to facilitate keyword-based filtering in the command palette. - Added tests for the new smartMatch functionality to ensure accuracy and reliability.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR enhances search matching by adding optional additionalKeywords metadata to actions/hotkeys/panels and wiring those keywords into the cmdk-based command palette filtering.
Changes:
- Added
additionalKeywordsto editor actions (ActionButton), hotkeys, and panel descriptors (PANELS). - Introduced
smartMatch/smartMatchFilterand configured cmdk to use it for filtering with keyword support. - Added Vitest coverage for
smartMatchandsmartMatchFilter.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/utils/smartMatch.ts | Adds token/prefix-based match + cmdk filter adapter. |
| frontend/src/utils/tests/smartMatch.test.ts | Adds unit tests for the new matching behavior. |
| frontend/src/core/hotkeys/hotkeys.ts | Extends hotkey metadata with additionalKeywords and preserves it in resolved hotkeys. |
| frontend/src/components/ui/command.tsx | Configures cmdk Command to use the new filter function. |
| frontend/src/components/editor/controls/command-palette.tsx | Passes additionalKeywords into cmdk keywords for palette entries. |
| frontend/src/components/editor/chrome/types.ts | Adds additionalKeywords to panel descriptors and populates them for default panels. |
| frontend/src/components/editor/actions/useNotebookActions.tsx | Propagates panel/action additionalKeywords into helper panel dropdown actions. |
| frontend/src/components/editor/actions/types.ts | Adds additionalKeywords to ActionButton and carries it through flattenActions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <CommandPrimitive | ||
| ref={ref} | ||
| filter={smartMatchFilter} | ||
| className={cn( |
There was a problem hiding this comment.
Setting filter={smartMatchFilter} on the shared Command wrapper changes matching behavior for every Command usage across the app (e.g. cell actions search, snippets search, etc.), not just the command palette. This is a fairly broad UX/behavior change (and can make previously-matching fuzzy queries stop working); consider making this filter opt-in (prop/default) or applying it only in the command palette component instead of globally here.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| name: "Format cell", | ||
| group: "Editing", | ||
| key: "Mod-b", | ||
| additionalKeywords: ["lint"], |
There was a problem hiding this comment.
some of these keyboard shortcuts will not work, they aren't a registered action
marimo/frontend/src/components/editor/controls/command-palette.tsx
Lines 65 to 76 in 5796728
There was a problem hiding this comment.
Ah yea thats right. Well I guess if we ever add these to the command palette, it'll be ready to go.
|
🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.20.5-dev25 |
additionalKeywordsproperty in various action types and panel descriptors to improve command palette search capabilities.useNotebookActionsandCommandPalettecomponents to utilize the new keywords for better matching.smartMatchutility to facilitate keyword-based filtering in the command palette.Keyword mapping