1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 05:41:54 +03:00

Compute the line ranges within the range.

This commit is contained in:
Rob Rix 2017-05-19 11:20:52 -04:00
parent 71e3c1d482
commit 61e29e8fdb

View File

@ -121,7 +121,7 @@ rangeToSourceSpan :: Source -> Range -> SourceSpan
rangeToSourceSpan source range = SourceSpan startPos endPos
where startPos = maybe (SourcePos 1 1) (toStartPos 1) (head lineRanges)
endPos = toEndPos (Prologue.length lineRanges) (fromMaybe (Range 0 0) (snd <$> unsnoc lineRanges))
lineRanges = actualLineRanges (slice range source)
lineRanges = actualLineRangesWithin range source
toStartPos line range = SourcePos line (succ (start range))
toEndPos line range = SourcePos line (succ (end range))