Repository navigation
feat: improve discoverability of collapse/expand all sections commands - #10464
Conversation
Fixes #10459 ## Summary "Collapse all sections" and "Expand all sections" already exist as commands (with `global.collapseAllSections` / `global.expandAllSections` hotkeys), but they are only discoverable in the command palette and only under those exact labels. The issue author wanted a way to fold all markdown sections at once and couldn't find one. This change adds "fold"/"unfold" and "headers" as search keywords so command palette queries matching the issue's wording ("fold all markdown sections", "fold headers") find the existing commands.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
All contributors have signed the CLA ✍️ ✅ |
Bundle ReportChanges will increase total bundle size by 47.37kB (0.19%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: marimo-esmAssets Changed:
Files in
|
There was a problem hiding this comment.
Pull request overview
This PR aims to improve command palette discoverability for the existing “Collapse all sections” / “Expand all sections” commands by adding extra search synonyms matching the wording from issue #10459 (“fold/unfold”, “headers”).
Changes:
- Adds
additionalKeywords: ["fold", "headers"]to the “Collapse all sections” notebook action. - Adds
additionalKeywords: ["unfold", "headers"]to the “Expand all sections” notebook action.
Suppressed comments (1)
frontend/src/components/editor/actions/useNotebookActions.tsx:545
- Same issue as above: command palette search keywords for hotkey commands come from
hotkey.additionalKeywords, so settingadditionalKeywordson this action won’t make “unfold/headers” discoverable unless the hotkey definition (DEFAULT_HOT_KEY["global.expandAllSections"]infrontend/src/core/hotkeys/hotkeys.ts) is updated.
additionalKeywords: ["unfold", "headers"],
| hotkey: "global.collapseAllSections", | ||
| handle: collapseAllCells, | ||
| redundant: true, | ||
| additionalKeywords: ["fold", "headers"], |
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="frontend/src/components/editor/actions/useNotebookActions.tsx">
<violation number="1" location="frontend/src/components/editor/actions/useNotebookActions.tsx:537">
P1: The added `additionalKeywords` won't be picked up by the command palette for these two commands. Both "Collapse all sections" and "Expand all sections" have a registered hotkey (`global.collapseAllSections` / `global.expandAllSections`), so in the command palette they are rendered through the hotkey path (`renderShortcutCommandItem`), which sets `keywords` from the hotkeys.ts definition (`hotkey.additionalKeywords`) — not from the action object's `additionalKeywords`. The action-level keywords added here are only consumed by `renderCommandItem`, which is used for actions *without* hotkeys, so this change currently has no effect on discoverability. To make the feature work, add `additionalKeywords` to the corresponding entries in `frontend/src/core/hotkeys/hotkeys.ts` (the source used for command-palette and keyboard-shortcuts rendering), or merge the action's keywords into the hotkey-driven palette item.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| hotkey: "global.collapseAllSections", | ||
| handle: collapseAllCells, | ||
| redundant: true, | ||
| additionalKeywords: ["fold", "headers"], |
There was a problem hiding this comment.
P1: The added additionalKeywords won't be picked up by the command palette for these two commands. Both "Collapse all sections" and "Expand all sections" have a registered hotkey (global.collapseAllSections / global.expandAllSections), so in the command palette they are rendered through the hotkey path (renderShortcutCommandItem), which sets keywords from the hotkeys.ts definition (hotkey.additionalKeywords) — not from the action object's additionalKeywords. The action-level keywords added here are only consumed by renderCommandItem, which is used for actions without hotkeys, so this change currently has no effect on discoverability. To make the feature work, add additionalKeywords to the corresponding entries in frontend/src/core/hotkeys/hotkeys.ts (the source used for command-palette and keyboard-shortcuts rendering), or merge the action's keywords into the hotkey-driven palette item.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At frontend/src/components/editor/actions/useNotebookActions.tsx, line 537:
<comment>The added `additionalKeywords` won't be picked up by the command palette for these two commands. Both "Collapse all sections" and "Expand all sections" have a registered hotkey (`global.collapseAllSections` / `global.expandAllSections`), so in the command palette they are rendered through the hotkey path (`renderShortcutCommandItem`), which sets `keywords` from the hotkeys.ts definition (`hotkey.additionalKeywords`) — not from the action object's `additionalKeywords`. The action-level keywords added here are only consumed by `renderCommandItem`, which is used for actions *without* hotkeys, so this change currently has no effect on discoverability. To make the feature work, add `additionalKeywords` to the corresponding entries in `frontend/src/core/hotkeys/hotkeys.ts` (the source used for command-palette and keyboard-shortcuts rendering), or merge the action's keywords into the hotkey-driven palette item.</comment>
<file context>
@@ -534,13 +534,15 @@ export function useNotebookActions({
hotkey: "global.collapseAllSections",
handle: collapseAllCells,
redundant: true,
+ additionalKeywords: ["fold", "headers"],
},
{
</file context>
Coverage Report for ./frontend
File Coverage
|
||||||||||||||||||||||||||||||||||||||
Commands with hotkeys are rendered in the command palette from the hotkeys.ts definitions, so action-level additionalKeywords were never used for these two commands. Move the keywords to the hotkey entries.
|
🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.23.17-dev24 |
|
@mscolnick Are you able to share how to use this in VScode? |
marimo-team#10464) Fixes marimo-team#10459 "Collapse all sections" and "Expand all sections" already exist as commands<br>(with `global.collapseAllSections` / `global.expandAllSections` hotkeys), but<br>they are only discoverable in the command palette and only under those exact<br>labels. The issue author wanted a way to fold all markdown sections at once<br>and couldn't find one. This change adds "fold"/"unfold" and "headers" as search keywords so command<br>palette queries matching the issue's wording ("fold all markdown sections",<br>"fold headers") find the existing commands.
Fixes #10459
"Collapse all sections" and "Expand all sections" already exist as commands
(with
global.collapseAllSections/global.expandAllSectionshotkeys), butthey are only discoverable in the command palette and only under those exact
labels. The issue author wanted a way to fold all markdown sections at once
and couldn't find one.
This change adds "fold"/"unfold" and "headers" as search keywords so command
palette queries matching the issue's wording ("fold all markdown sections",
"fold headers") find the existing commands.