Snapshot Types #
Reason for creating a snapshot
- documentOpen : SnapshotReason
- preBatch : SnapshotReason
- analysisCheckpoint : SnapshotReason
- clientRequest : SnapshotReason
Instances For
Equations
- Lapis.VFS.Document.instBEqSnapshotReason.beq x✝ y✝ = (x✝.ctorIdx == y✝.ctorIdx)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
- Lapis.VFS.Document.instBEqSnapshotId.beq { id := a } { id := b } = (a == b)
- Lapis.VFS.Document.instBEqSnapshotId.beq x✝¹ x✝ = false
Instances For
Equations
Equations
- Lapis.VFS.Document.instReprSnapshotId.repr x✝ prec✝ = Std.Format.bracket "{ " (Std.Format.nil ++ Std.Format.text "id" ++ Std.Format.text " := " ++ (Std.Format.nest 6 (repr x✝.id)).group) " }"
Instances For
Instances For
Equations
Instances For
Equations
- Lapis.VFS.Document.SnapshotId.zero = { id := 0 }
Instances For
Instances For
A snapshot of document state at a point in time
- id : SnapshotId
- reason : SnapshotReason
- pieceTable : PieceTable.PieceTableState
- lineIndex : LineIndex.LineIndex
- version : Int
- refCount : Nat
Instances For
Create a new snapshot from current document state
Equations
- Lapis.VFS.Document.Snapshot.create id reason pt li version = { id := id, reason := reason, pieceTable := pt, lineIndex := li, version := version, refCount := 0 }
Instances For
Document State #
Complete state of a single document
- uri : String
- languageId : String
- version : Int
- pieceTable : PieceTable.PieceTableState
- lineIndex : LineIndex.LineIndex
- nextSnapshotId : Nat
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Create a conversion context for position operations
Equations
- doc.conversionContext = { pieceTable := doc.pieceTable, lineIndex := doc.lineIndex }
Instances For
Text Operations #
Get text in a byte range
Equations
- doc.getTextByteRange startByte endByte = doc.pieceTable.getTextByteRange startByte endByte
Instances For
Get text for a specific line
Equations
- doc.getLine line = doc.conversionContext.getLineContentTrimmed line
Instances For
Get text in an LSP range
Equations
- One or more equations did not get rendered due to their size.
Instances For
Edit Operations #
Apply an edit using LSP positions
Equations
- One or more equations did not get rendered due to their size.
Instances For
Apply multiple edits (must be in reverse document order)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Delete text in a range
Equations
- doc.deleteRange range newVersion = doc.applyEdit range "" newVersion
Instances For
Position Conversion #
Convert LSP position to byte offset
Equations
- doc.positionToOffset pos = Lapis.VFS.Position.positionToByteOffset doc.conversionContext pos
Instances For
Convert byte offset to LSP position
Equations
- doc.offsetToPosition offset = Lapis.VFS.Position.byteOffsetToPosition doc.conversionContext offset
Instances For
Snapshot Operations #
Create a new snapshot of current state
Equations
- One or more equations did not get rendered due to their size.
Instances For
Find a snapshot by ID
Equations
- doc.findSnapshot id = Option.map (fun (idx : Nat) => (idx, doc.snapshots[idx]!)) (Array.findIdx? (fun (x : Lapis.VFS.Document.Snapshot) => x.id == id) doc.snapshots)
Instances For
Acquire a snapshot (increment ref count)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Release a snapshot (decrement ref count)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Get the piece table from a snapshot
Equations
- doc.getSnapshotPieceTable id = match doc.findSnapshot id with | none => none | some (fst, snap) => some snap.pieceTable
Instances For
Get the line index from a snapshot
Equations
Instances For
Line Index Management #
Force a full rebuild of the line index
Equations
- One or more equations did not get rendered due to their size.
Instances For
Compact the piece table (merge adjacent pieces)
Equations
- One or more equations did not get rendered due to their size.