Editable cell-based JupyterNotebookView + read-only output rendering#12303
Closed
evelyn-with-warp wants to merge 1 commit into
Closed
Editable cell-based JupyterNotebookView + read-only output rendering#12303evelyn-with-warp wants to merge 1 commit into
evelyn-with-warp wants to merge 1 commit into
Conversation
Implements the view slice of the editable .ipynb feature (gated behind FeatureFlag::JupyterNotebookEditing). Builds on the committed lossless NotebookDoc model. - jupyter/mod.rs: JupyterNotebookView (View + Entity + TypedActionView + BackingView). Markdown cells -> editable RichTextEditorView; code cells -> editable, syntax-highlighted CodeEditorView using NotebookDoc::language(); saved outputs render read-only beneath code cells. Parse via NotebookDoc::parse; on error falls back to an editable raw-text code editor (never blank, never panics). Dirty tracking only on user-originated edits; cell structural ops (insert/delete/move/convert). Public API: new, set_content, to_json, is_dirty, mark_saved, request_save, path, title, pane_configuration; events Dirtied/SaveRequested/RawRequested/Focused/Pane. - jupyter/output.rs: strip_ansi, classify_outputs (stream / text/plain / error traceback as preformatted text; image/png + image/jpeg decoded inline; invalid base64 -> placeholder; display-only size guards that never alter saved bytes). - notebooks/file/mod.rs: pub(crate) mod jupyter; (so the routing/pane can host). - Tests: output classification + strip_ansi unit tests; view tests for fallback, round-trip, read-only outputs, markdown/code edit sync, reload, structural ops, path/title. Co-Authored-By: Oz <oz-agent@warp.dev>
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.
Description
Implements the view slice of the editable, cell-based Jupyter
.ipynbfeature, building on the committed losslessNotebookDocmodel. All behavior is gated (by the routing chokepoint, on the integration branch) behindFeatureFlag::JupyterNotebookEditing.JupyterNotebookViewparses content viaNotebookDoc::parseand renders each cell as an editable surface:RichTextEditorView/NotebooksEditorModel), serialized back toCellDoc.sourceon edit.CodeEditorViewusingNotebookDoc::language(); source stored verbatim.text/plain/ ANSI-stripped tracebacks as preformatted text;image/png/image/jpegdecoded inline; invalid base64 → placeholder; display-only size guards that never alter saved bytes).Editing only updates the edited cell's
source(user-originated edits only); savedoutputsand untouched cells are never mutated. Cell structural ops (insert/delete/move/convert). Robust fallback: unparseable.ipynbshows raw editable text and emitsRawRequestedso the host opens the real code editor — never blank, never panics.This is edit-only: no kernel, no execution.
Main files to review
app/src/notebooks/file/jupyter/mod.rs—JupyterNotebookView(View+Entity+TypedActionView+BackingView), edit→model sync, dirty tracking, structural ops, public API + events.app/src/notebooks/file/jupyter/output.rs—strip_ansi,classify_outputs, image decode + display-only size guards.Minor file changes
app/src/notebooks/file/mod.rs— addspub(crate) mod jupyter;so the routing/pane can host the view.app/src/notebooks/file/jupyter/{mod_tests.rs, output_tests.rs}— unit/view tests.Public API (for the routing/integration branch)
new(content, path, ctx),set_content,to_json,is_dirty,mark_saved,request_save,path,title,pane_configuration. Events:Dirtied,SaveRequested { json },RawRequested { json },Focused,Pane(PaneEvent).BackingView::PaneHeaderOverflowMenuAction = JupyterNotebookAction.Validation
cargo check -p warp --tests: passes (no errors).cargo nextest run -p warp jupyter: 19/19 pass../script/format: clean.cargo clippy -p warp --tests: the only findings in this module arenever used/constructeddead-code — expected because routing isn't wired on this branch (same class as the base branch's currently-unusedipynb_model); resolves once the integration branch wiresJupyterNotebookView::new+NotebookDoc::parse.Conversation: https://staging.warp.dev/conversation/7eb55c0a-58d5-43e8-88d7-1deda8c567a8
Run: https://oz.staging.warp.dev/runs/019e9a20-4cd6-7283-8e9d-3b233cbd8a21
This PR was generated with Oz.