{- 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.DocumentHighlight 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.DocumentHighlightKind
import qualified Language.LSP.Protocol.Internal.Types.Range
import qualified Language.LSP.Protocol.Types.Common

{-|
A document highlight is a range inside a text document which deserves
special attention. Usually a document highlight is visualized by changing
the background color of its range.
-}
data DocumentHighlight = DocumentHighlight 
  { {-|
  The range this highlight applies to.
  -}
  DocumentHighlight -> Range
_range :: Language.LSP.Protocol.Internal.Types.Range.Range
  , {-|
  The highlight kind, default is `DocumentHighlightKind.Text`.
  -}
  DocumentHighlight -> Maybe DocumentHighlightKind
_kind :: (Maybe Language.LSP.Protocol.Internal.Types.DocumentHighlightKind.DocumentHighlightKind)
  }
  deriving stock (Int -> DocumentHighlight -> ShowS
[DocumentHighlight] -> ShowS
DocumentHighlight -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DocumentHighlight] -> ShowS
$cshowList :: [DocumentHighlight] -> ShowS
show :: DocumentHighlight -> String
$cshow :: DocumentHighlight -> String
showsPrec :: Int -> DocumentHighlight -> ShowS
$cshowsPrec :: Int -> DocumentHighlight -> ShowS
Show, DocumentHighlight -> DocumentHighlight -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DocumentHighlight -> DocumentHighlight -> Bool
$c/= :: DocumentHighlight -> DocumentHighlight -> Bool
== :: DocumentHighlight -> DocumentHighlight -> Bool
$c== :: DocumentHighlight -> DocumentHighlight -> Bool
Eq, Eq DocumentHighlight
DocumentHighlight -> DocumentHighlight -> Bool
DocumentHighlight -> DocumentHighlight -> Ordering
DocumentHighlight -> DocumentHighlight -> DocumentHighlight
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 :: DocumentHighlight -> DocumentHighlight -> DocumentHighlight
$cmin :: DocumentHighlight -> DocumentHighlight -> DocumentHighlight
max :: DocumentHighlight -> DocumentHighlight -> DocumentHighlight
$cmax :: DocumentHighlight -> DocumentHighlight -> DocumentHighlight
>= :: DocumentHighlight -> DocumentHighlight -> Bool
$c>= :: DocumentHighlight -> DocumentHighlight -> Bool
> :: DocumentHighlight -> DocumentHighlight -> Bool
$c> :: DocumentHighlight -> DocumentHighlight -> Bool
<= :: DocumentHighlight -> DocumentHighlight -> Bool
$c<= :: DocumentHighlight -> DocumentHighlight -> Bool
< :: DocumentHighlight -> DocumentHighlight -> Bool
$c< :: DocumentHighlight -> DocumentHighlight -> Bool
compare :: DocumentHighlight -> DocumentHighlight -> Ordering
$ccompare :: DocumentHighlight -> DocumentHighlight -> Ordering
Ord, forall x. Rep DocumentHighlight x -> DocumentHighlight
forall x. DocumentHighlight -> Rep DocumentHighlight x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DocumentHighlight x -> DocumentHighlight
$cfrom :: forall x. DocumentHighlight -> Rep DocumentHighlight x
Generic)
  deriving anyclass (DocumentHighlight -> ()
forall a. (a -> ()) -> NFData a
rnf :: DocumentHighlight -> ()
$crnf :: DocumentHighlight -> ()
NFData, Eq DocumentHighlight
Int -> DocumentHighlight -> Int
DocumentHighlight -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: DocumentHighlight -> Int
$chash :: DocumentHighlight -> Int
hashWithSalt :: Int -> DocumentHighlight -> Int
$chashWithSalt :: Int -> DocumentHighlight -> Int
Hashable)
  deriving forall ann. [DocumentHighlight] -> Doc ann
forall ann. DocumentHighlight -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [DocumentHighlight] -> Doc ann
$cprettyList :: forall ann. [DocumentHighlight] -> Doc ann
pretty :: forall ann. DocumentHighlight -> Doc ann
$cpretty :: forall ann. DocumentHighlight -> Doc ann
Pretty via (ViaJSON DocumentHighlight)

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

instance Aeson.FromJSON DocumentHighlight where
  parseJSON :: Value -> Parser DocumentHighlight
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"DocumentHighlight" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Range -> Maybe DocumentHighlightKind -> DocumentHighlight
DocumentHighlight forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"range" 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
"kind"