Protected_Collection of child disposables to clean up.
ReadonlyonEvent fired when an edit is made with undo/redo handlers. Enables VS Code's edit history functionality.
ReadonlyonEvent fired when the document content or edits change. Listeners receive the updated content and edit history.
ReadonlyonEvent fired when the document is disposed. Used to clean up resources and listeners.
Gets the current notebook content as binary data.
Contains the serialized Jupyter notebook JSON structure. Updated automatically when edits are applied via makeEdit().
Binary representation of the notebook content.
ProtectedisGets whether this instance has been disposed.
True if disposed, false otherwise.
Gets the notebook URI which determines collaborative vs local behavior.
The URI scheme determines the document's behavior:
datalayer://: Collaborative notebook with real-time synchronization.file://: Local notebook with traditional file persistence.untitled:: New unsaved notebook.The VS Code URI for this notebook document.
Protected_Creates a backup of the notebook document.
Saves the current document state to a backup location and returns a backup descriptor for VS Code's backup/restore system.
URI for the backup location.
Cancellation token for the backup operation.
Promise resolving to backup descriptor with cleanup function.
Disposes of the notebook document and releases all associated resources.
Fires disposal events and calls the parent disposable cleanup. Should be called when the document is no longer needed to prevent memory leaks.
Records an edit operation on the notebook document.
Behavior differs based on the URI scheme:
datalayer://): Skips edit tracking since changes
are managed by the Datalayer platform's real-time synchronizationFor local notebooks, updates the document content and fires change events with undo/redo handlers for VS Code's edit history.
The edit operation to apply.
Reverts the notebook document to its last saved state.
Reloads content from disk and restores the edit history to the last saved state. Fires document change events to notify the UI of the content restoration.
Cancellation token (currently unused).
Saves the notebook document to its original location.
Behavior differs based on the URI scheme:
Cancellation token for the save operation.
Saves the notebook document to a specified location.
Handles different scenarios based on URI schemes and target locations:
URI where to save the notebook.
Cancellation token for the save operation.
StaticcreateCreates a new NotebookDocument instance from a URI.
Handles both regular notebook files and backup restoration scenarios. For backup restoration, the backupId parameter should contain the backup file URI. Supports both local file URIs and collaborative Datalayer URIs.
The notebook URI to open.
Optional backup ID for document restoration.
Delegate for webview content retrieval and management.
Promise resolving to the created notebook document instance.
Represents a Jupyter notebook document in VS Code custom editor. Manages document lifecycle, content persistence, and edit tracking with support for both collaborative Datalayer notebooks and local file-based notebooks.
This class implements different behaviors based on the URI scheme:
datalayer://URIs: Collaborative notebooks with real-time sync (read-only locally)file://URIs: Local notebooks with full edit tracking and persistence