module Language.LSP.Protocol.Types.Location where
import Language.LSP.Protocol.Internal.Types.Position
import Language.LSP.Protocol.Internal.Types.Range
import Language.LSP.Protocol.Types.Common
mkRange :: UInt -> UInt -> UInt -> UInt -> Range
mkRange :: UInt -> UInt -> UInt -> UInt -> Range
mkRange UInt
l UInt
c UInt
l' UInt
c' = Position -> Position -> Range
Range (UInt -> UInt -> Position
Position UInt
l UInt
c) (UInt -> UInt -> Position
Position UInt
l' UInt
c')
isSubrangeOf :: Range -> Range -> Bool
isSubrangeOf :: Range -> Range -> Bool
isSubrangeOf Range
smallRange Range
range = Range -> Position
_start Range
smallRange forall a. Ord a => a -> a -> Bool
>= Range -> Position
_start Range
range Bool -> Bool -> Bool
&& Range -> Position
_end Range
smallRange forall a. Ord a => a -> a -> Bool
<= Range -> Position
_end Range
range
positionInRange :: Position -> Range -> Bool
positionInRange :: Position -> Range -> Bool
positionInRange Position
p (Range Position
sp Position
ep) = Position
sp forall a. Ord a => a -> a -> Bool
<= Position
p Bool -> Bool -> Bool
&& Position
p forall a. Ord a => a -> a -> Bool
< Position
ep