Skip to main content

Module OpenDocument

Module OpenDocument 

Source
Expand description

Document opening and content resolution logic.

Implements OpenDocument for MountainEnvironment. Resolution order:

  1. Already open - if the URI is already in OpenDocuments, re-emits sky://documents/open so the Sky workbench focuses the existing tab and returns immediately without a disk read.
  2. Caller-supplied content - if the content argument is Some, it is used verbatim (used by untitled / virtual documents).
  3. file:// URI - content is read from disk via ApplicationRunTime.
  4. Custom scheme - content is fetched from the Cocoon sidecar via $provideTextDocumentContent RPC (10 s timeout). This covers schemes like git:, output:, vscode-notebook-cell:, etc.

On success, a new DocumentStateDTO is inserted into OpenDocuments, sky://documents/open is emitted to the Sky workbench, and $acceptModelAdded is sent to Cocoon.

Functionsยง

open_document ๐Ÿ”’
Opens a document. If the URI scheme is not native (file), it attempts to resolve the content from a registered sidecar provider (TextDocumentContentProvider).