{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE TemplateHaskell #-}
module Language.LSP.Types.DocumentHighlight where
import Data.Aeson
import Data.Aeson.TH
import Language.LSP.Types.Location
import Language.LSP.Types.Progress
import Language.LSP.Types.TextDocument
import Language.LSP.Types.Utils
data DocumentHighlightClientCapabilities =
DocumentHighlightClientCapabilities
{
_dynamicRegistration :: Maybe Bool
} deriving (Show, Read, Eq)
deriveJSON lspOptions ''DocumentHighlightClientCapabilities
makeExtendingDatatype "DocumentHighlightOptions" [''WorkDoneProgressOptions] []
deriveJSON lspOptions ''DocumentHighlightOptions
makeExtendingDatatype "DocumentHighlightRegistrationOptions"
[ ''TextDocumentRegistrationOptions
, ''DocumentHighlightOptions
] []
deriveJSON lspOptions ''DocumentHighlightRegistrationOptions
makeExtendingDatatype "DocumentHighlightParams"
[ ''TextDocumentPositionParams
, ''WorkDoneProgressParams
, ''PartialResultParams
] []
deriveJSON lspOptions ''DocumentHighlightParams
data DocumentHighlightKind
=
HkText
|
HkRead
|
HkWrite
deriving (Read, Show, Eq)
instance ToJSON DocumentHighlightKind where
toJSON HkText = Number 1
toJSON HkRead = Number 2
toJSON HkWrite = Number 3
instance FromJSON DocumentHighlightKind where
parseJSON (Number 1) = pure HkText
parseJSON (Number 2) = pure HkRead
parseJSON (Number 3) = pure HkWrite
parseJSON _ = mempty
data DocumentHighlight =
DocumentHighlight
{
_range :: Range
, _kind :: Maybe DocumentHighlightKind
} deriving (Read,Show,Eq)
deriveJSON lspOptions ''DocumentHighlight