{- 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.WorkspaceOptions 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.FileOperationOptions
import qualified Language.LSP.Protocol.Internal.Types.WorkspaceFoldersServerCapabilities
import qualified Language.LSP.Protocol.Types.Common

{-|
Defines workspace specific capabilities of the server.

@since 3.18.0
@proposed
-}
data WorkspaceOptions = WorkspaceOptions 
  { {-|
  The server supports workspace folder.

  @since 3.6.0
  -}
  WorkspaceOptions -> Maybe WorkspaceFoldersServerCapabilities
_workspaceFolders :: (Maybe Language.LSP.Protocol.Internal.Types.WorkspaceFoldersServerCapabilities.WorkspaceFoldersServerCapabilities)
  , {-|
  The server is interested in notifications/requests for operations on files.

  @since 3.16.0
  -}
  WorkspaceOptions -> Maybe FileOperationOptions
_fileOperations :: (Maybe Language.LSP.Protocol.Internal.Types.FileOperationOptions.FileOperationOptions)
  }
  deriving stock (Int -> WorkspaceOptions -> ShowS
[WorkspaceOptions] -> ShowS
WorkspaceOptions -> String
(Int -> WorkspaceOptions -> ShowS)
-> (WorkspaceOptions -> String)
-> ([WorkspaceOptions] -> ShowS)
-> Show WorkspaceOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WorkspaceOptions -> ShowS
showsPrec :: Int -> WorkspaceOptions -> ShowS
$cshow :: WorkspaceOptions -> String
show :: WorkspaceOptions -> String
$cshowList :: [WorkspaceOptions] -> ShowS
showList :: [WorkspaceOptions] -> ShowS
Show, WorkspaceOptions -> WorkspaceOptions -> Bool
(WorkspaceOptions -> WorkspaceOptions -> Bool)
-> (WorkspaceOptions -> WorkspaceOptions -> Bool)
-> Eq WorkspaceOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WorkspaceOptions -> WorkspaceOptions -> Bool
== :: WorkspaceOptions -> WorkspaceOptions -> Bool
$c/= :: WorkspaceOptions -> WorkspaceOptions -> Bool
/= :: WorkspaceOptions -> WorkspaceOptions -> Bool
Eq, Eq WorkspaceOptions
Eq WorkspaceOptions =>
(WorkspaceOptions -> WorkspaceOptions -> Ordering)
-> (WorkspaceOptions -> WorkspaceOptions -> Bool)
-> (WorkspaceOptions -> WorkspaceOptions -> Bool)
-> (WorkspaceOptions -> WorkspaceOptions -> Bool)
-> (WorkspaceOptions -> WorkspaceOptions -> Bool)
-> (WorkspaceOptions -> WorkspaceOptions -> WorkspaceOptions)
-> (WorkspaceOptions -> WorkspaceOptions -> WorkspaceOptions)
-> Ord WorkspaceOptions
WorkspaceOptions -> WorkspaceOptions -> Bool
WorkspaceOptions -> WorkspaceOptions -> Ordering
WorkspaceOptions -> WorkspaceOptions -> WorkspaceOptions
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 :: WorkspaceOptions -> WorkspaceOptions -> Ordering
compare :: WorkspaceOptions -> WorkspaceOptions -> Ordering
$c< :: WorkspaceOptions -> WorkspaceOptions -> Bool
< :: WorkspaceOptions -> WorkspaceOptions -> Bool
$c<= :: WorkspaceOptions -> WorkspaceOptions -> Bool
<= :: WorkspaceOptions -> WorkspaceOptions -> Bool
$c> :: WorkspaceOptions -> WorkspaceOptions -> Bool
> :: WorkspaceOptions -> WorkspaceOptions -> Bool
$c>= :: WorkspaceOptions -> WorkspaceOptions -> Bool
>= :: WorkspaceOptions -> WorkspaceOptions -> Bool
$cmax :: WorkspaceOptions -> WorkspaceOptions -> WorkspaceOptions
max :: WorkspaceOptions -> WorkspaceOptions -> WorkspaceOptions
$cmin :: WorkspaceOptions -> WorkspaceOptions -> WorkspaceOptions
min :: WorkspaceOptions -> WorkspaceOptions -> WorkspaceOptions
Ord, (forall x. WorkspaceOptions -> Rep WorkspaceOptions x)
-> (forall x. Rep WorkspaceOptions x -> WorkspaceOptions)
-> Generic WorkspaceOptions
forall x. Rep WorkspaceOptions x -> WorkspaceOptions
forall x. WorkspaceOptions -> Rep WorkspaceOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. WorkspaceOptions -> Rep WorkspaceOptions x
from :: forall x. WorkspaceOptions -> Rep WorkspaceOptions x
$cto :: forall x. Rep WorkspaceOptions x -> WorkspaceOptions
to :: forall x. Rep WorkspaceOptions x -> WorkspaceOptions
Generic)
  deriving anyclass (WorkspaceOptions -> ()
(WorkspaceOptions -> ()) -> NFData WorkspaceOptions
forall a. (a -> ()) -> NFData a
$crnf :: WorkspaceOptions -> ()
rnf :: WorkspaceOptions -> ()
NFData, Eq WorkspaceOptions
Eq WorkspaceOptions =>
(Int -> WorkspaceOptions -> Int)
-> (WorkspaceOptions -> Int) -> Hashable WorkspaceOptions
Int -> WorkspaceOptions -> Int
WorkspaceOptions -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> WorkspaceOptions -> Int
hashWithSalt :: Int -> WorkspaceOptions -> Int
$chash :: WorkspaceOptions -> Int
hash :: WorkspaceOptions -> Int
Hashable)
  deriving (forall ann. WorkspaceOptions -> Doc ann)
-> (forall ann. [WorkspaceOptions] -> Doc ann)
-> Pretty WorkspaceOptions
forall ann. [WorkspaceOptions] -> Doc ann
forall ann. WorkspaceOptions -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. WorkspaceOptions -> Doc ann
pretty :: forall ann. WorkspaceOptions -> Doc ann
$cprettyList :: forall ann. [WorkspaceOptions] -> Doc ann
prettyList :: forall ann. [WorkspaceOptions] -> Doc ann
Pretty via (ViaJSON WorkspaceOptions)

instance Aeson.ToJSON WorkspaceOptions where
  toJSON :: WorkspaceOptions -> Value
toJSON (WorkspaceOptions Maybe WorkspaceFoldersServerCapabilities
arg0 Maybe FileOperationOptions
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
"workspaceFolders" String -> Maybe WorkspaceFoldersServerCapabilities -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe WorkspaceFoldersServerCapabilities
arg0
    ,String
"fileOperations" String -> Maybe FileOperationOptions -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe FileOperationOptions
arg1]

instance Aeson.FromJSON WorkspaceOptions where
  parseJSON :: Value -> Parser WorkspaceOptions
parseJSON = String
-> (Object -> Parser WorkspaceOptions)
-> Value
-> Parser WorkspaceOptions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"WorkspaceOptions" ((Object -> Parser WorkspaceOptions)
 -> Value -> Parser WorkspaceOptions)
-> (Object -> Parser WorkspaceOptions)
-> Value
-> Parser WorkspaceOptions
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe WorkspaceFoldersServerCapabilities
-> Maybe FileOperationOptions -> WorkspaceOptions
WorkspaceOptions (Maybe WorkspaceFoldersServerCapabilities
 -> Maybe FileOperationOptions -> WorkspaceOptions)
-> Parser (Maybe WorkspaceFoldersServerCapabilities)
-> Parser (Maybe FileOperationOptions -> WorkspaceOptions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser (Maybe WorkspaceFoldersServerCapabilities)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"workspaceFolders" Parser (Maybe FileOperationOptions -> WorkspaceOptions)
-> Parser (Maybe FileOperationOptions) -> Parser WorkspaceOptions
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 (Maybe FileOperationOptions)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"fileOperations"