{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-unused-matches #-}
{-# OPTIONS_GHC -Wno-deprecations #-}
module Language.LSP.Protocol.Internal.Types.LocationLink where
import Control.DeepSeq
import Data.Hashable
import GHC.Generics
import Language.LSP.Protocol.Utils.Misc
import Prettyprinter
import qualified Data.Aeson as Aeson
import qualified Data.Row.Aeson as Aeson
import qualified Data.Row.Hashable as Hashable
import qualified Language.LSP.Protocol.Internal.Types.Range
import qualified Language.LSP.Protocol.Types.Common
import qualified Language.LSP.Protocol.Types.Uri
data LocationLink = LocationLink
{
LocationLink -> Maybe Range
_originSelectionRange :: (Maybe Language.LSP.Protocol.Internal.Types.Range.Range)
,
LocationLink -> Uri
_targetUri :: Language.LSP.Protocol.Types.Uri.Uri
,
LocationLink -> Range
_targetRange :: Language.LSP.Protocol.Internal.Types.Range.Range
,
LocationLink -> Range
_targetSelectionRange :: Language.LSP.Protocol.Internal.Types.Range.Range
}
deriving stock (Int -> LocationLink -> ShowS
[LocationLink] -> ShowS
LocationLink -> String
(Int -> LocationLink -> ShowS)
-> (LocationLink -> String)
-> ([LocationLink] -> ShowS)
-> Show LocationLink
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LocationLink -> ShowS
showsPrec :: Int -> LocationLink -> ShowS
$cshow :: LocationLink -> String
show :: LocationLink -> String
$cshowList :: [LocationLink] -> ShowS
showList :: [LocationLink] -> ShowS
Show, LocationLink -> LocationLink -> Bool
(LocationLink -> LocationLink -> Bool)
-> (LocationLink -> LocationLink -> Bool) -> Eq LocationLink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LocationLink -> LocationLink -> Bool
== :: LocationLink -> LocationLink -> Bool
$c/= :: LocationLink -> LocationLink -> Bool
/= :: LocationLink -> LocationLink -> Bool
Eq, Eq LocationLink
Eq LocationLink =>
(LocationLink -> LocationLink -> Ordering)
-> (LocationLink -> LocationLink -> Bool)
-> (LocationLink -> LocationLink -> Bool)
-> (LocationLink -> LocationLink -> Bool)
-> (LocationLink -> LocationLink -> Bool)
-> (LocationLink -> LocationLink -> LocationLink)
-> (LocationLink -> LocationLink -> LocationLink)
-> Ord LocationLink
LocationLink -> LocationLink -> Bool
LocationLink -> LocationLink -> Ordering
LocationLink -> LocationLink -> LocationLink
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: LocationLink -> LocationLink -> Ordering
compare :: LocationLink -> LocationLink -> Ordering
$c< :: LocationLink -> LocationLink -> Bool
< :: LocationLink -> LocationLink -> Bool
$c<= :: LocationLink -> LocationLink -> Bool
<= :: LocationLink -> LocationLink -> Bool
$c> :: LocationLink -> LocationLink -> Bool
> :: LocationLink -> LocationLink -> Bool
$c>= :: LocationLink -> LocationLink -> Bool
>= :: LocationLink -> LocationLink -> Bool
$cmax :: LocationLink -> LocationLink -> LocationLink
max :: LocationLink -> LocationLink -> LocationLink
$cmin :: LocationLink -> LocationLink -> LocationLink
min :: LocationLink -> LocationLink -> LocationLink
Ord, (forall x. LocationLink -> Rep LocationLink x)
-> (forall x. Rep LocationLink x -> LocationLink)
-> Generic LocationLink
forall x. Rep LocationLink x -> LocationLink
forall x. LocationLink -> Rep LocationLink x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. LocationLink -> Rep LocationLink x
from :: forall x. LocationLink -> Rep LocationLink x
$cto :: forall x. Rep LocationLink x -> LocationLink
to :: forall x. Rep LocationLink x -> LocationLink
Generic)
deriving anyclass (LocationLink -> ()
(LocationLink -> ()) -> NFData LocationLink
forall a. (a -> ()) -> NFData a
$crnf :: LocationLink -> ()
rnf :: LocationLink -> ()
NFData, Eq LocationLink
Eq LocationLink =>
(Int -> LocationLink -> Int)
-> (LocationLink -> Int) -> Hashable LocationLink
Int -> LocationLink -> Int
LocationLink -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> LocationLink -> Int
hashWithSalt :: Int -> LocationLink -> Int
$chash :: LocationLink -> Int
hash :: LocationLink -> Int
Hashable)
deriving (forall ann. LocationLink -> Doc ann)
-> (forall ann. [LocationLink] -> Doc ann) -> Pretty LocationLink
forall ann. [LocationLink] -> Doc ann
forall ann. LocationLink -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. LocationLink -> Doc ann
pretty :: forall ann. LocationLink -> Doc ann
$cprettyList :: forall ann. [LocationLink] -> Doc ann
prettyList :: forall ann. [LocationLink] -> Doc ann
Pretty via (ViaJSON LocationLink)
instance Aeson.ToJSON LocationLink where
toJSON :: LocationLink -> Value
toJSON (LocationLink Maybe Range
arg0 Uri
arg1 Range
arg2 Range
arg3) = [Pair] -> Value
Aeson.object ([Pair] -> Value) -> [Pair] -> Value
forall a b. (a -> b) -> a -> b
$ [[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Pair]] -> [Pair]) -> [[Pair]] -> [Pair]
forall a b. (a -> b) -> a -> b
$ [String
"originSelectionRange" String -> Maybe Range -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Range
arg0
,[Key
"targetUri" Key -> Uri -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Uri
arg1]
,[Key
"targetRange" Key -> Range -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Range
arg2]
,[Key
"targetSelectionRange" Key -> Range -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Range
arg3]]
instance Aeson.FromJSON LocationLink where
parseJSON :: Value -> Parser LocationLink
parseJSON = String
-> (Object -> Parser LocationLink) -> Value -> Parser LocationLink
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"LocationLink" ((Object -> Parser LocationLink) -> Value -> Parser LocationLink)
-> (Object -> Parser LocationLink) -> Value -> Parser LocationLink
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe Range -> Uri -> Range -> Range -> LocationLink
LocationLink (Maybe Range -> Uri -> Range -> Range -> LocationLink)
-> Parser (Maybe Range)
-> Parser (Uri -> Range -> Range -> LocationLink)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser (Maybe Range)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"originSelectionRange" Parser (Uri -> Range -> Range -> LocationLink)
-> Parser Uri -> Parser (Range -> Range -> LocationLink)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg Object -> Key -> Parser Uri
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"targetUri" Parser (Range -> Range -> LocationLink)
-> Parser Range -> Parser (Range -> LocationLink)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg Object -> Key -> Parser Range
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"targetRange" Parser (Range -> LocationLink)
-> Parser Range -> Parser LocationLink
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg Object -> Key -> Parser Range
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"targetSelectionRange"