Repository navigation
Add extension points for customizing command palette search results - #836
Conversation
901ab6b to
69ac06e
Compare
|
Opened early for visibility and it's still a draft for now. Gonna check if there could be some more generic API / hooks the palette could expose, so downstream like JupyterLab would own the implementation of the recent feature instead. |
f7c920c to
e8c1376
Compare
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation is backward compatible, documented, and comprehensively tested.
Review effort: Balanced
Findings: None
What changed in this PR
Adds extensibility for custom command-palette search ordering and command-trigger tracking.
Changes:
- Exposes overridable and reusable search APIs.
- Adds an
itemTriggeredsignal. - Adds coverage for custom results and trigger behavior.
| File | Description |
|---|---|
review/api/widgets.api.md |
Records the new public API surface. |
packages/widgets/src/commandpalette.ts |
Implements search extension points and trigger signaling. |
packages/widgets/tests/src/commandpalette.spec.ts |
Tests the new APIs and behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
krassowski
left a comment
There was a problem hiding this comment.
Looks good to me. I was not sure if we need the search function exposed, but I see that is used in JupyterLab downstream PR.
Two non-blocking suggestions surfaced by a local review with an LLM:
- The palette does not activate any item while the query is empty, and an override of
search()cannot change this rule. With a recent command pinned first, as in jupyterlab/jupyterlab#19175, pressing Enter right after opening the palette does not run that command. The user has to press Down first. Issue #735 names VS Code as the model, and in VS Code Enter on an empty query runs the most recent command. This can be tackled in a follow-up. - A click on a header result always replaces the query with the category in lower case plus a space, and a subclass cannot change this. Clicking a custom Recently Used header causes the query to became
recently used ,and the palette then showsNo commands found that match 'recently used '. The headers are still used in lab when using a command palette in the sidebar rather than model.
Again, neither has to be tackled right now but the first point does highlight a UX issue that could be annoying to some.
|
Thanks for the review! Addressed the first point with 97b06ff, this is what it looks like now with jupyterlab/jupyterlab#19175 : jupyterlab-recent-commands-fix.mp4 |
Fixes #735
This will allow downstreams like JupyterLab to better show recently used commands in the palette: