Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- newtype PositionMapping = PositionMapping PositionDelta
- data PositionResult a
- = PositionRange {
- unsafeLowerRange :: a
- unsafeUpperRange :: a
- | PositionExact !a
- = PositionRange {
- lowerRange :: PositionResult a -> a
- upperRange :: PositionResult a -> a
- positionResultToMaybe :: PositionResult a -> Maybe a
- fromCurrentPosition :: PositionMapping -> Position -> Maybe Position
- toCurrentPosition :: PositionMapping -> Position -> Maybe Position
- data PositionDelta = PositionDelta {
- toDelta :: !(Position -> PositionResult Position)
- fromDelta :: !(Position -> PositionResult Position)
- addOldDelta :: PositionDelta -> PositionMapping -> PositionMapping
- idDelta :: PositionDelta
- composeDelta :: PositionDelta -> PositionDelta -> PositionDelta
- mkDelta :: [TextDocumentContentChangeEvent] -> PositionDelta
- toCurrentRange :: PositionMapping -> Range -> Maybe Range
- fromCurrentRange :: PositionMapping -> Range -> Maybe Range
- applyChange :: PositionDelta -> TextDocumentContentChangeEvent -> PositionDelta
- zeroMapping :: PositionMapping
- deltaFromDiff :: Text -> Text -> PositionDelta
- toCurrent :: Range -> Text -> Position -> PositionResult Position
- fromCurrent :: Range -> Text -> Position -> PositionResult Position
Documentation
data PositionResult a Source #
Either an exact position, or the range of text that was substituted
PositionRange | Fields need to be non-strict otherwise bind is exponential |
| |
PositionExact !a |
Instances
lowerRange :: PositionResult a -> a Source #
upperRange :: PositionResult a -> a Source #
positionResultToMaybe :: PositionResult a -> Maybe a Source #
toCurrentPosition :: PositionMapping -> Position -> Maybe Position Source #
data PositionDelta Source #
PositionDelta | |
|
Instances
Show PositionDelta Source # | |
Defined in Development.IDE.Core.PositionMapping showsPrec :: Int -> PositionDelta -> ShowS # show :: PositionDelta -> String # showList :: [PositionDelta] -> ShowS # | |
NFData PositionDelta Source # | |
Defined in Development.IDE.Core.PositionMapping rnf :: PositionDelta -> () # |
:: PositionDelta | delta from version k - 1 to version k |
-> PositionMapping | The input mapping is from version k to version n |
-> PositionMapping | The output mapping is from version k - 1 to version n |
addOldDelta Add a old delta onto a Mapping k n to make a Mapping (k - 1) n
composeDelta :: PositionDelta -> PositionDelta -> PositionDelta Source #
Compose two position mappings. Composes in the same way as function composition (ie the second argument is applied to the position first).
mkDelta :: [TextDocumentContentChangeEvent] -> PositionDelta Source #
Convert a set of changes into a delta from k to k + 1
toCurrentRange :: PositionMapping -> Range -> Maybe Range Source #
fromCurrentRange :: PositionMapping -> Range -> Maybe Range Source #
applyChange :: PositionDelta -> TextDocumentContentChangeEvent -> PositionDelta Source #
deltaFromDiff :: Text -> Text -> PositionDelta Source #
fromCurrent :: Range -> Text -> Position -> PositionResult Position Source #