haskell-lsp-types 0.5.0.0 → 0.6.0.0
raw patch · 7 files changed
+89/−22 lines, 7 filesdep +scientificPVP ok
version bump matches the API change (PVP)
Dependencies added: scientific
API changes (from Hackage documentation)
- Language.Haskell.LSP.TH.DataTypesJSON: CommandOrCodeActionCodeAction :: CodeAction -> CommandOrCodeAction
- Language.Haskell.LSP.TH.DataTypesJSON: CommandOrCodeActionCommand :: Command -> CommandOrCodeAction
- Language.Haskell.LSP.TH.DataTypesJSON: [_containerName] :: SymbolInformation -> Maybe Text
- Language.Haskell.LSP.TH.DataTypesJSON: [_kind] :: SymbolInformation -> SymbolKind
- Language.Haskell.LSP.TH.DataTypesJSON: [_location] :: SymbolInformation -> Location
- Language.Haskell.LSP.TH.DataTypesJSON: [_name] :: SymbolInformation -> Text
- Language.Haskell.LSP.TH.DataTypesJSON: [_textDocument] :: DocumentSymbolParams -> TextDocumentIdentifier
- Language.Haskell.LSP.TH.DataTypesJSON: data CommandOrCodeAction
+ Language.Haskell.LSP.TH.ClientCapabilities: [$sel:_hierarchicalDocumentSymbolSupport:DocumentSymbolClientCapabilities] :: DocumentSymbolClientCapabilities -> Maybe Bool
+ Language.Haskell.LSP.TH.DataTypesJSON: CACodeAction :: CodeAction -> CAResult
+ Language.Haskell.LSP.TH.DataTypesJSON: CACommand :: Command -> CAResult
+ Language.Haskell.LSP.TH.DataTypesJSON: DSDocumentSymbols :: (List DocumentSymbol) -> DSResult
+ Language.Haskell.LSP.TH.DataTypesJSON: DSSymbolInformation :: (List SymbolInformation) -> DSResult
+ Language.Haskell.LSP.TH.DataTypesJSON: DocumentSymbol :: Text -> Maybe Text -> SymbolKind -> Maybe Bool -> Range -> Range -> Maybe (List DocumentSymbol) -> DocumentSymbol
+ Language.Haskell.LSP.TH.DataTypesJSON: SkUnknown :: Scientific -> SymbolKind
+ Language.Haskell.LSP.TH.DataTypesJSON: [$sel:_children:DocumentSymbol] :: DocumentSymbol -> Maybe (List DocumentSymbol)
+ Language.Haskell.LSP.TH.DataTypesJSON: [$sel:_containerName:SymbolInformation] :: SymbolInformation -> Maybe Text
+ Language.Haskell.LSP.TH.DataTypesJSON: [$sel:_deprecated:DocumentSymbol] :: DocumentSymbol -> Maybe Bool
+ Language.Haskell.LSP.TH.DataTypesJSON: [$sel:_deprecated:SymbolInformation] :: SymbolInformation -> Maybe Bool
+ Language.Haskell.LSP.TH.DataTypesJSON: [$sel:_detail:DocumentSymbol] :: DocumentSymbol -> Maybe Text
+ Language.Haskell.LSP.TH.DataTypesJSON: [$sel:_kind:DocumentSymbol] :: DocumentSymbol -> SymbolKind
+ Language.Haskell.LSP.TH.DataTypesJSON: [$sel:_kind:SymbolInformation] :: SymbolInformation -> SymbolKind
+ Language.Haskell.LSP.TH.DataTypesJSON: [$sel:_location:SymbolInformation] :: SymbolInformation -> Location
+ Language.Haskell.LSP.TH.DataTypesJSON: [$sel:_name:DocumentSymbol] :: DocumentSymbol -> Text
+ Language.Haskell.LSP.TH.DataTypesJSON: [$sel:_name:SymbolInformation] :: SymbolInformation -> Text
+ Language.Haskell.LSP.TH.DataTypesJSON: [$sel:_range:DocumentSymbol] :: DocumentSymbol -> Range
+ Language.Haskell.LSP.TH.DataTypesJSON: [$sel:_selectionRange:DocumentSymbol] :: DocumentSymbol -> Range
+ Language.Haskell.LSP.TH.DataTypesJSON: [$sel:_textDocument:DocumentSymbolParams] :: DocumentSymbolParams -> TextDocumentIdentifier
+ Language.Haskell.LSP.TH.DataTypesJSON: children :: HasChildren s a => Lens' s a
+ Language.Haskell.LSP.TH.DataTypesJSON: class HasChildren s a | s -> a
+ Language.Haskell.LSP.TH.DataTypesJSON: class HasDeprecated s a | s -> a
+ Language.Haskell.LSP.TH.DataTypesJSON: class HasSelectionRange s a | s -> a
+ Language.Haskell.LSP.TH.DataTypesJSON: data CAResult
+ Language.Haskell.LSP.TH.DataTypesJSON: data DSResult
+ Language.Haskell.LSP.TH.DataTypesJSON: data DocumentSymbol
+ Language.Haskell.LSP.TH.DataTypesJSON: deprecated :: HasDeprecated s a => Lens' s a
+ Language.Haskell.LSP.TH.DataTypesJSON: instance Language.Haskell.LSP.TH.DataTypesJSON.HasChildren Language.Haskell.LSP.TH.Symbol.DocumentSymbol (GHC.Base.Maybe (Language.Haskell.LSP.TH.List.List Language.Haskell.LSP.TH.Symbol.DocumentSymbol))
+ Language.Haskell.LSP.TH.DataTypesJSON: instance Language.Haskell.LSP.TH.DataTypesJSON.HasDeprecated Language.Haskell.LSP.TH.Symbol.DocumentSymbol (GHC.Base.Maybe GHC.Types.Bool)
+ Language.Haskell.LSP.TH.DataTypesJSON: instance Language.Haskell.LSP.TH.DataTypesJSON.HasDeprecated Language.Haskell.LSP.TH.Symbol.SymbolInformation (GHC.Base.Maybe GHC.Types.Bool)
+ Language.Haskell.LSP.TH.DataTypesJSON: instance Language.Haskell.LSP.TH.DataTypesJSON.HasDetail Language.Haskell.LSP.TH.Symbol.DocumentSymbol (GHC.Base.Maybe Data.Text.Internal.Text)
+ Language.Haskell.LSP.TH.DataTypesJSON: instance Language.Haskell.LSP.TH.DataTypesJSON.HasKind Language.Haskell.LSP.TH.Symbol.DocumentSymbol Language.Haskell.LSP.TH.Symbol.SymbolKind
+ Language.Haskell.LSP.TH.DataTypesJSON: instance Language.Haskell.LSP.TH.DataTypesJSON.HasName Language.Haskell.LSP.TH.Symbol.DocumentSymbol Data.Text.Internal.Text
+ Language.Haskell.LSP.TH.DataTypesJSON: instance Language.Haskell.LSP.TH.DataTypesJSON.HasRange Language.Haskell.LSP.TH.Symbol.DocumentSymbol Language.Haskell.LSP.TH.Location.Range
+ Language.Haskell.LSP.TH.DataTypesJSON: instance Language.Haskell.LSP.TH.DataTypesJSON.HasSelectionRange Language.Haskell.LSP.TH.Symbol.DocumentSymbol Language.Haskell.LSP.TH.Location.Range
+ Language.Haskell.LSP.TH.DataTypesJSON: selectionRange :: HasSelectionRange s a => Lens' s a
- Language.Haskell.LSP.TH.ClientCapabilities: DocumentSymbolClientCapabilities :: Maybe Bool -> Maybe DocumentSymbolKindClientCapabilities -> DocumentSymbolClientCapabilities
+ Language.Haskell.LSP.TH.ClientCapabilities: DocumentSymbolClientCapabilities :: Maybe Bool -> Maybe DocumentSymbolKindClientCapabilities -> Maybe Bool -> DocumentSymbolClientCapabilities
- Language.Haskell.LSP.TH.DataTypesJSON: SymbolInformation :: Text -> SymbolKind -> Location -> Maybe Text -> SymbolInformation
+ Language.Haskell.LSP.TH.DataTypesJSON: SymbolInformation :: Text -> SymbolKind -> Maybe Bool -> Location -> Maybe Text -> SymbolInformation
- Language.Haskell.LSP.TH.DataTypesJSON: type CodeActionRequest = RequestMessage ClientMethod CodeActionParams (List CommandOrCodeAction)
+ Language.Haskell.LSP.TH.DataTypesJSON: type CodeActionRequest = RequestMessage ClientMethod CodeActionParams (List CAResult)
- Language.Haskell.LSP.TH.DataTypesJSON: type CodeActionResponse = ResponseMessage (List CommandOrCodeAction)
+ Language.Haskell.LSP.TH.DataTypesJSON: type CodeActionResponse = ResponseMessage (List CAResult)
- Language.Haskell.LSP.TH.DataTypesJSON: type DocumentSymbolRequest = RequestMessage ClientMethod DocumentSymbolParams (List SymbolInformation)
+ Language.Haskell.LSP.TH.DataTypesJSON: type DocumentSymbolRequest = RequestMessage ClientMethod DocumentSymbolParams DSResult
- Language.Haskell.LSP.TH.DataTypesJSON: type DocumentSymbolsResponse = ResponseMessage (List SymbolInformation)
+ Language.Haskell.LSP.TH.DataTypesJSON: type DocumentSymbolsResponse = ResponseMessage DSResult
Files
- ChangeLog.md +5/−0
- haskell-lsp-types.cabal +2/−1
- src/Language/Haskell/LSP/TH/ClientCapabilities.hs +3/−0
- src/Language/Haskell/LSP/TH/CodeAction.hs +9/−10
- src/Language/Haskell/LSP/TH/DataTypesJSON.hs +1/−1
- src/Language/Haskell/LSP/TH/Message.hs +2/−2
- src/Language/Haskell/LSP/TH/Symbol.hs +67/−8
ChangeLog.md view
@@ -1,5 +1,10 @@ # Revision history for haskell-lsp-types +## 0.6.0.0 -- 2018-08-06++* Add new DocumentSymbol type and hierarchal support+* Rename CommandOrCodeAction to CAResult+ ## 0.5.0.0 -- 2018-08-03 * Update Command.arguments to match specification
haskell-lsp-types.cabal view
@@ -1,5 +1,5 @@ name: haskell-lsp-types-version: 0.5.0.0+version: 0.6.0.0 synopsis: Haskell library for the Microsoft Language Server Protocol, data types description: An implementation of the types to allow language implementors to@@ -46,6 +46,7 @@ , hashable , lens >= 4.15.2 , network-uri+ , scientific , text , unordered-containers hs-source-dirs: src
src/Language/Haskell/LSP/TH/ClientCapabilities.hs view
@@ -13,6 +13,8 @@ import Language.Haskell.LSP.TH.Symbol import Data.Default +{-# ANN module "HLint: ignore Use newtype instead of data" #-}+ -- --------------------------------------------------------------------- {- New in 3.0@@ -731,6 +733,7 @@ _dynamicRegistration :: Maybe Bool -- | Specific capabilities for the `SymbolKind`. , _symbolKind :: Maybe DocumentSymbolKindClientCapabilities+ , _hierarchicalDocumentSymbolSupport :: Maybe Bool } deriving (Show, Read, Eq) $(deriveJSON lspOptions ''DocumentSymbolClientCapabilities)
src/Language/Haskell/LSP/TH/CodeAction.hs view
@@ -278,17 +278,16 @@ deriveJSON lspOptions ''CodeAction -data CommandOrCodeAction = CommandOrCodeActionCommand Command- | CommandOrCodeActionCodeAction CodeAction+data CAResult = CACommand Command+ | CACodeAction CodeAction deriving (Read,Show,Eq) -instance FromJSON CommandOrCodeAction where- parseJSON x = CommandOrCodeActionCommand <$> parseJSON x- <|> CommandOrCodeActionCodeAction <$> parseJSON x+instance FromJSON CAResult where+ parseJSON x = CACommand <$> parseJSON x <|> CACodeAction <$> parseJSON x -instance ToJSON CommandOrCodeAction where- toJSON (CommandOrCodeActionCommand x) = toJSON x- toJSON (CommandOrCodeActionCodeAction x) = toJSON x+instance ToJSON CAResult where+ toJSON (CACommand x) = toJSON x+ toJSON (CACodeAction x) = toJSON x -type CodeActionRequest = RequestMessage ClientMethod CodeActionParams (List CommandOrCodeAction)-type CodeActionResponse = ResponseMessage (List CommandOrCodeAction)+type CodeActionRequest = RequestMessage ClientMethod CodeActionParams (List CAResult)+type CodeActionResponse = ResponseMessage (List CAResult)
src/Language/Haskell/LSP/TH/DataTypesJSON.hs view
@@ -48,7 +48,6 @@ import Language.Haskell.LSP.TH.Message import Language.Haskell.LSP.TH.Symbol import Language.Haskell.LSP.TH.TextDocument-import Language.Haskell.LSP.TH.Utils import Language.Haskell.LSP.TH.Uri import Language.Haskell.LSP.TH.WorkspaceEdit @@ -2729,4 +2728,5 @@ -- Symbol makeFieldsNoPrefix ''DocumentSymbolParams+makeFieldsNoPrefix ''DocumentSymbol makeFieldsNoPrefix ''SymbolInformation
src/Language/Haskell/LSP/TH/Message.hs view
@@ -62,7 +62,7 @@ responseId (IdInt i) = IdRspInt i responseId (IdString s) = IdRspString s --- | Converts an LspIdRsp to its LspId counterpart. +-- | Converts an LspIdRsp to its LspId counterpart. requestId :: LspIdRsp -> LspId requestId (IdRspInt i) = IdInt i requestId (IdRspString s) = IdString s@@ -208,7 +208,7 @@ -- Document | TextDocumentPublishDiagnostics -- Cancelling- | CancelRequestServer + | CancelRequestServer deriving (Eq,Ord,Read,Show) instance A.FromJSON ServerMethod where
src/Language/Haskell/LSP/TH/Symbol.hs view
@@ -1,8 +1,11 @@ {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE DuplicateRecordFields #-} module Language.Haskell.LSP.TH.Symbol where +import Control.Applicative import Data.Aeson import Data.Aeson.TH+import Data.Scientific import Data.Text (Text) import Language.Haskell.LSP.TH.Constants import Language.Haskell.LSP.TH.TextDocument@@ -132,6 +135,7 @@ | SkEvent | SkOperator | SkTypeParameter+ | SkUnknown Scientific deriving (Read,Show,Eq) instance ToJSON SymbolKind where@@ -161,7 +165,7 @@ toJSON SkEvent = Number 24 toJSON SkOperator = Number 25 toJSON SkTypeParameter = Number 26-+ toJSON (SkUnknown x) = Number x instance FromJSON SymbolKind where parseJSON (Number 1) = pure SkFile@@ -190,23 +194,78 @@ parseJSON (Number 24) = pure SkEvent parseJSON (Number 25) = pure SkOperator parseJSON (Number 26) = pure SkTypeParameter- parseJSON _ = mempty+ parseJSON (Number x) = pure (SkUnknown x)+ parseJSON _ = mempty +-- --------------------------------------------------------------------- +-- | Represents programming constructs like variables, classes, interfaces etc.+-- that appear in a document. Document symbols can be hierarchical and they+-- have two ranges: one that encloses its definition and one that points to its+-- most interesting range, e.g. the range of an identifier.+data DocumentSymbol =+ DocumentSymbol+ { _name :: Text -- ^ The name of this symbol.+ -- | More detail for this symbol, e.g the signature of a function. If not+ -- provided the name is used.+ , _detail :: Maybe Text+ , _kind :: SymbolKind -- ^ The kind of this symbol.+ , _deprecated :: Maybe Bool -- ^ Indicates if this symbol is deprecated.+ -- | The range enclosing this symbol not including leading/trailing+ -- whitespace but everything else like comments. This information is+ -- typically used to determine if the the clients cursor is inside the symbol+ -- to reveal in the symbol in the UI.+ , _range :: Range+ -- | The range that should be selected and revealed when this symbol is being+ -- picked, e.g the name of a function. Must be contained by the the '_range'.+ , _selectionRange :: Range+ -- | Children of this symbol, e.g. properties of a class.+ , _children :: Maybe (List DocumentSymbol)+ } deriving (Read,Show,Eq)++deriveJSON lspOptions ''DocumentSymbol+ -- --------------------------------------------------------------------- +-- | Represents information about programming constructs like variables, classes,+-- interfaces etc. data SymbolInformation = SymbolInformation- { _name :: Text- , _kind :: SymbolKind+ { _name :: Text -- ^ The name of this symbol.+ , _kind :: SymbolKind -- ^ The kind of this symbol.+ , _deprecated :: Maybe Bool -- ^ Indicates if this symbol is deprecated.+ -- | The location of this symbol. The location's range is used by a tool+ -- to reveal the location in the editor. If the symbol is selected in the+ -- tool the range's start information is used to position the cursor. So+ -- the range usually spans more then the actual symbol's name and does+ -- normally include things like visibility modifiers.+ --+ -- The range doesn't have to denote a node range in the sense of a abstract+ -- syntax tree. It can therefore not be used to re-construct a hierarchy of+ -- the symbols. , _location :: Location- , _containerName :: Maybe Text -- ^The name of the symbol containing this- -- symbol.+ -- | The name of the symbol containing this symbol. This information is for+ -- user interface purposes (e.g. to render a qualifier in the user interface+ -- if necessary). It can't be used to re-infer a hierarchy for the document+ -- symbols.+ , _containerName :: Maybe Text } deriving (Read,Show,Eq) deriveJSON lspOptions ''SymbolInformation -- ------------------------------------- -type DocumentSymbolRequest = RequestMessage ClientMethod DocumentSymbolParams (List SymbolInformation)-type DocumentSymbolsResponse = ResponseMessage (List SymbolInformation)+data DSResult = DSDocumentSymbols (List DocumentSymbol)+ | DSSymbolInformation (List SymbolInformation)+ deriving (Read,Show,Eq)++instance FromJSON DSResult where+ parseJSON x = DSDocumentSymbols <$> parseJSON x <|> DSSymbolInformation <$> parseJSON x++instance ToJSON DSResult where+ toJSON (DSDocumentSymbols x) = toJSON x+ toJSON (DSSymbolInformation x) = toJSON x+++type DocumentSymbolRequest = RequestMessage ClientMethod DocumentSymbolParams DSResult+type DocumentSymbolsResponse = ResponseMessage DSResult