{- 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.SemanticTokens 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.Types.Common

{-|
@since 3.16.0
-}
data SemanticTokens = SemanticTokens 
  { {-|
  An optional result id. If provided and clients support delta updating
  the client will include the result id in the next semantic token request.
  A server can then instead of computing all semantic tokens again simply
  send a delta.
  -}
  SemanticTokens -> Maybe Text
_resultId :: (Maybe Data.Text.Text)
  , {-|
  The actual tokens.
  -}
  SemanticTokens -> [UInt]
_data_ :: [Language.LSP.Protocol.Types.Common.UInt]
  }
  deriving stock (Int -> SemanticTokens -> ShowS
[SemanticTokens] -> ShowS
SemanticTokens -> String
(Int -> SemanticTokens -> ShowS)
-> (SemanticTokens -> String)
-> ([SemanticTokens] -> ShowS)
-> Show SemanticTokens
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SemanticTokens -> ShowS
showsPrec :: Int -> SemanticTokens -> ShowS
$cshow :: SemanticTokens -> String
show :: SemanticTokens -> String
$cshowList :: [SemanticTokens] -> ShowS
showList :: [SemanticTokens] -> ShowS
Show, SemanticTokens -> SemanticTokens -> Bool
(SemanticTokens -> SemanticTokens -> Bool)
-> (SemanticTokens -> SemanticTokens -> Bool) -> Eq SemanticTokens
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SemanticTokens -> SemanticTokens -> Bool
== :: SemanticTokens -> SemanticTokens -> Bool
$c/= :: SemanticTokens -> SemanticTokens -> Bool
/= :: SemanticTokens -> SemanticTokens -> Bool
Eq, Eq SemanticTokens
Eq SemanticTokens =>
(SemanticTokens -> SemanticTokens -> Ordering)
-> (SemanticTokens -> SemanticTokens -> Bool)
-> (SemanticTokens -> SemanticTokens -> Bool)
-> (SemanticTokens -> SemanticTokens -> Bool)
-> (SemanticTokens -> SemanticTokens -> Bool)
-> (SemanticTokens -> SemanticTokens -> SemanticTokens)
-> (SemanticTokens -> SemanticTokens -> SemanticTokens)
-> Ord SemanticTokens
SemanticTokens -> SemanticTokens -> Bool
SemanticTokens -> SemanticTokens -> Ordering
SemanticTokens -> SemanticTokens -> SemanticTokens
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 :: SemanticTokens -> SemanticTokens -> Ordering
compare :: SemanticTokens -> SemanticTokens -> Ordering
$c< :: SemanticTokens -> SemanticTokens -> Bool
< :: SemanticTokens -> SemanticTokens -> Bool
$c<= :: SemanticTokens -> SemanticTokens -> Bool
<= :: SemanticTokens -> SemanticTokens -> Bool
$c> :: SemanticTokens -> SemanticTokens -> Bool
> :: SemanticTokens -> SemanticTokens -> Bool
$c>= :: SemanticTokens -> SemanticTokens -> Bool
>= :: SemanticTokens -> SemanticTokens -> Bool
$cmax :: SemanticTokens -> SemanticTokens -> SemanticTokens
max :: SemanticTokens -> SemanticTokens -> SemanticTokens
$cmin :: SemanticTokens -> SemanticTokens -> SemanticTokens
min :: SemanticTokens -> SemanticTokens -> SemanticTokens
Ord, (forall x. SemanticTokens -> Rep SemanticTokens x)
-> (forall x. Rep SemanticTokens x -> SemanticTokens)
-> Generic SemanticTokens
forall x. Rep SemanticTokens x -> SemanticTokens
forall x. SemanticTokens -> Rep SemanticTokens x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SemanticTokens -> Rep SemanticTokens x
from :: forall x. SemanticTokens -> Rep SemanticTokens x
$cto :: forall x. Rep SemanticTokens x -> SemanticTokens
to :: forall x. Rep SemanticTokens x -> SemanticTokens
Generic)
  deriving anyclass (SemanticTokens -> ()
(SemanticTokens -> ()) -> NFData SemanticTokens
forall a. (a -> ()) -> NFData a
$crnf :: SemanticTokens -> ()
rnf :: SemanticTokens -> ()
NFData, Eq SemanticTokens
Eq SemanticTokens =>
(Int -> SemanticTokens -> Int)
-> (SemanticTokens -> Int) -> Hashable SemanticTokens
Int -> SemanticTokens -> Int
SemanticTokens -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> SemanticTokens -> Int
hashWithSalt :: Int -> SemanticTokens -> Int
$chash :: SemanticTokens -> Int
hash :: SemanticTokens -> Int
Hashable)
  deriving (forall ann. SemanticTokens -> Doc ann)
-> (forall ann. [SemanticTokens] -> Doc ann)
-> Pretty SemanticTokens
forall ann. [SemanticTokens] -> Doc ann
forall ann. SemanticTokens -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. SemanticTokens -> Doc ann
pretty :: forall ann. SemanticTokens -> Doc ann
$cprettyList :: forall ann. [SemanticTokens] -> Doc ann
prettyList :: forall ann. [SemanticTokens] -> Doc ann
Pretty via (ViaJSON SemanticTokens)

instance Aeson.ToJSON SemanticTokens where
  toJSON :: SemanticTokens -> Value
toJSON (SemanticTokens Maybe Text
arg0 [UInt]
arg1) = [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
"resultId" String -> Maybe Text -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Text
arg0
    ,[Key
"data" Key -> [UInt] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= [UInt]
arg1]]

instance Aeson.FromJSON SemanticTokens where
  parseJSON :: Value -> Parser SemanticTokens
parseJSON = String
-> (Object -> Parser SemanticTokens)
-> Value
-> Parser SemanticTokens
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"SemanticTokens" ((Object -> Parser SemanticTokens)
 -> Value -> Parser SemanticTokens)
-> (Object -> Parser SemanticTokens)
-> Value
-> Parser SemanticTokens
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe Text -> [UInt] -> SemanticTokens
SemanticTokens (Maybe Text -> [UInt] -> SemanticTokens)
-> Parser (Maybe Text) -> Parser ([UInt] -> SemanticTokens)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser (Maybe Text)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"resultId" Parser ([UInt] -> SemanticTokens)
-> Parser [UInt] -> Parser SemanticTokens
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 [UInt]
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"data"