{- ORMOLU_DISABLE -}
{- HLINT ignore -}
-- THIS IS A GENERATED FILE, DO NOT EDIT

{-# 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

{-|
Represents the connection of two locations. Provides additional metadata over normal `Location`,
including an origin range.
-}
data LocationLink = LocationLink 
  { {-|
  Span of the origin of this link.

  Used as the underlined span for mouse interaction. Defaults to the word range at
  the definition position.
  -}
  LocationLink -> Maybe Range
_originSelectionRange :: (Maybe Language.LSP.Protocol.Internal.Types.Range.Range)
  , {-|
  The target resource identifier of this link.
  -}
  LocationLink -> Uri
_targetUri :: Language.LSP.Protocol.Types.Uri.Uri
  , {-|
  The full target range of this link. If the target for example is a symbol then target range is the
  range enclosing this symbol not including leading/trailing whitespace but everything else
  like comments. This information is typically used to highlight the range in the editor.
  -}
  LocationLink -> Range
_targetRange :: Language.LSP.Protocol.Internal.Types.Range.Range
  , {-|
  The range that should be selected and revealed when this link is being followed, e.g the name of a function.
  Must be contained by the `targetRange`. See also `DocumentSymbol#range`
  -}
  LocationLink -> Range
_targetSelectionRange :: Language.LSP.Protocol.Internal.Types.Range.Range
  }
  deriving stock (Int -> LocationLink -> ShowS
[LocationLink] -> ShowS
LocationLink -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LocationLink] -> ShowS
$cshowList :: [LocationLink] -> ShowS
show :: LocationLink -> String
$cshow :: LocationLink -> String
showsPrec :: Int -> LocationLink -> ShowS
$cshowsPrec :: Int -> LocationLink -> ShowS
Show, LocationLink -> LocationLink -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LocationLink -> LocationLink -> Bool
$c/= :: LocationLink -> LocationLink -> Bool
== :: LocationLink -> LocationLink -> Bool
$c== :: LocationLink -> LocationLink -> Bool
Eq, Eq 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
min :: LocationLink -> LocationLink -> LocationLink
$cmin :: LocationLink -> LocationLink -> LocationLink
max :: LocationLink -> LocationLink -> LocationLink
$cmax :: LocationLink -> LocationLink -> LocationLink
>= :: LocationLink -> LocationLink -> Bool
$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
compare :: LocationLink -> LocationLink -> Ordering
$ccompare :: LocationLink -> LocationLink -> Ordering
Ord, 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
$cto :: forall x. Rep LocationLink x -> LocationLink
$cfrom :: forall x. LocationLink -> Rep LocationLink x
Generic)
  deriving anyclass (LocationLink -> ()
forall a. (a -> ()) -> NFData a
rnf :: LocationLink -> ()
$crnf :: LocationLink -> ()
NFData, Eq LocationLink
Int -> LocationLink -> Int
LocationLink -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: LocationLink -> Int
$chash :: LocationLink -> Int
hashWithSalt :: Int -> LocationLink -> Int
$chashWithSalt :: Int -> LocationLink -> Int
Hashable)
  deriving forall ann. [LocationLink] -> Doc ann
forall ann. LocationLink -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [LocationLink] -> Doc ann
$cprettyList :: forall ann. [LocationLink] -> Doc ann
pretty :: forall ann. LocationLink -> Doc ann
$cpretty :: 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 forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall a b. (a -> b) -> a -> b
$  [String
"originSelectionRange" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Range
arg0
    ,[Key
"targetUri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Uri
arg1]
    ,[Key
"targetRange" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Range
arg2]
    ,[Key
"targetSelectionRange" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Range
arg3]]

instance Aeson.FromJSON LocationLink where
  parseJSON :: Value -> Parser LocationLink
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"LocationLink" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe Range -> Uri -> Range -> Range -> LocationLink
LocationLink forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Aeson..:! Key
"originSelectionRange" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"targetUri" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"targetRange" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"targetSelectionRange"