mirror of
https://github.com/github/semantic.git
synced 2024-11-27 12:57:49 +03:00
Use Pos 1 1 here for backwards compat.
This commit is contained in:
parent
93e0047b75
commit
7c410bedf4
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE DeriveGeneric, GeneralizedNewtypeDeriving #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
||||
{-|
|
||||
'Source' models source code, represented as a thin wrapper around a 'B.ByteString' with conveniences for splitting by line, slicing, etc.
|
||||
|
||||
@ -37,7 +38,7 @@ import Data.Aeson (FromJSON (..), withText)
|
||||
import qualified Data.ByteString as B
|
||||
import Data.Char (ord)
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Data.Monoid (Last(..))
|
||||
import Data.Monoid (Last (..))
|
||||
import Data.Semilattice.Lower
|
||||
import Data.String (IsString (..))
|
||||
import qualified Data.Text as T
|
||||
@ -45,7 +46,7 @@ import qualified Data.Text.Encoding as T
|
||||
import Data.Text.Encoding.Error (lenientDecode)
|
||||
import GHC.Generics (Generic)
|
||||
import Source.Range
|
||||
import Source.Span (Span(Span), Pos(..))
|
||||
import Source.Span (Pos (..), Span (Span))
|
||||
|
||||
|
||||
-- | The contents of a source file. This is represented as a UTF-8
|
||||
@ -75,7 +76,7 @@ totalRange = Range 0 . B.length . bytes
|
||||
|
||||
-- | Return a 'Span' that covers the entire text.
|
||||
totalSpan :: Source -> Span
|
||||
totalSpan source = Span lowerBound (Pos (Prelude.length ranges) (succ (end lastRange - start lastRange))) where
|
||||
totalSpan source = Span (Pos 1 1) (Pos (Prelude.length ranges) (succ (end lastRange - start lastRange))) where
|
||||
ranges = lineRanges source
|
||||
lastRange = fromMaybe lowerBound (getLast (foldMap (Last . Just) ranges))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user