Re-exports #
Document Store #
A store of open documents, keyed by URI
- documents : IO.Ref (Std.HashMap String Document)
Instances For
Create an empty document store
Equations
Instances For
Get a document by URI
Instances For
Check if a document exists
Instances For
Document Lifecycle #
Open a new document
Equations
- One or more equations did not get rendered due to their size.
Instances For
Close a document
Equations
- store.closeDocument uri = ST.Ref.modify store.documents fun (docs : Std.HashMap String Lapis.VFS.Document) => docs.erase uri
Instances For
Update document version (without content change)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Editing #
Apply a text edit to a document
Equations
- One or more equations did not get rendered due to their size.
Instances For
Apply multiple edits to a document (edits should be in reverse document order)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Replace entire document content
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reading #
Get full document content
Equations
- store.getContent uri = do let __do_lift ← store.get uri match __do_lift with | none => pure none | some doc => pure (some doc.getContent)
Instances For
Get document byte length
Equations
- store.getByteLength uri = do let __do_lift ← store.get uri match __do_lift with | none => pure none | some doc => pure (some doc.byteLength)
Instances For
Position Conversion #
Convert LSP position to byte offset
Equations
- store.positionToOffset uri pos = do let __do_lift ← store.get uri match __do_lift with | none => pure none | some doc => pure (doc.positionToOffset pos)
Instances For
Convert byte offset to LSP position
Equations
- store.offsetToPosition uri offset = do let __do_lift ← store.get uri match __do_lift with | none => pure none | some doc => pure (some (doc.offsetToPosition offset))
Instances For
Convert a byte range to an LSP range
Equations
- One or more equations did not get rendered due to their size.
Instances For
Convert an LSP range to a byte range
Equations
- One or more equations did not get rendered due to their size.
Instances For
Snapshots #
Create a snapshot of the current document state
Equations
- One or more equations did not get rendered due to their size.
Instances For
Acquire a snapshot (increment reference count)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Release a snapshot (decrement reference count)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Prune unreferenced snapshots
Equations
- One or more equations did not get rendered due to their size.
Instances For
Rebuild document line index
Equations
- One or more equations did not get rendered due to their size.
Instances For
Get list of all open document URIs
Equations
- store.getOpenDocuments = do let docs ← ST.Ref.get store.documents pure docs.keys
Instances For
Modify a document with a function
Equations
- store.modify uri f = ST.Ref.modify store.documents fun (docs : Std.HashMap String Lapis.VFS.Document) => match docs.get? uri with | none => docs | some doc => docs.insert uri (f doc)
Instances For
Convenience Functions #
Create a zero position
Instances For
Create an empty range
Instances For
Create a range at a single point
Equations
Instances For
Create a position from line and character
Equations
- Lapis.VFS.mkPosition line character = { line := line, character := character }
Instances For
Create a range from start and end positions
Equations
- Lapis.VFS.mkRange start «end» = { start := start, «end» := «end» }
Instances For
Create a range from line/character coordinates