Skip to main content

Module document

Module document 

Source
Expand description

Editor lifecycle of documents (open / close) and the cached-copy rules. Editor lifecycle of documents: didOpen / didClose.

A URL can be both a document the server loaded by itself (Background: LOV ontologies, owl:imports, configured ontologies and shapes) and one the user opens in the editor, e.g. after goto-definition into the ontology cache. They share one entity, with these rules:

  • While the editor has it Open, the editor buffer is the document’s text. Edits are analysed like any open document, but never reach the shared store (load_store skips open documents), and a late background load does not overwrite the buffer (spawn_background).
  • On close, a background document gets the server’s copy back: the file on disk (for the cache, the server’s snapshot; for the user’s own file, what they saved), or the Snapshot taken on open.

The LSP has no way to make a document read-only in the editor. Cache files are read-only on disk, and opening one shows a notice explaining that edits are not used.

Enums§

Closed
Outcome of close_document.

Functions§

close_document
The editor closed url: stop treating it as open and clear its diagnostics.
open_document
Open item in the editor and parse it. Returns its entity.
remove_background
Give a closed background document the server’s content back and reparse it, which reloads its triples in the store. A background document’s file was deleted: drop its triples and shapes, and the document itself, unless the editor has it open.
restore_background
save_document
The editor saved url. For one of the user’s own background documents (not a cache file), the saved content now feeds the shared store, so other documents see its classes and properties. Unsaved edits never do.