{-# 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

-- | A token used to report progress back or return partial results for a
-- specific request.
-- @since 0.17.0.0
data ProgressToken
    = ProgressNumericToken Int32
    | ProgressTextToken Text
    deriving (Int -> ProgressToken -> ShowS
[ProgressToken] -> ShowS
ProgressToken -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProgressToken] -> ShowS
$cshowList :: [ProgressToken] -> ShowS
show :: ProgressToken -> String
$cshow :: ProgressToken -> String
showsPrec :: Int -> ProgressToken -> ShowS
$cshowsPrec :: Int -> ProgressToken -> ShowS
Show, ReadPrec [ProgressToken]
ReadPrec ProgressToken
Int -> ReadS ProgressToken
ReadS [ProgressToken]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProgressToken]
$creadListPrec :: ReadPrec [ProgressToken]
readPrec :: ReadPrec ProgressToken
$creadPrec :: ReadPrec ProgressToken
readList :: ReadS [ProgressToken]
$creadList :: ReadS [ProgressToken]
readsPrec :: Int -> ReadS ProgressToken
$creadsPrec :: Int -> ReadS ProgressToken
Read, ProgressToken -> ProgressToken -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProgressToken -> ProgressToken -> Bool
$c/= :: ProgressToken -> ProgressToken -> Bool
== :: ProgressToken -> ProgressToken -> Bool
$c== :: ProgressToken -> ProgressToken -> Bool
Eq, Eq 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
min :: ProgressToken -> ProgressToken -> ProgressToken
$cmin :: ProgressToken -> ProgressToken -> ProgressToken
max :: ProgressToken -> ProgressToken -> ProgressToken
$cmax :: ProgressToken -> ProgressToken -> ProgressToken
>= :: ProgressToken -> ProgressToken -> Bool
$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
compare :: ProgressToken -> ProgressToken -> Ordering
$ccompare :: ProgressToken -> ProgressToken -> Ordering
Ord)

deriveJSON lspOptionsUntagged ''ProgressToken

-- | Parameters for a $/progress notification.
data ProgressParams t =
    ProgressParams {
      forall t. ProgressParams t -> ProgressToken
_token :: ProgressToken
    , forall t. ProgressParams t -> t
_value :: t
    } deriving (Int -> ProgressParams t -> ShowS
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
showList :: [ProgressParams t] -> ShowS
$cshowList :: forall t. Show t => [ProgressParams t] -> ShowS
show :: ProgressParams t -> String
$cshow :: forall t. Show t => ProgressParams t -> String
showsPrec :: Int -> ProgressParams t -> ShowS
$cshowsPrec :: forall t. Show t => Int -> ProgressParams t -> ShowS
Show, ReadPrec [ProgressParams t]
ReadPrec (ProgressParams t)
ReadS [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
readListPrec :: ReadPrec [ProgressParams t]
$creadListPrec :: forall t. Read t => ReadPrec [ProgressParams t]
readPrec :: ReadPrec (ProgressParams t)
$creadPrec :: forall t. Read t => ReadPrec (ProgressParams t)
readList :: ReadS [ProgressParams t]
$creadList :: forall t. Read t => ReadS [ProgressParams t]
readsPrec :: Int -> ReadS (ProgressParams t)
$creadsPrec :: forall t. Read t => Int -> ReadS (ProgressParams t)
Read, ProgressParams t -> ProgressParams t -> Bool
forall t. Eq t => ProgressParams t -> ProgressParams t -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProgressParams t -> ProgressParams t -> Bool
$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
Eq, 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
<$ :: forall a b. a -> ProgressParams b -> ProgressParams a
$c<$ :: forall a b. a -> ProgressParams b -> ProgressParams a
fmap :: forall a b. (a -> b) -> ProgressParams a -> ProgressParams b
$cfmap :: forall a b. (a -> b) -> ProgressParams a -> ProgressParams b
Functor)

deriveJSON lspOptions ''ProgressParams

-- | Parameters for 'WorkDoneProgressBeginNotification'.
--
-- @since 0.10.0.0
data WorkDoneProgressBeginParams =
  WorkDoneProgressBeginParams {
  -- | Mandatory title of the progress operation.
  -- Used to briefly inform about the kind of operation being
  -- performed. Examples: "Indexing" or "Linking dependencies".
   WorkDoneProgressBeginParams -> Text
_title :: Text
  -- | Controls if a cancel button should show to allow the user to cancel the
  -- long running operation. Clients that don't support cancellation are allowed
  -- to ignore the setting.
  , WorkDoneProgressBeginParams -> Maybe Bool
_cancellable :: Maybe Bool
  -- | Optional, more detailed associated progress
  -- message. Contains complementary information to the
  -- '_title'. Examples: "3/25 files",
  -- "project/src/module2", "node_modules/some_dep". If
  -- unset, the previous progress message (if any) is
  -- still valid.
  , WorkDoneProgressBeginParams -> Maybe Text
_message :: Maybe Text
  -- | Optional progress percentage to display (value 100 is considered 100%).
  -- If not provided infinite progress is assumed and clients are allowed
  -- to ignore the '_percentage' value in subsequent in report notifications.
  --
  -- The value should be steadily rising. Clients are free to ignore values
  -- that are not following this rule.
  , WorkDoneProgressBeginParams -> Maybe UInt
_percentage :: Maybe UInt
  } deriving (Int -> WorkDoneProgressBeginParams -> ShowS
[WorkDoneProgressBeginParams] -> ShowS
WorkDoneProgressBeginParams -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkDoneProgressBeginParams] -> ShowS
$cshowList :: [WorkDoneProgressBeginParams] -> ShowS
show :: WorkDoneProgressBeginParams -> String
$cshow :: WorkDoneProgressBeginParams -> String
showsPrec :: Int -> WorkDoneProgressBeginParams -> ShowS
$cshowsPrec :: Int -> WorkDoneProgressBeginParams -> ShowS
Show, ReadPrec [WorkDoneProgressBeginParams]
ReadPrec WorkDoneProgressBeginParams
Int -> ReadS WorkDoneProgressBeginParams
ReadS [WorkDoneProgressBeginParams]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkDoneProgressBeginParams]
$creadListPrec :: ReadPrec [WorkDoneProgressBeginParams]
readPrec :: ReadPrec WorkDoneProgressBeginParams
$creadPrec :: ReadPrec WorkDoneProgressBeginParams
readList :: ReadS [WorkDoneProgressBeginParams]
$creadList :: ReadS [WorkDoneProgressBeginParams]
readsPrec :: Int -> ReadS WorkDoneProgressBeginParams
$creadsPrec :: Int -> ReadS WorkDoneProgressBeginParams
Read, WorkDoneProgressBeginParams -> WorkDoneProgressBeginParams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkDoneProgressBeginParams -> WorkDoneProgressBeginParams -> Bool
$c/= :: WorkDoneProgressBeginParams -> WorkDoneProgressBeginParams -> Bool
== :: WorkDoneProgressBeginParams -> WorkDoneProgressBeginParams -> Bool
$c== :: WorkDoneProgressBeginParams -> WorkDoneProgressBeginParams -> Bool
Eq)

instance A.ToJSON WorkDoneProgressBeginParams where
    toJSON :: WorkDoneProgressBeginParams -> Value
toJSON WorkDoneProgressBeginParams{Maybe Bool
Maybe Text
Maybe UInt
Text
_percentage :: Maybe UInt
_message :: Maybe Text
_cancellable :: Maybe Bool
_title :: Text
$sel:_percentage:WorkDoneProgressBeginParams :: WorkDoneProgressBeginParams -> Maybe UInt
$sel:_message:WorkDoneProgressBeginParams :: WorkDoneProgressBeginParams -> Maybe Text
$sel:_cancellable:WorkDoneProgressBeginParams :: WorkDoneProgressBeginParams -> Maybe Bool
$sel:_title:WorkDoneProgressBeginParams :: WorkDoneProgressBeginParams -> Text
..} =
        [Pair] -> Value
A.object forall a b. (a -> b) -> a -> b
$ forall a. [Maybe a] -> [a]
catMaybes
            [ forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Key
"kind" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= (Text
"begin" :: Text)
            , forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Key
"title" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= Text
_title
            , (Key
"cancellable" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Bool
_cancellable
            , (Key
"message" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Text
_message
            , (Key
"percentage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..=) 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 = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"WorkDoneProgressBegin" forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Text
kind <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"kind"
        forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text
kind forall a. Eq a => a -> a -> Bool
== (Text
"begin" :: Text)) forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadFail m => String -> m a
fail forall a b. (a -> b) -> a -> b
$ String
"Expected kind \"begin\" but got " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Text
kind
        Text
_title <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"title"
        Maybe Bool
_cancellable <- Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"cancellable"
        Maybe Text
_message <- Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"message"
        Maybe UInt
_percentage <- Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"percentage"
        forall (f :: * -> *) a. Applicative f => a -> f a
pure WorkDoneProgressBeginParams{Maybe Bool
Maybe Text
Maybe UInt
Text
_percentage :: Maybe UInt
_message :: Maybe Text
_cancellable :: Maybe Bool
_title :: Text
$sel:_percentage:WorkDoneProgressBeginParams :: Maybe UInt
$sel:_message:WorkDoneProgressBeginParams :: Maybe Text
$sel:_cancellable:WorkDoneProgressBeginParams :: Maybe Bool
$sel:_title:WorkDoneProgressBeginParams :: Text
..}

-- The $/progress begin notification is sent from the server to the
-- client to ask the client to start progress.
--
-- @since 0.10.0.0

-- | Parameters for 'WorkDoneProgressReportNotification'
--
-- @since 0.10.0.0
data WorkDoneProgressReportParams =
  WorkDoneProgressReportParams {
    WorkDoneProgressReportParams -> Maybe Bool
_cancellable :: Maybe Bool
  -- | Optional, more detailed associated progress
  -- message. Contains complementary information to the
  -- '_title'. Examples: "3/25 files",
  -- "project/src/module2", "node_modules/some_dep". If
  -- unset, the previous progress message (if any) is
  -- still valid.
  , WorkDoneProgressReportParams -> Maybe Text
_message :: Maybe Text
  -- | Optional progress percentage to display (value 100 is considered 100%).
  -- If infinite progress was indicated in the start notification client
  -- are allowed to ignore the value. In addition the value should be steadily
  -- rising. Clients are free to ignore values that are not following this rule.
  , WorkDoneProgressReportParams -> Maybe UInt
_percentage :: Maybe UInt
  } deriving (Int -> WorkDoneProgressReportParams -> ShowS
[WorkDoneProgressReportParams] -> ShowS
WorkDoneProgressReportParams -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkDoneProgressReportParams] -> ShowS
$cshowList :: [WorkDoneProgressReportParams] -> ShowS
show :: WorkDoneProgressReportParams -> String
$cshow :: WorkDoneProgressReportParams -> String
showsPrec :: Int -> WorkDoneProgressReportParams -> ShowS
$cshowsPrec :: Int -> WorkDoneProgressReportParams -> ShowS
Show, ReadPrec [WorkDoneProgressReportParams]
ReadPrec WorkDoneProgressReportParams
Int -> ReadS WorkDoneProgressReportParams
ReadS [WorkDoneProgressReportParams]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkDoneProgressReportParams]
$creadListPrec :: ReadPrec [WorkDoneProgressReportParams]
readPrec :: ReadPrec WorkDoneProgressReportParams
$creadPrec :: ReadPrec WorkDoneProgressReportParams
readList :: ReadS [WorkDoneProgressReportParams]
$creadList :: ReadS [WorkDoneProgressReportParams]
readsPrec :: Int -> ReadS WorkDoneProgressReportParams
$creadsPrec :: Int -> ReadS WorkDoneProgressReportParams
Read, WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool
$c/= :: WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool
== :: WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool
$c== :: WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool
Eq)

instance A.ToJSON WorkDoneProgressReportParams where
  toJSON :: WorkDoneProgressReportParams -> Value
toJSON WorkDoneProgressReportParams{Maybe Bool
Maybe Text
Maybe UInt
_percentage :: Maybe UInt
_message :: Maybe Text
_cancellable :: Maybe Bool
$sel:_percentage:WorkDoneProgressReportParams :: WorkDoneProgressReportParams -> Maybe UInt
$sel:_message:WorkDoneProgressReportParams :: WorkDoneProgressReportParams -> Maybe Text
$sel:_cancellable:WorkDoneProgressReportParams :: WorkDoneProgressReportParams -> Maybe Bool
..} =
    [Pair] -> Value
A.object forall a b. (a -> b) -> a -> b
$ forall a. [Maybe a] -> [a]
catMaybes
      [ forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Key
"kind" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= (Text
"report" :: Text)
      , (Key
"cancellable" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Bool
_cancellable
      , (Key
"message" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Text
_message
      , (Key
"percentage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..=) 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 = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"WorkDoneProgressReport" forall a b. (a -> b) -> a -> b
$ \Object
o -> do
    Text
kind <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"kind"
    forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text
kind forall a. Eq a => a -> a -> Bool
== (Text
"report" :: Text)) forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadFail m => String -> m a
fail forall a b. (a -> b) -> a -> b
$ String
"Expected kind \"report\" but got " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Text
kind
    Maybe Bool
_cancellable <- Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"cancellable"
    Maybe Text
_message <- Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"message"
    Maybe UInt
_percentage <- Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"percentage"
    forall (f :: * -> *) a. Applicative f => a -> f a
pure WorkDoneProgressReportParams{Maybe Bool
Maybe Text
Maybe UInt
_percentage :: Maybe UInt
_message :: Maybe Text
_cancellable :: Maybe Bool
$sel:_percentage:WorkDoneProgressReportParams :: Maybe UInt
$sel:_message:WorkDoneProgressReportParams :: Maybe Text
$sel:_cancellable:WorkDoneProgressReportParams :: Maybe Bool
..}

-- The workdone $/progress report notification is sent from the server to the
-- client to report progress for a previously started progress.
--
-- @since 0.10.0.0

-- | Parameters for 'WorkDoneProgressEndNotification'.
--
-- @since 0.10.0.0
data WorkDoneProgressEndParams =
  WorkDoneProgressEndParams {
    WorkDoneProgressEndParams -> Maybe Text
_message   :: Maybe Text
  } deriving (Int -> WorkDoneProgressEndParams -> ShowS
[WorkDoneProgressEndParams] -> ShowS
WorkDoneProgressEndParams -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkDoneProgressEndParams] -> ShowS
$cshowList :: [WorkDoneProgressEndParams] -> ShowS
show :: WorkDoneProgressEndParams -> String
$cshow :: WorkDoneProgressEndParams -> String
showsPrec :: Int -> WorkDoneProgressEndParams -> ShowS
$cshowsPrec :: Int -> WorkDoneProgressEndParams -> ShowS
Show, ReadPrec [WorkDoneProgressEndParams]
ReadPrec WorkDoneProgressEndParams
Int -> ReadS WorkDoneProgressEndParams
ReadS [WorkDoneProgressEndParams]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkDoneProgressEndParams]
$creadListPrec :: ReadPrec [WorkDoneProgressEndParams]
readPrec :: ReadPrec WorkDoneProgressEndParams
$creadPrec :: ReadPrec WorkDoneProgressEndParams
readList :: ReadS [WorkDoneProgressEndParams]
$creadList :: ReadS [WorkDoneProgressEndParams]
readsPrec :: Int -> ReadS WorkDoneProgressEndParams
$creadsPrec :: Int -> ReadS WorkDoneProgressEndParams
Read, WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool
$c/= :: WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool
== :: WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool
$c== :: WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool
Eq)

instance A.ToJSON WorkDoneProgressEndParams where
  toJSON :: WorkDoneProgressEndParams -> Value
toJSON WorkDoneProgressEndParams{Maybe Text
_message :: Maybe Text
$sel:_message:WorkDoneProgressEndParams :: WorkDoneProgressEndParams -> Maybe Text
..} =
    [Pair] -> Value
A.object forall a b. (a -> b) -> a -> b
$ forall a. [Maybe a] -> [a]
catMaybes
      [ forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Key
"kind" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..= (Text
"end" :: Text)
      , (Key
"message" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
A..=) 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 = forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"WorkDoneProgressEnd" forall a b. (a -> b) -> a -> b
$ \Object
o -> do
    Text
kind <- Object
o forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"kind"
    forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text
kind forall a. Eq a => a -> a -> Bool
== (Text
"end" :: Text)) forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadFail m => String -> m a
fail forall a b. (a -> b) -> a -> b
$ String
"Expected kind \"end\" but got " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Text
kind
    Maybe Text
_message <- Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"message"
    forall (f :: * -> *) a. Applicative f => a -> f a
pure WorkDoneProgressEndParams{Maybe Text
_message :: Maybe Text
$sel:_message:WorkDoneProgressEndParams :: Maybe Text
..}

--  The $/progress end notification is sent from the server to the
-- client to stop a previously started progress.
--
-- @since 0.10.0.0

-- | Parameters for 'WorkDoneProgressCancelNotification'.
--
-- @since 0.10.0.0
data WorkDoneProgressCancelParams =
  WorkDoneProgressCancelParams {
  -- | A unique identifier to associate multiple progress
  -- notifications with the same progress.
    WorkDoneProgressCancelParams -> ProgressToken
_token   :: ProgressToken
  } deriving (Int -> WorkDoneProgressCancelParams -> ShowS
[WorkDoneProgressCancelParams] -> ShowS
WorkDoneProgressCancelParams -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkDoneProgressCancelParams] -> ShowS
$cshowList :: [WorkDoneProgressCancelParams] -> ShowS
show :: WorkDoneProgressCancelParams -> String
$cshow :: WorkDoneProgressCancelParams -> String
showsPrec :: Int -> WorkDoneProgressCancelParams -> ShowS
$cshowsPrec :: Int -> WorkDoneProgressCancelParams -> ShowS
Show, ReadPrec [WorkDoneProgressCancelParams]
ReadPrec WorkDoneProgressCancelParams
Int -> ReadS WorkDoneProgressCancelParams
ReadS [WorkDoneProgressCancelParams]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkDoneProgressCancelParams]
$creadListPrec :: ReadPrec [WorkDoneProgressCancelParams]
readPrec :: ReadPrec WorkDoneProgressCancelParams
$creadPrec :: ReadPrec WorkDoneProgressCancelParams
readList :: ReadS [WorkDoneProgressCancelParams]
$creadList :: ReadS [WorkDoneProgressCancelParams]
readsPrec :: Int -> ReadS WorkDoneProgressCancelParams
$creadsPrec :: Int -> ReadS WorkDoneProgressCancelParams
Read, WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool
$c/= :: WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool
== :: WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool
$c== :: WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool
Eq)

deriveJSON lspOptions ''WorkDoneProgressCancelParams

-- The window/workDoneProgress/cancel notification is sent from the client to the server
-- to inform the server that the user has pressed the cancel button on the progress UX.
-- A server receiving a cancel request must still close a progress using the done notification.
--
-- @since 0.10.0.0

data WorkDoneProgressCreateParams =
      WorkDoneProgressCreateParams {
      WorkDoneProgressCreateParams -> ProgressToken
_token :: ProgressToken
    } deriving (Int -> WorkDoneProgressCreateParams -> ShowS
[WorkDoneProgressCreateParams] -> ShowS
WorkDoneProgressCreateParams -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkDoneProgressCreateParams] -> ShowS
$cshowList :: [WorkDoneProgressCreateParams] -> ShowS
show :: WorkDoneProgressCreateParams -> String
$cshow :: WorkDoneProgressCreateParams -> String
showsPrec :: Int -> WorkDoneProgressCreateParams -> ShowS
$cshowsPrec :: Int -> WorkDoneProgressCreateParams -> ShowS
Show, ReadPrec [WorkDoneProgressCreateParams]
ReadPrec WorkDoneProgressCreateParams
Int -> ReadS WorkDoneProgressCreateParams
ReadS [WorkDoneProgressCreateParams]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkDoneProgressCreateParams]
$creadListPrec :: ReadPrec [WorkDoneProgressCreateParams]
readPrec :: ReadPrec WorkDoneProgressCreateParams
$creadPrec :: ReadPrec WorkDoneProgressCreateParams
readList :: ReadS [WorkDoneProgressCreateParams]
$creadList :: ReadS [WorkDoneProgressCreateParams]
readsPrec :: Int -> ReadS WorkDoneProgressCreateParams
$creadsPrec :: Int -> ReadS WorkDoneProgressCreateParams
Read, WorkDoneProgressCreateParams
-> WorkDoneProgressCreateParams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkDoneProgressCreateParams
-> WorkDoneProgressCreateParams -> Bool
$c/= :: WorkDoneProgressCreateParams
-> WorkDoneProgressCreateParams -> Bool
== :: WorkDoneProgressCreateParams
-> WorkDoneProgressCreateParams -> Bool
$c== :: 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]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkDoneProgressOptions]
$creadListPrec :: ReadPrec [WorkDoneProgressOptions]
readPrec :: ReadPrec WorkDoneProgressOptions
$creadPrec :: ReadPrec WorkDoneProgressOptions
readList :: ReadS [WorkDoneProgressOptions]
$creadList :: ReadS [WorkDoneProgressOptions]
readsPrec :: Int -> ReadS WorkDoneProgressOptions
$creadsPrec :: Int -> ReadS WorkDoneProgressOptions
Read, Int -> WorkDoneProgressOptions -> ShowS
[WorkDoneProgressOptions] -> ShowS
WorkDoneProgressOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkDoneProgressOptions] -> ShowS
$cshowList :: [WorkDoneProgressOptions] -> ShowS
show :: WorkDoneProgressOptions -> String
$cshow :: WorkDoneProgressOptions -> String
showsPrec :: Int -> WorkDoneProgressOptions -> ShowS
$cshowsPrec :: Int -> WorkDoneProgressOptions -> ShowS
Show, WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool
$c/= :: WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool
== :: WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool
$c== :: WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool
Eq)

deriveJSON lspOptions ''WorkDoneProgressOptions

data WorkDoneProgressParams =
  WorkDoneProgressParams
    { -- | An optional token that a server can use to report work done progress
      WorkDoneProgressParams -> Maybe ProgressToken
_workDoneToken :: Maybe ProgressToken
    } deriving (ReadPrec [WorkDoneProgressParams]
ReadPrec WorkDoneProgressParams
Int -> ReadS WorkDoneProgressParams
ReadS [WorkDoneProgressParams]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkDoneProgressParams]
$creadListPrec :: ReadPrec [WorkDoneProgressParams]
readPrec :: ReadPrec WorkDoneProgressParams
$creadPrec :: ReadPrec WorkDoneProgressParams
readList :: ReadS [WorkDoneProgressParams]
$creadList :: ReadS [WorkDoneProgressParams]
readsPrec :: Int -> ReadS WorkDoneProgressParams
$creadsPrec :: Int -> ReadS WorkDoneProgressParams
Read,Int -> WorkDoneProgressParams -> ShowS
[WorkDoneProgressParams] -> ShowS
WorkDoneProgressParams -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkDoneProgressParams] -> ShowS
$cshowList :: [WorkDoneProgressParams] -> ShowS
show :: WorkDoneProgressParams -> String
$cshow :: WorkDoneProgressParams -> String
showsPrec :: Int -> WorkDoneProgressParams -> ShowS
$cshowsPrec :: Int -> WorkDoneProgressParams -> ShowS
Show,WorkDoneProgressParams -> WorkDoneProgressParams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkDoneProgressParams -> WorkDoneProgressParams -> Bool
$c/= :: WorkDoneProgressParams -> WorkDoneProgressParams -> Bool
== :: WorkDoneProgressParams -> WorkDoneProgressParams -> Bool
$c== :: WorkDoneProgressParams -> WorkDoneProgressParams -> Bool
Eq)
deriveJSON lspOptions ''WorkDoneProgressParams

data SomeProgressParams
  = Begin WorkDoneProgressBeginParams
  | Report WorkDoneProgressReportParams
  | End WorkDoneProgressEndParams
  deriving SomeProgressParams -> SomeProgressParams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SomeProgressParams -> SomeProgressParams -> Bool
$c/= :: SomeProgressParams -> SomeProgressParams -> Bool
== :: SomeProgressParams -> SomeProgressParams -> Bool
$c== :: SomeProgressParams -> SomeProgressParams -> Bool
Eq

deriveJSON lspOptionsUntagged ''SomeProgressParams

data PartialResultParams =
  PartialResultParams
    { -- | An optional token that a server can use to report partial results
      --  (e.g. streaming) to the client.
      PartialResultParams -> Maybe ProgressToken
_partialResultToken :: Maybe ProgressToken
    } deriving (ReadPrec [PartialResultParams]
ReadPrec PartialResultParams
Int -> ReadS PartialResultParams
ReadS [PartialResultParams]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PartialResultParams]
$creadListPrec :: ReadPrec [PartialResultParams]
readPrec :: ReadPrec PartialResultParams
$creadPrec :: ReadPrec PartialResultParams
readList :: ReadS [PartialResultParams]
$creadList :: ReadS [PartialResultParams]
readsPrec :: Int -> ReadS PartialResultParams
$creadsPrec :: Int -> ReadS PartialResultParams
Read,Int -> PartialResultParams -> ShowS
[PartialResultParams] -> ShowS
PartialResultParams -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PartialResultParams] -> ShowS
$cshowList :: [PartialResultParams] -> ShowS
show :: PartialResultParams -> String
$cshow :: PartialResultParams -> String
showsPrec :: Int -> PartialResultParams -> ShowS
$cshowsPrec :: Int -> PartialResultParams -> ShowS
Show,PartialResultParams -> PartialResultParams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PartialResultParams -> PartialResultParams -> Bool
$c/= :: PartialResultParams -> PartialResultParams -> Bool
== :: PartialResultParams -> PartialResultParams -> Bool
$c== :: PartialResultParams -> PartialResultParams -> Bool
Eq)
deriveJSON lspOptions ''PartialResultParams