A line entry stores the byte length of a single line (including newline if present)
- byteLength : Nat
Instances For
Equations
- Lapis.VFS.LineIndex.instInhabitedLineEntry.default = { byteLength := default }
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lapis.VFS.LineIndex.instMeasurableLineEntry = { measure := fun (entry : Lapis.VFS.LineIndex.LineEntry) => { bytes := entry.byteLength, utf16Units := 0, lines := 1 } }
Line index using a finger tree of line entries
- lines : FingerTree.FingerTree LineEntry
Finger tree of line entries, one per line
- docLength : Nat
Total byte length of the document
Instances For
Equations
Instances For
Create an empty line index (single empty line)
Equations
- Lapis.VFS.LineIndex.LineIndex.empty = { lines := Lapis.VFS.FingerTree.FingerTree.single { byteLength := 0 }, docLength := 0 }
Instances For
Check if a line number is valid
Equations
- idx.isValidLine line = decide (line < idx.lineCount)
Instances For
Build a complete line index from document content
Equations
- One or more equations did not get rendered due to their size.
Instances For
Find which line a byte offset falls on - O(log n)
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Lapis.VFS.LineIndex.LineIndex.applyEdit
(idx : LineIndex)
(startByte oldLength : Nat)
(newText : String)
(newDocLength : Nat)
:
Apply an incremental edit to the line index - O(log n)
Parameters:
startByte: byte offset where the edit startsoldLength: number of bytes removed (0 for pure insert)newText: the text being insertednewDocLength: total document length after the edit
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Lapis.VFS.LineIndex.LineIndex.applyEdit.rebuildTree
(tree : FingerTree.FingerTree LineEntry)
(startLine endLine : Nat)
(newEntries : Array LineEntry)
:
Equations
- One or more equations did not get rendered due to their size.