Skip to content

Collapse hide_code cells on notebook open#619

Merged
manzt merged 2 commits into
mainfrom
push-xputvsywwkvx
Jun 24, 2026
Merged

Collapse hide_code cells on notebook open#619
manzt merged 2 commits into
mainfrom
push-xputvsywwkvx

Conversation

@manzt

@manzt manzt commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Closes #326

marimo's hide_code=True cell config round-tripped through serialization but never reached the editor. VS Code exposes the input-collapsed state as view-only, so sadly a real two-way binding isn't straight forward.

These changes introduce a one-way sync. The first time a marimo notebook becomes the active editor, we collapse the input of every hide_code cell, once. A per-session set of notebook ids keeps a tab refocus from slamming shut a cell the user expanded to edit.

Copilot AI review requested due to automatic review settings June 24, 2026 18:43
@manzt manzt added the enhancement New feature or request label Jun 24, 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.

Pull request overview

Implements support for marimo @app.cell(hide_code=True) by collapsing the input editor for those cells when a marimo notebook is first activated in VS Code (one-way sync, once per notebook per session), addressing issue #326.

Changes:

  • Add MarimoNotebookCell.isCodeHidden derived from metadata.options.hide_code.
  • Introduce HideCodeSyncLive feature that collapses inputs for hide_code cells on first notebook activation.
  • Add unit tests for the range-selection logic and the “collapse once” behavior, and register the built-in command type.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
extension/src/schemas/MarimoNotebookDocument.ts Exposes hide_code via a new isCodeHidden getter on cells.
extension/src/features/Main.ts Wires the new HideCodeSyncLive layer into extension startup.
extension/src/features/HideCodeSync.ts Implements the one-way, once-per-session collapse sync using notebook.cell.collapseCellInput.
extension/src/features/tests/HideCodeSync.test.ts Adds tests for hidden cell range selection and “collapse once” semantics.
extension/src/commands.ts Extends built-in command typing to include notebook.cell.collapseCellInput.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread extension/src/features/HideCodeSync.ts Outdated
@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Area Lines Branches Functions
Python 50.15% (545 / 1030) 39.55% (106 / 268)
TypeScript 49.43% (2401 / 4857) 40.80% (948 / 2323) 46.26% (657 / 1420)

TypeScript statements: 49.23% (2507 / 5092)

Closes #326

marimo's `hide_code=True` cell config round-tripped through
serialization but never reached the editor. VS Code exposes the
input-collapsed state as view-only, so sadly a real two-way binding
isn't straight forward.

These changes introduce a one-way sync. The first time a marimo notebook
becomes the active editor, we collapse the input of every `hide_code`
cell, once. A per-session set of notebook ids keeps a tab refocus from
slamming shut a cell the user expanded to edit.
@manzt manzt force-pushed the push-xputvsywwkvx branch from d63bd39 to 5e2219f Compare June 24, 2026 18:47
@manzt manzt force-pushed the push-xputvsywwkvx branch from 8e19a1a to effe1ee Compare June 24, 2026 20:09
@manzt manzt merged commit 157ab4a into main Jun 24, 2026
10 checks passed
@manzt manzt deleted the push-xputvsywwkvx branch June 24, 2026 20:18
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 hidden cells

2 participants