Collapse hide_code cells on notebook open#619
Merged
Merged
Conversation
There was a problem hiding this comment.
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.isCodeHiddenderived frommetadata.options.hide_code. - Introduce
HideCodeSyncLivefeature that collapses inputs forhide_codecells 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.
Contributor
Coverage Report
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #326
marimo's
hide_code=Truecell 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_codecell, once. A per-session set of notebook ids keeps a tab refocus from slamming shut a cell the user expanded to edit.