Skip to content

Add extension points for customizing command palette search results - #836

Merged
krassowski merged 7 commits into
jupyterlab:mainfrom
jtpio:recent-commands
Oct 7, 2026
Merged

krassowski merged 7 commits into
jupyterlab:mainfrom
jtpio:recent-commands

Conversation

@jtpio

@jtpio jtpio commented Jul 17, 2026

Copy link
Copy Markdown
Member

Fixes #735

This will allow downstreams like JupyterLab to better show recently used commands in the palette:

image

@jtpio jtpio added the enhancement New feature or request label Jul 17, 2026
@jtpio
jtpio force-pushed the recent-commands branch 2 times, most recently from 901ab6b to 69ac06e Compare July 17, 2026 12:29
@jtpio

jtpio commented Jul 17, 2026 •

Copy link
Copy Markdown
Member Author

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.

@jtpio jtpio changed the title Support recent commands in the command palette Add extension points for customizing command palette search results Jul 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 itemTriggered signal.
  • 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.

@jtpio
jtpio marked this pull request as ready for review September 29, 2026 06:48

@krassowski krassowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 shows No 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.

@jtpio

jtpio commented Sep 29, 2026

Copy link
Copy Markdown
Member Author

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

@krassowski
krassowski merged commit fb43b45 into jupyterlab:main Oct 7, 2026
17 checks passed
@jtpio
jtpio deleted the recent-commands branch October 7, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support recent commands

3 participants