Skip to content

feat: improve discoverability of collapse/expand all sections commands - #10464

Merged
mscolnick merged 2 commits into
mainfrom
ms/fix/issue-10459-notebook-actions
Aug 10, 2026
Merged

mscolnick merged 2 commits into
mainfrom
ms/fix/issue-10459-notebook-actions

Conversation

@mscolnick

@mscolnick mscolnick commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #10459

"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.

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.
Copilot AI review requested due to automatic review settings August 5, 2026 14:13
@vercel

vercel Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview Aug 10, 2026 1:15pm

Request Review

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@codecov

codecov Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 47.37kB (0.19%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
marimo-esm 25.57MB 47.37kB (0.19%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: marimo-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/cells-*.js 222 bytes 750.35kB 0.03%
assets/index-*.css 722 bytes 365.95kB 0.2%
assets/ai-*.js 1.47kB 295.01kB 0.5%
assets/add-*.js 674 bytes 55.23kB 1.24%
assets/cell-*.js 97 bytes 185.65kB 0.05%
assets/file-*.js 869 bytes 54.37kB 1.62%
assets/useNotebookActions-*.js 642 bytes 61.6kB 1.05%
assets/components-*.js 42.35kB 54.12kB 359.7% ⚠️
assets/readonly-*.js 248 bytes 19.05kB 1.32%
assets/useEventListener-*.js 78 bytes 12.55kB 0.63%
assets/config-*.js -7 bytes 7.55kB -0.09%

Files in assets/useEventListener-*.js:

  • ./src/core/hotkeys/hotkeys.ts → Total Size: 10.28kB

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 setting additionalKeywords on this action won’t make “unfold/headers” discoverable unless the hotkey definition (DEFAULT_HOT_KEY["global.expandAllSections"] in frontend/src/core/hotkeys/hotkeys.ts) is updated.
      additionalKeywords: ["unfold", "headers"],

hotkey: "global.collapseAllSections",
handle: collapseAllCells,
redundant: true,
additionalKeywords: ["fold", "headers"],

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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>

@github-actions

github-actions Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report for ./frontend

Status Category Percentage Covered / Total
🔵 Lines 78.77% 81581 / 103558
🔵 Statements 78.77% 81581 / 103558
🔵 Functions 71.22% 693 / 973
🔵 Branches 79.41% 4862 / 6122
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
frontend/src/core/hotkeys/hotkeys.ts 100% 100% 100% 100%
Generated in workflow #20314 for commit 6a95681 by the Vitest Coverage Report Action

@mscolnick
mscolnick requested a review from kirangadhave August 5, 2026 18:02
@kirangadhave
kirangadhave removed their request for review August 7, 2026 00:11
kirangadhave
kirangadhave previously approved these changes Aug 7, 2026
@mscolnick mscolnick added the enhancement New feature or request label Aug 10, 2026
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.
@mscolnick
mscolnick merged commit 58a5bab into main Aug 10, 2026
30 of 31 checks passed
@mscolnick
mscolnick deleted the ms/fix/issue-10459-notebook-actions branch August 10, 2026 13:54
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.23.17-dev24

@callumheron

Copy link
Copy Markdown

@mscolnick Are you able to share how to use this in VScode?

williambdean pushed a commit to williambdean/marimo that referenced this pull request Sep 6, 2026
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.

This branch was successfully deployed

1 active deployment
Preview — 6a956817 Deployed Aug 10, 2026 by vercel[bot]
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.

Fold all markdown sections command

4 participants