mirror of
https://github.com/haskell/ghcide.git
synced 2024-12-16 06:36:30 +03:00
Add property tests for PositionMapping (#2265)
This commit is contained in:
parent
61c37a93b3
commit
904ab6d6fa
@ -41,8 +41,8 @@ applyChange posMapping _ = posMapping
|
||||
|
||||
toCurrent :: Range -> T.Text -> Position -> Maybe Position
|
||||
toCurrent (Range (Position startLine startColumn) (Position endLine endColumn)) t (Position line column)
|
||||
| line < startLine || line == startLine && column <= startColumn =
|
||||
-- Position is before the change and thereby unchanged
|
||||
| line < startLine || line == startLine && column < startColumn =
|
||||
-- Position is before the change and thereby unchanged.
|
||||
Just $ Position line column
|
||||
| line > endLine || line == endLine && column >= endColumn =
|
||||
-- Position is after the change so increase line and column number
|
||||
@ -63,7 +63,7 @@ toCurrent (Range (Position startLine startColumn) (Position endLine endColumn))
|
||||
|
||||
fromCurrent :: Range -> T.Text -> Position -> Maybe Position
|
||||
fromCurrent (Range (Position startLine startColumn) (Position endLine endColumn)) t (Position line column)
|
||||
| line < startLine || line == startLine && column <= startColumn =
|
||||
| line < startLine || line == startLine && column < startColumn =
|
||||
-- Position is before the change and thereby unchanged
|
||||
Just $ Position line column
|
||||
| line > newEndLine || line == newEndLine && column >= newEndColumn =
|
||||
|
Loading…
Reference in New Issue
Block a user