Copyright | (c) Edward Kmett 2017 |
---|---|
License | BSD2 |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
- newtype Rope = Rope (FingerTree Line)
- splitAtPosition :: Position -> Rope -> (Rope, Rope)
- splitAtDelta :: Delta -> Rope -> (Rope, Rope)
- insertAt :: Position -> Text -> Rope -> Rope
- deleteRange :: Range -> Rope -> Rope
- replaceRange :: Range -> Text -> Rope -> Rope
- deltaToPosition :: Rope -> Delta -> Position
- positionToDelta :: Rope -> Position -> Delta
- data Line = Line {}
- foldLines :: (a -> Text -> a) -> a -> Text -> a
- class FromText a where
- data LineMeasure = LineMeasure !Int !Delta !Summary
- class HasDelta t => HasLineMeasure t where
Documentation
deleteRange :: Range -> Rope -> Rope Source #
deltaToPosition :: Rope -> Delta -> Position Source #
Compute an Language Server Protocol Position
from a Delta
given the associated text
Takes O(log l) where l is the number of lines
positionToDelta :: Rope -> Position -> Delta Source #
Convert from a Language Server Protocol Position
to a Delta
given the associated text.
O(log l) where l is the number of lines
Lines
Summarizing Lines
data LineMeasure Source #
LineMeasure
is not Position
This measures line count and total number of code-units over all lines not the number of code-units on the current line.
Also when used to measure a FingerTree
you can use the FingerTree
to convert
back and forth between Delta
and Position
in O(log l) time, while still
letting us use the compact single-integer Abelian group Delta
representation
internally for almost all positioning.
class HasDelta t => HasLineMeasure t where Source #
lineMeasure :: t -> LineMeasure Source #