{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
module Language.LSP.Types.Progress where
import Control.Monad (unless)
import qualified Data.Aeson as A
import Data.Aeson.TH
import Data.Maybe (catMaybes)
import Data.Text (Text)
import Language.LSP.Types.Common
import Language.LSP.Types.Utils
data ProgressToken
= ProgressNumericToken Int32
| ProgressTextToken Text
deriving (Int -> ProgressToken -> ShowS
[ProgressToken] -> ShowS
ProgressToken -> String
(Int -> ProgressToken -> ShowS)
-> (ProgressToken -> String)
-> ([ProgressToken] -> ShowS)
-> Show ProgressToken
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ProgressToken -> ShowS
showsPrec :: Int -> ProgressToken -> ShowS
$cshow :: ProgressToken -> String
show :: ProgressToken -> String
$cshowList :: [ProgressToken] -> ShowS
showList :: [ProgressToken] -> ShowS
Show, ReadPrec [ProgressToken]
ReadPrec ProgressToken
Int -> ReadS ProgressToken
ReadS [ProgressToken]
(Int -> ReadS ProgressToken)
-> ReadS [ProgressToken]
-> ReadPrec ProgressToken
-> ReadPrec [ProgressToken]
-> Read ProgressToken
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ProgressToken
readsPrec :: Int -> ReadS ProgressToken
$creadList :: ReadS [ProgressToken]
readList :: ReadS [ProgressToken]
$creadPrec :: ReadPrec ProgressToken
readPrec :: ReadPrec ProgressToken
$creadListPrec :: ReadPrec [ProgressToken]
readListPrec :: ReadPrec [ProgressToken]
Read, ProgressToken -> ProgressToken -> Bool
(ProgressToken -> ProgressToken -> Bool)
-> (ProgressToken -> ProgressToken -> Bool) -> Eq ProgressToken
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ProgressToken -> ProgressToken -> Bool
== :: ProgressToken -> ProgressToken -> Bool
$c/= :: ProgressToken -> ProgressToken -> Bool
/= :: ProgressToken -> ProgressToken -> Bool
Eq, Eq ProgressToken
Eq ProgressToken =>
(ProgressToken -> ProgressToken -> Ordering)
-> (ProgressToken -> ProgressToken -> Bool)
-> (ProgressToken -> ProgressToken -> Bool)
-> (ProgressToken -> ProgressToken -> Bool)
-> (ProgressToken -> ProgressToken -> Bool)
-> (ProgressToken -> ProgressToken -> ProgressToken)
-> (ProgressToken -> ProgressToken -> ProgressToken)
-> Ord ProgressToken
ProgressToken -> ProgressToken -> Bool
ProgressToken -> ProgressToken -> Ordering
ProgressToken -> ProgressToken -> ProgressToken
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 :: ProgressToken -> ProgressToken -> Ordering
compare :: ProgressToken -> ProgressToken -> Ordering
$c< :: ProgressToken -> ProgressToken -> Bool
< :: ProgressToken -> ProgressToken -> Bool
$c<= :: ProgressToken -> ProgressToken -> Bool
<= :: ProgressToken -> ProgressToken -> Bool
$c> :: ProgressToken -> ProgressToken -> Bool
> :: ProgressToken -> ProgressToken -> Bool
$c>= :: ProgressToken -> ProgressToken -> Bool
>= :: ProgressToken -> ProgressToken -> Bool
$cmax :: ProgressToken -> ProgressToken -> ProgressToken
max :: ProgressToken -> ProgressToken -> ProgressToken
$cmin :: ProgressToken -> ProgressToken -> ProgressToken
min :: ProgressToken -> ProgressToken -> ProgressToken
Ord)
deriveJSON lspOptionsUntagged ''ProgressToken
data ProgressParams t =
ProgressParams {
forall t. ProgressParams t -> ProgressToken
_token :: ProgressToken
, forall t. ProgressParams t -> t
_value :: t
} deriving (Int -> ProgressParams t -> ShowS
[ProgressParams t] -> ShowS
ProgressParams t -> String
(Int -> ProgressParams t -> ShowS)
-> (ProgressParams t -> String)
-> ([ProgressParams t] -> ShowS)
-> Show (ProgressParams t)
forall t. Show t => Int -> ProgressParams t -> ShowS
forall t. Show t => [ProgressParams t] -> ShowS
forall t. Show t => ProgressParams t -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall t. Show t => Int -> ProgressParams t -> ShowS
showsPrec :: Int -> ProgressParams t -> ShowS
$cshow :: forall t. Show t => ProgressParams t -> String
show :: ProgressParams t -> String
$cshowList :: forall t. Show t => [ProgressParams t] -> ShowS
showList :: [ProgressParams t] -> ShowS
Show, ReadPrec [ProgressParams t]
ReadPrec (ProgressParams t)
Int -> ReadS (ProgressParams t)
ReadS [ProgressParams t]
(Int -> ReadS (ProgressParams t))
-> ReadS [ProgressParams t]
-> ReadPrec (ProgressParams t)
-> ReadPrec [ProgressParams t]
-> Read (ProgressParams t)
forall t. Read t => ReadPrec [ProgressParams t]
forall t. Read t => ReadPrec (ProgressParams t)
forall t. Read t => Int -> ReadS (ProgressParams t)
forall t. Read t => ReadS [ProgressParams t]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: forall t. Read t => Int -> ReadS (ProgressParams t)
readsPrec :: Int -> ReadS (ProgressParams t)
$creadList :: forall t. Read t => ReadS [ProgressParams t]
readList :: ReadS [ProgressParams t]
$creadPrec :: forall t. Read t => ReadPrec (ProgressParams t)
readPrec :: ReadPrec (ProgressParams t)
$creadListPrec :: forall t. Read t => ReadPrec [ProgressParams t]
readListPrec :: ReadPrec [ProgressParams t]
Read, ProgressParams t -> ProgressParams t -> Bool
(ProgressParams t -> ProgressParams t -> Bool)
-> (ProgressParams t -> ProgressParams t -> Bool)
-> Eq (ProgressParams t)
forall t. Eq t => ProgressParams t -> ProgressParams t -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall t. Eq t => ProgressParams t -> ProgressParams t -> Bool
== :: ProgressParams t -> ProgressParams t -> Bool
$c/= :: forall t. Eq t => ProgressParams t -> ProgressParams t -> Bool
/= :: ProgressParams t -> ProgressParams t -> Bool
Eq, (forall a b. (a -> b) -> ProgressParams a -> ProgressParams b)
-> (forall a b. a -> ProgressParams b -> ProgressParams a)
-> Functor ProgressParams
forall a b. a -> ProgressParams b -> ProgressParams a
forall a b. (a -> b) -> ProgressParams a -> ProgressParams b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall a b. (a -> b) -> ProgressParams a -> ProgressParams b
fmap :: forall a b. (a -> b) -> ProgressParams a -> ProgressParams b
$c<$ :: forall a b. a -> ProgressParams b -> ProgressParams a
<$ :: forall a b. a -> ProgressParams b -> ProgressParams a
Functor)
deriveJSON lspOptions ''ProgressParams
data WorkDoneProgressBeginParams =
WorkDoneProgressBeginParams {
WorkDoneProgressBeginParams -> Text
_title :: Text
, WorkDoneProgressBeginParams -> Maybe Bool
_cancellable :: Maybe Bool
, WorkDoneProgressBeginParams -> Maybe Text
_message :: Maybe Text
, WorkDoneProgressBeginParams -> Maybe UInt
_percentage :: Maybe UInt
} deriving (Int -> WorkDoneProgressBeginParams -> ShowS
[WorkDoneProgressBeginParams] -> ShowS
WorkDoneProgressBeginParams -> String
(Int -> WorkDoneProgressBeginParams -> ShowS)
-> (WorkDoneProgressBeginParams -> String)
-> ([WorkDoneProgressBeginParams] -> ShowS)
-> Show WorkDoneProgressBeginParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WorkDoneProgressBeginParams -> ShowS
showsPrec :: Int -> WorkDoneProgressBeginParams -> ShowS
$cshow :: WorkDoneProgressBeginParams -> String
show :: WorkDoneProgressBeginParams -> String
$cshowList :: [WorkDoneProgressBeginParams] -> ShowS
showList :: [WorkDoneProgressBeginParams] -> ShowS
Show, ReadPrec [WorkDoneProgressBeginParams]
ReadPrec WorkDoneProgressBeginParams
Int -> ReadS WorkDoneProgressBeginParams
ReadS [WorkDoneProgressBeginParams]
(Int -> ReadS WorkDoneProgressBeginParams)
-> ReadS [WorkDoneProgressBeginParams]
-> ReadPrec WorkDoneProgressBeginParams
-> ReadPrec [WorkDoneProgressBeginParams]
-> Read WorkDoneProgressBeginParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS WorkDoneProgressBeginParams
readsPrec :: Int -> ReadS WorkDoneProgressBeginParams
$creadList :: ReadS [WorkDoneProgressBeginParams]
readList :: ReadS [WorkDoneProgressBeginParams]
$creadPrec :: ReadPrec WorkDoneProgressBeginParams
readPrec :: ReadPrec WorkDoneProgressBeginParams
$creadListPrec :: ReadPrec [WorkDoneProgressBeginParams]
readListPrec :: ReadPrec [WorkDoneProgressBeginParams]
Read, WorkDoneProgressBeginParams -> WorkDoneProgressBeginParams -> Bool
(WorkDoneProgressBeginParams
-> WorkDoneProgressBeginParams -> Bool)
-> (WorkDoneProgressBeginParams
-> WorkDoneProgressBeginParams -> Bool)
-> Eq WorkDoneProgressBeginParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WorkDoneProgressBeginParams -> WorkDoneProgressBeginParams -> Bool
== :: WorkDoneProgressBeginParams -> WorkDoneProgressBeginParams -> Bool
$c/= :: WorkDoneProgressBeginParams -> WorkDoneProgressBeginParams -> Bool
/= :: WorkDoneProgressBeginParams -> WorkDoneProgressBeginParams -> Bool
Eq)
instance A.ToJSON WorkDoneProgressBeginParams where
toJSON :: WorkDoneProgressBeginParams -> Value
toJSON WorkDoneProgressBeginParams{Maybe Bool
Maybe Text
Maybe UInt
Text
_title :: WorkDoneProgressBeginParams -> Text
_cancellable :: WorkDoneProgressBeginParams -> Maybe Bool
_message :: WorkDoneProgressBeginParams -> Maybe Text
_percentage :: WorkDoneProgressBeginParams -> Maybe UInt
_title :: Text
_cancellable :: Maybe Bool
_message :: Maybe Text
_percentage :: Maybe UInt
..} =
[Pair] -> Value
A.object ([Pair] -> Value) -> [Pair] -> Value
forall a b. (a -> b) -> a -> b
$ [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Just (Pair -> Maybe Pair) -> Pair -> Maybe Pair
forall a b. (a -> b) -> a -> b
$ Key
"kind" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
A..= (Text
"begin" :: Text)
, Pair -> Maybe Pair
forall a. a -> Maybe a
Just (Pair -> Maybe Pair) -> Pair -> Maybe Pair
forall a b. (a -> b) -> a -> b
$ Key
"title" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
A..= Text
_title
, (Key
"cancellable" Key -> Bool -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
A..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Bool
_cancellable
, (Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
A..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Text
_message
, (Key
"percentage" Key -> UInt -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
A..=) (UInt -> Pair) -> Maybe UInt -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe UInt
_percentage
]
instance A.FromJSON WorkDoneProgressBeginParams where
parseJSON :: Value -> Parser WorkDoneProgressBeginParams
parseJSON = String
-> (Object -> Parser WorkDoneProgressBeginParams)
-> Value
-> Parser WorkDoneProgressBeginParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"WorkDoneProgressBegin" ((Object -> Parser WorkDoneProgressBeginParams)
-> Value -> Parser WorkDoneProgressBeginParams)
-> (Object -> Parser WorkDoneProgressBeginParams)
-> Value
-> Parser WorkDoneProgressBeginParams
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Text
kind <- Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"kind"
Bool -> Parser () -> Parser ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text
kind Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== (Text
"begin" :: Text)) (Parser () -> Parser ()) -> Parser () -> Parser ()
forall a b. (a -> b) -> a -> b
$ String -> Parser ()
forall a. String -> Parser a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Parser ()) -> String -> Parser ()
forall a b. (a -> b) -> a -> b
$ String
"Expected kind \"begin\" but got " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
forall a. Show a => a -> String
show Text
kind
Text
_title <- Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"title"
Maybe Bool
_cancellable <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"cancellable"
Maybe Text
_message <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"message"
Maybe UInt
_percentage <- Object
o Object -> Key -> Parser (Maybe UInt)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"percentage"
WorkDoneProgressBeginParams -> Parser WorkDoneProgressBeginParams
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure WorkDoneProgressBeginParams{Maybe Bool
Maybe Text
Maybe UInt
Text
_title :: Text
_cancellable :: Maybe Bool
_message :: Maybe Text
_percentage :: Maybe UInt
_title :: Text
_cancellable :: Maybe Bool
_message :: Maybe Text
_percentage :: Maybe UInt
..}
data WorkDoneProgressReportParams =
WorkDoneProgressReportParams {
WorkDoneProgressReportParams -> Maybe Bool
_cancellable :: Maybe Bool
, WorkDoneProgressReportParams -> Maybe Text
_message :: Maybe Text
, WorkDoneProgressReportParams -> Maybe UInt
_percentage :: Maybe UInt
} deriving (Int -> WorkDoneProgressReportParams -> ShowS
[WorkDoneProgressReportParams] -> ShowS
WorkDoneProgressReportParams -> String
(Int -> WorkDoneProgressReportParams -> ShowS)
-> (WorkDoneProgressReportParams -> String)
-> ([WorkDoneProgressReportParams] -> ShowS)
-> Show WorkDoneProgressReportParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WorkDoneProgressReportParams -> ShowS
showsPrec :: Int -> WorkDoneProgressReportParams -> ShowS
$cshow :: WorkDoneProgressReportParams -> String
show :: WorkDoneProgressReportParams -> String
$cshowList :: [WorkDoneProgressReportParams] -> ShowS
showList :: [WorkDoneProgressReportParams] -> ShowS
Show, ReadPrec [WorkDoneProgressReportParams]
ReadPrec WorkDoneProgressReportParams
Int -> ReadS WorkDoneProgressReportParams
ReadS [WorkDoneProgressReportParams]
(Int -> ReadS WorkDoneProgressReportParams)
-> ReadS [WorkDoneProgressReportParams]
-> ReadPrec WorkDoneProgressReportParams
-> ReadPrec [WorkDoneProgressReportParams]
-> Read WorkDoneProgressReportParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS WorkDoneProgressReportParams
readsPrec :: Int -> ReadS WorkDoneProgressReportParams
$creadList :: ReadS [WorkDoneProgressReportParams]
readList :: ReadS [WorkDoneProgressReportParams]
$creadPrec :: ReadPrec WorkDoneProgressReportParams
readPrec :: ReadPrec WorkDoneProgressReportParams
$creadListPrec :: ReadPrec [WorkDoneProgressReportParams]
readListPrec :: ReadPrec [WorkDoneProgressReportParams]
Read, WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool
(WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool)
-> (WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool)
-> Eq WorkDoneProgressReportParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool
== :: WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool
$c/= :: WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool
/= :: WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool
Eq)
instance A.ToJSON WorkDoneProgressReportParams where
toJSON :: WorkDoneProgressReportParams -> Value
toJSON WorkDoneProgressReportParams{Maybe Bool
Maybe Text
Maybe UInt
_percentage :: WorkDoneProgressReportParams -> Maybe UInt
_cancellable :: WorkDoneProgressReportParams -> Maybe Bool
_message :: WorkDoneProgressReportParams -> Maybe Text
_cancellable :: Maybe Bool
_message :: Maybe Text
_percentage :: Maybe UInt
..} =
[Pair] -> Value
A.object ([Pair] -> Value) -> [Pair] -> Value
forall a b. (a -> b) -> a -> b
$ [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Just (Pair -> Maybe Pair) -> Pair -> Maybe Pair
forall a b. (a -> b) -> a -> b
$ Key
"kind" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
A..= (Text
"report" :: Text)
, (Key
"cancellable" Key -> Bool -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
A..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Bool
_cancellable
, (Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
A..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Text
_message
, (Key
"percentage" Key -> UInt -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
A..=) (UInt -> Pair) -> Maybe UInt -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe UInt
_percentage
]
instance A.FromJSON WorkDoneProgressReportParams where
parseJSON :: Value -> Parser WorkDoneProgressReportParams
parseJSON = String
-> (Object -> Parser WorkDoneProgressReportParams)
-> Value
-> Parser WorkDoneProgressReportParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"WorkDoneProgressReport" ((Object -> Parser WorkDoneProgressReportParams)
-> Value -> Parser WorkDoneProgressReportParams)
-> (Object -> Parser WorkDoneProgressReportParams)
-> Value
-> Parser WorkDoneProgressReportParams
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Text
kind <- Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"kind"
Bool -> Parser () -> Parser ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text
kind Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== (Text
"report" :: Text)) (Parser () -> Parser ()) -> Parser () -> Parser ()
forall a b. (a -> b) -> a -> b
$ String -> Parser ()
forall a. String -> Parser a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Parser ()) -> String -> Parser ()
forall a b. (a -> b) -> a -> b
$ String
"Expected kind \"report\" but got " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
forall a. Show a => a -> String
show Text
kind
Maybe Bool
_cancellable <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"cancellable"
Maybe Text
_message <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"message"
Maybe UInt
_percentage <- Object
o Object -> Key -> Parser (Maybe UInt)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"percentage"
WorkDoneProgressReportParams -> Parser WorkDoneProgressReportParams
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure WorkDoneProgressReportParams{Maybe Bool
Maybe Text
Maybe UInt
_percentage :: Maybe UInt
_cancellable :: Maybe Bool
_message :: Maybe Text
_cancellable :: Maybe Bool
_message :: Maybe Text
_percentage :: Maybe UInt
..}
data WorkDoneProgressEndParams =
WorkDoneProgressEndParams {
WorkDoneProgressEndParams -> Maybe Text
_message :: Maybe Text
} deriving (Int -> WorkDoneProgressEndParams -> ShowS
[WorkDoneProgressEndParams] -> ShowS
WorkDoneProgressEndParams -> String
(Int -> WorkDoneProgressEndParams -> ShowS)
-> (WorkDoneProgressEndParams -> String)
-> ([WorkDoneProgressEndParams] -> ShowS)
-> Show WorkDoneProgressEndParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WorkDoneProgressEndParams -> ShowS
showsPrec :: Int -> WorkDoneProgressEndParams -> ShowS
$cshow :: WorkDoneProgressEndParams -> String
show :: WorkDoneProgressEndParams -> String
$cshowList :: [WorkDoneProgressEndParams] -> ShowS
showList :: [WorkDoneProgressEndParams] -> ShowS
Show, ReadPrec [WorkDoneProgressEndParams]
ReadPrec WorkDoneProgressEndParams
Int -> ReadS WorkDoneProgressEndParams
ReadS [WorkDoneProgressEndParams]
(Int -> ReadS WorkDoneProgressEndParams)
-> ReadS [WorkDoneProgressEndParams]
-> ReadPrec WorkDoneProgressEndParams
-> ReadPrec [WorkDoneProgressEndParams]
-> Read WorkDoneProgressEndParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS WorkDoneProgressEndParams
readsPrec :: Int -> ReadS WorkDoneProgressEndParams
$creadList :: ReadS [WorkDoneProgressEndParams]
readList :: ReadS [WorkDoneProgressEndParams]
$creadPrec :: ReadPrec WorkDoneProgressEndParams
readPrec :: ReadPrec WorkDoneProgressEndParams
$creadListPrec :: ReadPrec [WorkDoneProgressEndParams]
readListPrec :: ReadPrec [WorkDoneProgressEndParams]
Read, WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool
(WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool)
-> (WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool)
-> Eq WorkDoneProgressEndParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool
== :: WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool
$c/= :: WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool
/= :: WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool
Eq)
instance A.ToJSON WorkDoneProgressEndParams where
toJSON :: WorkDoneProgressEndParams -> Value
toJSON WorkDoneProgressEndParams{Maybe Text
_message :: WorkDoneProgressEndParams -> Maybe Text
_message :: Maybe Text
..} =
[Pair] -> Value
A.object ([Pair] -> Value) -> [Pair] -> Value
forall a b. (a -> b) -> a -> b
$ [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Just (Pair -> Maybe Pair) -> Pair -> Maybe Pair
forall a b. (a -> b) -> a -> b
$ Key
"kind" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
A..= (Text
"end" :: Text)
, (Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
A..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Text
_message
]
instance A.FromJSON WorkDoneProgressEndParams where
parseJSON :: Value -> Parser WorkDoneProgressEndParams
parseJSON = String
-> (Object -> Parser WorkDoneProgressEndParams)
-> Value
-> Parser WorkDoneProgressEndParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"WorkDoneProgressEnd" ((Object -> Parser WorkDoneProgressEndParams)
-> Value -> Parser WorkDoneProgressEndParams)
-> (Object -> Parser WorkDoneProgressEndParams)
-> Value
-> Parser WorkDoneProgressEndParams
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Text
kind <- Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"kind"
Bool -> Parser () -> Parser ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text
kind Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== (Text
"end" :: Text)) (Parser () -> Parser ()) -> Parser () -> Parser ()
forall a b. (a -> b) -> a -> b
$ String -> Parser ()
forall a. String -> Parser a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Parser ()) -> String -> Parser ()
forall a b. (a -> b) -> a -> b
$ String
"Expected kind \"end\" but got " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
forall a. Show a => a -> String
show Text
kind
Maybe Text
_message <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"message"
WorkDoneProgressEndParams -> Parser WorkDoneProgressEndParams
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure WorkDoneProgressEndParams{Maybe Text
_message :: Maybe Text
_message :: Maybe Text
..}
data WorkDoneProgressCancelParams =
WorkDoneProgressCancelParams {
WorkDoneProgressCancelParams -> ProgressToken
_token :: ProgressToken
} deriving (Int -> WorkDoneProgressCancelParams -> ShowS
[WorkDoneProgressCancelParams] -> ShowS
WorkDoneProgressCancelParams -> String
(Int -> WorkDoneProgressCancelParams -> ShowS)
-> (WorkDoneProgressCancelParams -> String)
-> ([WorkDoneProgressCancelParams] -> ShowS)
-> Show WorkDoneProgressCancelParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WorkDoneProgressCancelParams -> ShowS
showsPrec :: Int -> WorkDoneProgressCancelParams -> ShowS
$cshow :: WorkDoneProgressCancelParams -> String
show :: WorkDoneProgressCancelParams -> String
$cshowList :: [WorkDoneProgressCancelParams] -> ShowS
showList :: [WorkDoneProgressCancelParams] -> ShowS
Show, ReadPrec [WorkDoneProgressCancelParams]
ReadPrec WorkDoneProgressCancelParams
Int -> ReadS WorkDoneProgressCancelParams
ReadS [WorkDoneProgressCancelParams]
(Int -> ReadS WorkDoneProgressCancelParams)
-> ReadS [WorkDoneProgressCancelParams]
-> ReadPrec WorkDoneProgressCancelParams
-> ReadPrec [WorkDoneProgressCancelParams]
-> Read WorkDoneProgressCancelParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS WorkDoneProgressCancelParams
readsPrec :: Int -> ReadS WorkDoneProgressCancelParams
$creadList :: ReadS [WorkDoneProgressCancelParams]
readList :: ReadS [WorkDoneProgressCancelParams]
$creadPrec :: ReadPrec WorkDoneProgressCancelParams
readPrec :: ReadPrec WorkDoneProgressCancelParams
$creadListPrec :: ReadPrec [WorkDoneProgressCancelParams]
readListPrec :: ReadPrec [WorkDoneProgressCancelParams]
Read, WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool
(WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool)
-> (WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool)
-> Eq WorkDoneProgressCancelParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool
== :: WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool
$c/= :: WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool
/= :: WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool
Eq)
deriveJSON lspOptions ''WorkDoneProgressCancelParams
data WorkDoneProgressCreateParams =
WorkDoneProgressCreateParams {
WorkDoneProgressCreateParams -> ProgressToken
_token :: ProgressToken
} deriving (Int -> WorkDoneProgressCreateParams -> ShowS
[WorkDoneProgressCreateParams] -> ShowS
WorkDoneProgressCreateParams -> String
(Int -> WorkDoneProgressCreateParams -> ShowS)
-> (WorkDoneProgressCreateParams -> String)
-> ([WorkDoneProgressCreateParams] -> ShowS)
-> Show WorkDoneProgressCreateParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WorkDoneProgressCreateParams -> ShowS
showsPrec :: Int -> WorkDoneProgressCreateParams -> ShowS
$cshow :: WorkDoneProgressCreateParams -> String
show :: WorkDoneProgressCreateParams -> String
$cshowList :: [WorkDoneProgressCreateParams] -> ShowS
showList :: [WorkDoneProgressCreateParams] -> ShowS
Show, ReadPrec [WorkDoneProgressCreateParams]
ReadPrec WorkDoneProgressCreateParams
Int -> ReadS WorkDoneProgressCreateParams
ReadS [WorkDoneProgressCreateParams]
(Int -> ReadS WorkDoneProgressCreateParams)
-> ReadS [WorkDoneProgressCreateParams]
-> ReadPrec WorkDoneProgressCreateParams
-> ReadPrec [WorkDoneProgressCreateParams]
-> Read WorkDoneProgressCreateParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS WorkDoneProgressCreateParams
readsPrec :: Int -> ReadS WorkDoneProgressCreateParams
$creadList :: ReadS [WorkDoneProgressCreateParams]
readList :: ReadS [WorkDoneProgressCreateParams]
$creadPrec :: ReadPrec WorkDoneProgressCreateParams
readPrec :: ReadPrec WorkDoneProgressCreateParams
$creadListPrec :: ReadPrec [WorkDoneProgressCreateParams]
readListPrec :: ReadPrec [WorkDoneProgressCreateParams]
Read, WorkDoneProgressCreateParams
-> WorkDoneProgressCreateParams -> Bool
(WorkDoneProgressCreateParams
-> WorkDoneProgressCreateParams -> Bool)
-> (WorkDoneProgressCreateParams
-> WorkDoneProgressCreateParams -> Bool)
-> Eq WorkDoneProgressCreateParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WorkDoneProgressCreateParams
-> WorkDoneProgressCreateParams -> Bool
== :: WorkDoneProgressCreateParams
-> WorkDoneProgressCreateParams -> Bool
$c/= :: WorkDoneProgressCreateParams
-> WorkDoneProgressCreateParams -> Bool
/= :: WorkDoneProgressCreateParams
-> WorkDoneProgressCreateParams -> Bool
Eq)
deriveJSON lspOptions ''WorkDoneProgressCreateParams
data WorkDoneProgressOptions =
WorkDoneProgressOptions
{ WorkDoneProgressOptions -> Maybe Bool
_workDoneProgress :: Maybe Bool
}
deriving (ReadPrec [WorkDoneProgressOptions]
ReadPrec WorkDoneProgressOptions
Int -> ReadS WorkDoneProgressOptions
ReadS [WorkDoneProgressOptions]
(Int -> ReadS WorkDoneProgressOptions)
-> ReadS [WorkDoneProgressOptions]
-> ReadPrec WorkDoneProgressOptions
-> ReadPrec [WorkDoneProgressOptions]
-> Read WorkDoneProgressOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS WorkDoneProgressOptions
readsPrec :: Int -> ReadS WorkDoneProgressOptions
$creadList :: ReadS [WorkDoneProgressOptions]
readList :: ReadS [WorkDoneProgressOptions]
$creadPrec :: ReadPrec WorkDoneProgressOptions
readPrec :: ReadPrec WorkDoneProgressOptions
$creadListPrec :: ReadPrec [WorkDoneProgressOptions]
readListPrec :: ReadPrec [WorkDoneProgressOptions]
Read, Int -> WorkDoneProgressOptions -> ShowS
[WorkDoneProgressOptions] -> ShowS
WorkDoneProgressOptions -> String
(Int -> WorkDoneProgressOptions -> ShowS)
-> (WorkDoneProgressOptions -> String)
-> ([WorkDoneProgressOptions] -> ShowS)
-> Show WorkDoneProgressOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WorkDoneProgressOptions -> ShowS
showsPrec :: Int -> WorkDoneProgressOptions -> ShowS
$cshow :: WorkDoneProgressOptions -> String
show :: WorkDoneProgressOptions -> String
$cshowList :: [WorkDoneProgressOptions] -> ShowS
showList :: [WorkDoneProgressOptions] -> ShowS
Show, WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool
(WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool)
-> (WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool)
-> Eq WorkDoneProgressOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool
== :: WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool
$c/= :: WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool
/= :: WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool
Eq)
deriveJSON lspOptions ''WorkDoneProgressOptions
data WorkDoneProgressParams =
WorkDoneProgressParams
{
WorkDoneProgressParams -> Maybe ProgressToken
_workDoneToken :: Maybe ProgressToken
} deriving (ReadPrec [WorkDoneProgressParams]
ReadPrec WorkDoneProgressParams
Int -> ReadS WorkDoneProgressParams
ReadS [WorkDoneProgressParams]
(Int -> ReadS WorkDoneProgressParams)
-> ReadS [WorkDoneProgressParams]
-> ReadPrec WorkDoneProgressParams
-> ReadPrec [WorkDoneProgressParams]
-> Read WorkDoneProgressParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS WorkDoneProgressParams
readsPrec :: Int -> ReadS WorkDoneProgressParams
$creadList :: ReadS [WorkDoneProgressParams]
readList :: ReadS [WorkDoneProgressParams]
$creadPrec :: ReadPrec WorkDoneProgressParams
readPrec :: ReadPrec WorkDoneProgressParams
$creadListPrec :: ReadPrec [WorkDoneProgressParams]
readListPrec :: ReadPrec [WorkDoneProgressParams]
Read,Int -> WorkDoneProgressParams -> ShowS
[WorkDoneProgressParams] -> ShowS
WorkDoneProgressParams -> String
(Int -> WorkDoneProgressParams -> ShowS)
-> (WorkDoneProgressParams -> String)
-> ([WorkDoneProgressParams] -> ShowS)
-> Show WorkDoneProgressParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WorkDoneProgressParams -> ShowS
showsPrec :: Int -> WorkDoneProgressParams -> ShowS
$cshow :: WorkDoneProgressParams -> String
show :: WorkDoneProgressParams -> String
$cshowList :: [WorkDoneProgressParams] -> ShowS
showList :: [WorkDoneProgressParams] -> ShowS
Show,WorkDoneProgressParams -> WorkDoneProgressParams -> Bool
(WorkDoneProgressParams -> WorkDoneProgressParams -> Bool)
-> (WorkDoneProgressParams -> WorkDoneProgressParams -> Bool)
-> Eq WorkDoneProgressParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WorkDoneProgressParams -> WorkDoneProgressParams -> Bool
== :: WorkDoneProgressParams -> WorkDoneProgressParams -> Bool
$c/= :: WorkDoneProgressParams -> WorkDoneProgressParams -> Bool
/= :: WorkDoneProgressParams -> WorkDoneProgressParams -> Bool
Eq)
deriveJSON lspOptions ''WorkDoneProgressParams
data SomeProgressParams
= Begin WorkDoneProgressBeginParams
| Report WorkDoneProgressReportParams
| End WorkDoneProgressEndParams
deriving SomeProgressParams -> SomeProgressParams -> Bool
(SomeProgressParams -> SomeProgressParams -> Bool)
-> (SomeProgressParams -> SomeProgressParams -> Bool)
-> Eq SomeProgressParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SomeProgressParams -> SomeProgressParams -> Bool
== :: SomeProgressParams -> SomeProgressParams -> Bool
$c/= :: SomeProgressParams -> SomeProgressParams -> Bool
/= :: SomeProgressParams -> SomeProgressParams -> Bool
Eq
deriveJSON lspOptionsUntagged ''SomeProgressParams
data PartialResultParams =
PartialResultParams
{
PartialResultParams -> Maybe ProgressToken
_partialResultToken :: Maybe ProgressToken
} deriving (ReadPrec [PartialResultParams]
ReadPrec PartialResultParams
Int -> ReadS PartialResultParams
ReadS [PartialResultParams]
(Int -> ReadS PartialResultParams)
-> ReadS [PartialResultParams]
-> ReadPrec PartialResultParams
-> ReadPrec [PartialResultParams]
-> Read PartialResultParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS PartialResultParams
readsPrec :: Int -> ReadS PartialResultParams
$creadList :: ReadS [PartialResultParams]
readList :: ReadS [PartialResultParams]
$creadPrec :: ReadPrec PartialResultParams
readPrec :: ReadPrec PartialResultParams
$creadListPrec :: ReadPrec [PartialResultParams]
readListPrec :: ReadPrec [PartialResultParams]
Read,Int -> PartialResultParams -> ShowS
[PartialResultParams] -> ShowS
PartialResultParams -> String
(Int -> PartialResultParams -> ShowS)
-> (PartialResultParams -> String)
-> ([PartialResultParams] -> ShowS)
-> Show PartialResultParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PartialResultParams -> ShowS
showsPrec :: Int -> PartialResultParams -> ShowS
$cshow :: PartialResultParams -> String
show :: PartialResultParams -> String
$cshowList :: [PartialResultParams] -> ShowS
showList :: [PartialResultParams] -> ShowS
Show,PartialResultParams -> PartialResultParams -> Bool
(PartialResultParams -> PartialResultParams -> Bool)
-> (PartialResultParams -> PartialResultParams -> Bool)
-> Eq PartialResultParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PartialResultParams -> PartialResultParams -> Bool
== :: PartialResultParams -> PartialResultParams -> Bool
$c/= :: PartialResultParams -> PartialResultParams -> Bool
/= :: PartialResultParams -> PartialResultParams -> Bool
Eq)
deriveJSON lspOptions ''PartialResultParams