Expand description
DocumentProvider: opens, closes, and tracks text document state.
Β§DocumentProvider (Environment)
Implements the DocumentProvider trait, managing the complete lifecycle of
document operations including opening, saving, editing, and closing. It
maintains document state, coordinates between the frontend (Sky), extension
host (Cocoon), and filesystem, and handles both native file URIs and custom
scheme URIs.
Β§Implementation Strategy
The trait implementation is split across multiple helper modules for maintainability:
OpenDocument: Document opening and content resolution (file:// and custom schemes)SaveOperations: SaveDocument, SaveDocumentAs, SaveAllDocumentsApplyChanges: ApplyDocumentChanges (incremental text edits)Notifications: NotifyModelAdded, NotifyModelChanged, NotifyModelSaved, NotifyModelRemoved
The single impl DocumentProvider for MountainEnvironment block in this
file delegates to those helper functions. This satisfies Rustβs orphan rules
while keeping code organized and atomic.
ModulesΒ§
- Apply
Changes π - Document change application logic.
- Notifications π
- Document lifecycle notification helpers.
- Open
Document π - Document opening and content resolution logic.
- Save
Operations π - Document save operations.