{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-unused-matches #-}
{-# OPTIONS_GHC -Wno-deprecations #-}
module Language.LSP.Protocol.Internal.Types.FormattingOptions 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.Types.Common
data FormattingOptions = FormattingOptions
{
FormattingOptions -> UInt
_tabSize :: Language.LSP.Protocol.Types.Common.UInt
,
FormattingOptions -> Bool
_insertSpaces :: Bool
,
FormattingOptions -> Maybe Bool
_trimTrailingWhitespace :: (Maybe Bool)
,
FormattingOptions -> Maybe Bool
_insertFinalNewline :: (Maybe Bool)
,
FormattingOptions -> Maybe Bool
_trimFinalNewlines :: (Maybe Bool)
}
deriving stock (Int -> FormattingOptions -> ShowS
[FormattingOptions] -> ShowS
FormattingOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FormattingOptions] -> ShowS
$cshowList :: [FormattingOptions] -> ShowS
show :: FormattingOptions -> String
$cshow :: FormattingOptions -> String
showsPrec :: Int -> FormattingOptions -> ShowS
$cshowsPrec :: Int -> FormattingOptions -> ShowS
Show, FormattingOptions -> FormattingOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FormattingOptions -> FormattingOptions -> Bool
$c/= :: FormattingOptions -> FormattingOptions -> Bool
== :: FormattingOptions -> FormattingOptions -> Bool
$c== :: FormattingOptions -> FormattingOptions -> Bool
Eq, Eq FormattingOptions
FormattingOptions -> FormattingOptions -> Bool
FormattingOptions -> FormattingOptions -> Ordering
FormattingOptions -> FormattingOptions -> FormattingOptions
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 :: FormattingOptions -> FormattingOptions -> FormattingOptions
$cmin :: FormattingOptions -> FormattingOptions -> FormattingOptions
max :: FormattingOptions -> FormattingOptions -> FormattingOptions
$cmax :: FormattingOptions -> FormattingOptions -> FormattingOptions
>= :: FormattingOptions -> FormattingOptions -> Bool
$c>= :: FormattingOptions -> FormattingOptions -> Bool
> :: FormattingOptions -> FormattingOptions -> Bool
$c> :: FormattingOptions -> FormattingOptions -> Bool
<= :: FormattingOptions -> FormattingOptions -> Bool
$c<= :: FormattingOptions -> FormattingOptions -> Bool
< :: FormattingOptions -> FormattingOptions -> Bool
$c< :: FormattingOptions -> FormattingOptions -> Bool
compare :: FormattingOptions -> FormattingOptions -> Ordering
$ccompare :: FormattingOptions -> FormattingOptions -> Ordering
Ord, forall x. Rep FormattingOptions x -> FormattingOptions
forall x. FormattingOptions -> Rep FormattingOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FormattingOptions x -> FormattingOptions
$cfrom :: forall x. FormattingOptions -> Rep FormattingOptions x
Generic)
deriving anyclass (FormattingOptions -> ()
forall a. (a -> ()) -> NFData a
rnf :: FormattingOptions -> ()
$crnf :: FormattingOptions -> ()
NFData, Eq FormattingOptions
Int -> FormattingOptions -> Int
FormattingOptions -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: FormattingOptions -> Int
$chash :: FormattingOptions -> Int
hashWithSalt :: Int -> FormattingOptions -> Int
$chashWithSalt :: Int -> FormattingOptions -> Int
Hashable)
deriving forall ann. [FormattingOptions] -> Doc ann
forall ann. FormattingOptions -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [FormattingOptions] -> Doc ann
$cprettyList :: forall ann. [FormattingOptions] -> Doc ann
pretty :: forall ann. FormattingOptions -> Doc ann
$cpretty :: forall ann. FormattingOptions -> Doc ann
Pretty via (ViaJSON FormattingOptions)
instance Aeson.ToJSON FormattingOptions where
toJSON :: FormattingOptions -> Value
toJSON (FormattingOptions UInt
arg0 Bool
arg1 Maybe Bool
arg2 Maybe Bool
arg3 Maybe Bool
arg4) = [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
"tabSize" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= UInt
arg0]
,[Key
"insertSpaces" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Bool
arg1]
,String
"trimTrailingWhitespace" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Bool
arg2
,String
"insertFinalNewline" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Bool
arg3
,String
"trimFinalNewlines" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Bool
arg4]
instance Aeson.FromJSON FormattingOptions where
parseJSON :: Value -> Parser FormattingOptions
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"FormattingOptions" forall a b. (a -> b) -> a -> b
$ \Object
arg -> UInt
-> Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> FormattingOptions
FormattingOptions forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"tabSize" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"insertSpaces" 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
"trimTrailingWhitespace" 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
"insertFinalNewline" 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
"trimFinalNewlines"