{- 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.DiagnosticRelatedInformation 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 Data.Text
import qualified Language.LSP.Protocol.Internal.Types.Location
import qualified Language.LSP.Protocol.Types.Common

{-|
Represents a related message and source code location for a diagnostic. This should be
used to point to code locations that cause or related to a diagnostics, e.g when duplicating
a symbol in a scope.
-}
data DiagnosticRelatedInformation = DiagnosticRelatedInformation 
  { {-|
  The location of this related diagnostic information.
  -}
  DiagnosticRelatedInformation -> Location
_location :: Language.LSP.Protocol.Internal.Types.Location.Location
  , {-|
  The message of this related diagnostic information.
  -}
  DiagnosticRelatedInformation -> Text
_message :: Data.Text.Text
  }
  deriving stock (Int -> DiagnosticRelatedInformation -> ShowS
[DiagnosticRelatedInformation] -> ShowS
DiagnosticRelatedInformation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DiagnosticRelatedInformation] -> ShowS
$cshowList :: [DiagnosticRelatedInformation] -> ShowS
show :: DiagnosticRelatedInformation -> String
$cshow :: DiagnosticRelatedInformation -> String
showsPrec :: Int -> DiagnosticRelatedInformation -> ShowS
$cshowsPrec :: Int -> DiagnosticRelatedInformation -> ShowS
Show, DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
$c/= :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
== :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
$c== :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
Eq, Eq DiagnosticRelatedInformation
DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Ordering
DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> DiagnosticRelatedInformation
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 :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> DiagnosticRelatedInformation
$cmin :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> DiagnosticRelatedInformation
max :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> DiagnosticRelatedInformation
$cmax :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> DiagnosticRelatedInformation
>= :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
$c>= :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
> :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
$c> :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
<= :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
$c<= :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
< :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
$c< :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
compare :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Ordering
$ccompare :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Ordering
Ord, forall x.
Rep DiagnosticRelatedInformation x -> DiagnosticRelatedInformation
forall x.
DiagnosticRelatedInformation -> Rep DiagnosticRelatedInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DiagnosticRelatedInformation x -> DiagnosticRelatedInformation
$cfrom :: forall x.
DiagnosticRelatedInformation -> Rep DiagnosticRelatedInformation x
Generic)
  deriving anyclass (DiagnosticRelatedInformation -> ()
forall a. (a -> ()) -> NFData a
rnf :: DiagnosticRelatedInformation -> ()
$crnf :: DiagnosticRelatedInformation -> ()
NFData, Eq DiagnosticRelatedInformation
Int -> DiagnosticRelatedInformation -> Int
DiagnosticRelatedInformation -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: DiagnosticRelatedInformation -> Int
$chash :: DiagnosticRelatedInformation -> Int
hashWithSalt :: Int -> DiagnosticRelatedInformation -> Int
$chashWithSalt :: Int -> DiagnosticRelatedInformation -> Int
Hashable)
  deriving forall ann. [DiagnosticRelatedInformation] -> Doc ann
forall ann. DiagnosticRelatedInformation -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [DiagnosticRelatedInformation] -> Doc ann
$cprettyList :: forall ann. [DiagnosticRelatedInformation] -> Doc ann
pretty :: forall ann. DiagnosticRelatedInformation -> Doc ann
$cpretty :: forall ann. DiagnosticRelatedInformation -> Doc ann
Pretty via (ViaJSON DiagnosticRelatedInformation)

instance Aeson.ToJSON DiagnosticRelatedInformation where
  toJSON :: DiagnosticRelatedInformation -> Value
toJSON (DiagnosticRelatedInformation Location
arg0 Text
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
"location" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Location
arg0]
    ,[Key
"message" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg1]]

instance Aeson.FromJSON DiagnosticRelatedInformation where
  parseJSON :: Value -> Parser DiagnosticRelatedInformation
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"DiagnosticRelatedInformation" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Location -> Text -> DiagnosticRelatedInformation
DiagnosticRelatedInformation forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"location" 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
"message"