AbstractThe document type (NotebookDocument or LexicalDocument)
Creates a new base document provider.
Extension context
Protected Readonly_Map of request ID to response callbacks for request/response message pattern.
Protected Readonly_VS Code extension context providing access to storage, subscriptions, etc.
Protected Readonly_Message router for handling webview messages and routing to appropriate handlers.
Protected Readonly_Network bridge service for HTTP/WebSocket communication between extension and webview.
Protected Readonly_Event emitter for document changes. Subclasses should fire this event when documents change.
Private_Counter for generating unique request IDs in request/response pattern.
Protected Readonly_Map of webview panels to their Runner instances. Runners handle tool execution via the BridgeExecutor pattern.
Protected Readonly_Runtime bridge service for managing runtime lifecycle and selection.
ReadonlyonEvent for document changes (required by CustomEditorProvider interface).
Backs up the document. Default implementation throws - subclasses should override if needed.
Document to backup
Backup context
Cancellation token
Promise resolving to backup information
Protected AbstractgetGets the URI for a document. Subclasses must implement this to extract the URI from their document type.
The document
The document URI
ProtectedgetGets the Runner for a specific webview panel.
The webview panel
The Runner instance, or undefined if not initialized
ProtectedinitializeInitializes a Runner for a webview panel. Subclasses should call this in their resolveCustomEditor implementation.
The Runner uses a BridgeExecutor to send tool execution requests to the webview, where they are executed by the webview's own Runner with DefaultExecutor.
The webview panel to create a Runner for
The created Runner instance
ProtectedonHandles messages received from the webview. Delegates to the message router for all message types.
The webview panel that sent the message
The document associated with the webview
The message from the webview
AbstractopenOpens a custom document. Subclasses must implement document creation logic.
Document URI
Open context with backup information
Cancellation token
Promise resolving to the document
ProtectedpostPosts a message to the webview without expecting a response.
Target webview panel
Message type
Message body
Optionalid: stringOptional message ID
ProtectedpostPosts a message to the webview and waits for a response. Uses the request/response pattern with requestId tracking.
Target webview panel
Message type
Message body
Promise resolving to the response
ProtectedregisterRegisters all message handlers with the message router. Called during constructor initialization. Subclasses can override to add custom handlers.
AbstractresolveResolves a custom editor for a document. Subclasses must implement webview setup logic.
The document to display
The webview panel to use
Cancellation token
Promise that resolves when editor is ready
Reverts the document to its saved state. Default implementation throws - subclasses should override if needed.
Document to revert
Cancellation token
Promise that resolves when revert is complete
Saves the document. Default implementation throws - subclasses should override if saving is supported.
Document to save
Cancellation token
Promise that resolves when save is complete
Saves the document to a new location. Default implementation throws - subclasses should override if needed.
Document to save
Destination URI
Cancellation token
Promise that resolves when save is complete
Abstract base class for document providers. Handles common provider patterns including webview lifecycle, message routing, and request/response.