Skip to main content

Module Model

Module Model 

Source
Expand description

§Text Model registry + TextFile handlers

Two related responsibilities sharing the same dispatcher family:

  • Model* - Monaco-side text model registry. Mountain owns ApplicationState.Feature.Documents; Wind reads/writes through these handlers so the document state survives a webview reload.
  • Textfile* - disk-only paths that bypass the registry. Used for tooling reads (settings, manifests) and for the actual save round-trip.

Layout (one export per file, file name = identity):

  • ModelOpen::ModelOpen, ModelClose::ModelClose, ModelGet::ModelGet, ModelGetAll::ModelGetAll, ModelUpdateContent::ModelUpdateContent.
  • TextfileRead::TextfileRead, TextfileWrite::TextfileWrite, TextfileSave::TextfileSave.

Modules§

ModelClose
Close a text model. Drops the entry from ApplicationState.Feature.Documents. Idempotent - closing an already-closed URI is a no-op.
ModelGet
Snapshot a single open text model. Returns { uri, content, version, languageId } or null when the URI isn’t currently open. content is rejoined from Lines using the document’s EOL so the wire shape matches VS Code’s TextDocument.getText().
ModelGetAll
Bulk snapshot of every open text model. Used by Wind on workbench restore to repopulate the Monaco model registry without per-tab ModelOpen round-trips.
ModelOpen
Open a text model: read content from disk, derive language ID from the extension, register the resulting DocumentStateDTO in ApplicationState.Feature.Documents, and return { uri, content, version, languageId } to Wind.
ModelUpdateContent
Replace an open model’s content. Increments Version, recomputes Lines, marks IsDirty=true. Mirrors VS Code’s TextDocument.update(...) semantics - the Monaco model observers see a single coherent edit, not partial state.
TextfileRead
Read a text file from disk verbatim. Distinct from ModelOpen - this returns the bytes without registering a DocumentStateDTO. Used by tooling paths that want raw content (e.g. import resolvers, settings inspectors).
TextfileSave
Save-intent hint. Actual disk write happens via TextfileWrite; this command exists so Wind can clear the editor’s dirty-dot UI marker without writing twice. Logged at the vfs tag so a save trace appears in Mountain.dev.log.
TextfileWrite
Write text to a file on disk. Counterpart to TextfileRead; does not touch the document registry. Callers wanting Monaco to observe the change should follow up with ModelUpdateContent for the same URI.