{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE DuplicateRecordFields #-}
module Language.LSP.Types.Formatting where
import Data.Aeson.TH
import Data.Text (Text)
import Language.LSP.Types.Location
import Language.LSP.Types.Progress
import Language.LSP.Types.TextDocument
import Language.LSP.Types.Utils
data DocumentFormattingClientCapabilities =
DocumentFormattingClientCapabilities
{
_dynamicRegistration :: Maybe Bool
} deriving (Show, Read, Eq)
deriveJSON lspOptions ''DocumentFormattingClientCapabilities
makeExtendingDatatype "DocumentFormattingOptions" [''WorkDoneProgressOptions] []
deriveJSON lspOptions ''DocumentFormattingOptions
makeExtendingDatatype "DocumentFormattingRegistrationOptions"
[ ''TextDocumentRegistrationOptions,
''DocumentFormattingOptions
]
[]
deriveJSON lspOptions ''DocumentFormattingRegistrationOptions
data FormattingOptions = FormattingOptions
{
_tabSize :: Int,
_insertSpaces :: Bool,
_trimTrailingWhitespace :: Maybe Bool,
_insertFinalNewline :: Maybe Bool,
_trimFinalNewlines :: Maybe Bool
}
deriving (Read, Show, Eq)
deriveJSON lspOptions ''FormattingOptions
makeExtendingDatatype "DocumentFormattingParams" [''WorkDoneProgressParams]
[ ("_textDocument", [t| TextDocumentIdentifier |])
, ("_options", [t| FormattingOptions |])
]
deriveJSON lspOptions ''DocumentFormattingParams
data DocumentRangeFormattingClientCapabilities =
DocumentRangeFormattingClientCapabilities
{
_dynamicRegistration :: Maybe Bool
} deriving (Show, Read, Eq)
deriveJSON lspOptions ''DocumentRangeFormattingClientCapabilities
makeExtendingDatatype "DocumentRangeFormattingOptions" [''WorkDoneProgressOptions] []
deriveJSON lspOptions ''DocumentRangeFormattingOptions
makeExtendingDatatype "DocumentRangeFormattingRegistrationOptions"
[ ''TextDocumentRegistrationOptions
, ''DocumentRangeFormattingOptions
]
[]
deriveJSON lspOptions ''DocumentRangeFormattingRegistrationOptions
makeExtendingDatatype "DocumentRangeFormattingParams" [''WorkDoneProgressParams]
[ ("_textDocument", [t| TextDocumentIdentifier |])
, ("_range", [t| Range |])
, ("_options", [t| FormattingOptions |])
]
deriveJSON lspOptions ''DocumentRangeFormattingParams
data DocumentOnTypeFormattingClientCapabilities =
DocumentOnTypeFormattingClientCapabilities
{
_dynamicRegistration :: Maybe Bool
} deriving (Show, Read, Eq)
deriveJSON lspOptions ''DocumentOnTypeFormattingClientCapabilities
data DocumentOnTypeFormattingOptions =
DocumentOnTypeFormattingOptions
{
_firstTriggerCharacter :: Text
,
_moreTriggerCharacter :: Maybe [Text]
} deriving (Read,Show,Eq)
deriveJSON lspOptions ''DocumentOnTypeFormattingOptions
makeExtendingDatatype "DocumentOnTypeFormattingRegistrationOptions"
[ ''TextDocumentRegistrationOptions
, ''DocumentOnTypeFormattingOptions
]
[]
deriveJSON lspOptions ''DocumentOnTypeFormattingRegistrationOptions
makeExtendingDatatype "DocumentOnTypeFormattingParams" [''TextDocumentPositionParams]
[ ("_ch", [t| String |])
, ("_options", [t| FormattingOptions |])
]
deriveJSON lspOptions ''DocumentOnTypeFormattingParams