{- 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.Hover 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.MarkedString
import qualified Language.LSP.Protocol.Internal.Types.MarkupContent
import qualified Language.LSP.Protocol.Internal.Types.Range
import qualified Language.LSP.Protocol.Types.Common

{-|
The result of a hover request.
-}
data Hover = Hover 
  { {-|
  The hover's content
  -}
  Hover -> MarkupContent |? (MarkedString |? [MarkedString])
_contents :: (Language.LSP.Protocol.Internal.Types.MarkupContent.MarkupContent Language.LSP.Protocol.Types.Common.|? (Language.LSP.Protocol.Internal.Types.MarkedString.MarkedString Language.LSP.Protocol.Types.Common.|? [Language.LSP.Protocol.Internal.Types.MarkedString.MarkedString]))
  , {-|
  An optional range inside the text document that is used to
  visualize the hover, e.g. by changing the background color.
  -}
  Hover -> Maybe Range
_range :: (Maybe Language.LSP.Protocol.Internal.Types.Range.Range)
  }
  deriving stock (Int -> Hover -> ShowS
[Hover] -> ShowS
Hover -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Hover] -> ShowS
$cshowList :: [Hover] -> ShowS
show :: Hover -> String
$cshow :: Hover -> String
showsPrec :: Int -> Hover -> ShowS
$cshowsPrec :: Int -> Hover -> ShowS
Show, Hover -> Hover -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Hover -> Hover -> Bool
$c/= :: Hover -> Hover -> Bool
== :: Hover -> Hover -> Bool
$c== :: Hover -> Hover -> Bool
Eq, Eq Hover
Hover -> Hover -> Bool
Hover -> Hover -> Ordering
Hover -> Hover -> Hover
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 :: Hover -> Hover -> Hover
$cmin :: Hover -> Hover -> Hover
max :: Hover -> Hover -> Hover
$cmax :: Hover -> Hover -> Hover
>= :: Hover -> Hover -> Bool
$c>= :: Hover -> Hover -> Bool
> :: Hover -> Hover -> Bool
$c> :: Hover -> Hover -> Bool
<= :: Hover -> Hover -> Bool
$c<= :: Hover -> Hover -> Bool
< :: Hover -> Hover -> Bool
$c< :: Hover -> Hover -> Bool
compare :: Hover -> Hover -> Ordering
$ccompare :: Hover -> Hover -> Ordering
Ord, forall x. Rep Hover x -> Hover
forall x. Hover -> Rep Hover x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Hover x -> Hover
$cfrom :: forall x. Hover -> Rep Hover x
Generic)
  deriving anyclass (Hover -> ()
forall a. (a -> ()) -> NFData a
rnf :: Hover -> ()
$crnf :: Hover -> ()
NFData, Eq Hover
Int -> Hover -> Int
Hover -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: Hover -> Int
$chash :: Hover -> Int
hashWithSalt :: Int -> Hover -> Int
$chashWithSalt :: Int -> Hover -> Int
Hashable)
  deriving forall ann. [Hover] -> Doc ann
forall ann. Hover -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [Hover] -> Doc ann
$cprettyList :: forall ann. [Hover] -> Doc ann
pretty :: forall ann. Hover -> Doc ann
$cpretty :: forall ann. Hover -> Doc ann
Pretty via (ViaJSON Hover)

instance Aeson.ToJSON Hover where
  toJSON :: Hover -> Value
toJSON (Hover MarkupContent |? (MarkedString |? [MarkedString])
arg0 Maybe Range
arg1) = [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
$  [[Key
"contents" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= MarkupContent |? (MarkedString |? [MarkedString])
arg0]
    ,String
"range" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Range
arg1]

instance Aeson.FromJSON Hover where
  parseJSON :: Value -> Parser Hover
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"Hover" forall a b. (a -> b) -> a -> b
$ \Object
arg -> (MarkupContent |? (MarkedString |? [MarkedString]))
-> Maybe Range -> Hover
Hover forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"contents" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Aeson..:! Key
"range"