haskell-lsp-types 0.15.0.0 → 0.15.0.1
raw patch · 9 files changed
+140/−11 lines, 9 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Language.Haskell.LSP.Types.Lens: instance Language.Haskell.LSP.Types.Lens.HasCode Language.Haskell.LSP.Types.Diagnostic.Diagnostic (GHC.Maybe.Maybe Data.Text.Internal.Text)
- Language.Haskell.LSP.Types.Lens: instance Language.Haskell.LSP.Types.Lens.HasCodeActionProvider Language.Haskell.LSP.Types.DataTypesJSON.InitializeResponseCapabilitiesInner (GHC.Maybe.Maybe GHC.Types.Bool)
- Language.Haskell.LSP.Types.Lens: instance Language.Haskell.LSP.Types.Lens.HasRenameProvider Language.Haskell.LSP.Types.DataTypesJSON.InitializeResponseCapabilitiesInner (GHC.Maybe.Maybe GHC.Types.Bool)
+ Language.Haskell.LSP.Types: CodeActionOptions :: Maybe [CodeActionKind] -> CodeActionOptions
+ Language.Haskell.LSP.Types: CodeActionOptionsStatic :: Bool -> CodeActionOptions
+ Language.Haskell.LSP.Types: NumberValue :: Scientific -> NumberOrString
+ Language.Haskell.LSP.Types: RangeValue :: Range -> RangeOrRangeWithPlaceholder
+ Language.Haskell.LSP.Types: RangeWithPlaceholder :: Range -> Text -> RangeWithPlaceholder
+ Language.Haskell.LSP.Types: RangeWithPlaceholderValue :: RangeWithPlaceholder -> RangeOrRangeWithPlaceholder
+ Language.Haskell.LSP.Types: RenameOptions :: Maybe Bool -> RenameOptions
+ Language.Haskell.LSP.Types: RenameOptionsStatic :: Bool -> RenameOptions
+ Language.Haskell.LSP.Types: StringValue :: Text -> NumberOrString
+ Language.Haskell.LSP.Types: TextDocumentPrepareRename :: ClientMethod
+ Language.Haskell.LSP.Types: [$sel:_codeActionKinds:CodeActionOptionsStatic] :: CodeActionOptions -> Maybe [CodeActionKind]
+ Language.Haskell.LSP.Types: [$sel:_placeholder:RangeWithPlaceholder] :: RangeWithPlaceholder -> Text
+ Language.Haskell.LSP.Types: [$sel:_prepareProvider:RenameOptionsStatic] :: RenameOptions -> Maybe Bool
+ Language.Haskell.LSP.Types: [$sel:_range:RangeWithPlaceholder] :: RangeWithPlaceholder -> Range
+ Language.Haskell.LSP.Types: data CodeActionOptions
+ Language.Haskell.LSP.Types: data NumberOrString
+ Language.Haskell.LSP.Types: data RangeOrRangeWithPlaceholder
+ Language.Haskell.LSP.Types: data RangeWithPlaceholder
+ Language.Haskell.LSP.Types: data RenameOptions
+ Language.Haskell.LSP.Types: type PrepareRenameRequest = RequestMessage ClientMethod TextDocumentPositionParams Range
+ Language.Haskell.LSP.Types: type PrepareRenameResponse = ResponseMessage (Maybe RangeOrRangeWithPlaceholder)
+ Language.Haskell.LSP.Types.Capabilities: [$sel:_prepareSupport:RenameClientCapabilities] :: RenameClientCapabilities -> Maybe Bool
+ Language.Haskell.LSP.Types.Lens: class HasPrepareSupport s a | s -> a
+ Language.Haskell.LSP.Types.Lens: instance Language.Haskell.LSP.Types.Lens.HasCode Language.Haskell.LSP.Types.Diagnostic.Diagnostic (GHC.Maybe.Maybe Language.Haskell.LSP.Types.Diagnostic.NumberOrString)
+ Language.Haskell.LSP.Types.Lens: instance Language.Haskell.LSP.Types.Lens.HasCodeActionProvider Language.Haskell.LSP.Types.DataTypesJSON.InitializeResponseCapabilitiesInner (GHC.Maybe.Maybe Language.Haskell.LSP.Types.DataTypesJSON.CodeActionOptions)
+ Language.Haskell.LSP.Types.Lens: instance Language.Haskell.LSP.Types.Lens.HasPrepareSupport Language.Haskell.LSP.Types.ClientCapabilities.RenameClientCapabilities (GHC.Maybe.Maybe GHC.Types.Bool)
+ Language.Haskell.LSP.Types.Lens: instance Language.Haskell.LSP.Types.Lens.HasRenameProvider Language.Haskell.LSP.Types.DataTypesJSON.InitializeResponseCapabilitiesInner (GHC.Maybe.Maybe Language.Haskell.LSP.Types.DataTypesJSON.RenameOptions)
+ Language.Haskell.LSP.Types.Lens: prepareSupport :: HasPrepareSupport s a => Lens' s a
- Language.Haskell.LSP.Types: Diagnostic :: Range -> Maybe DiagnosticSeverity -> Maybe Text -> Maybe DiagnosticSource -> Text -> Maybe (List DiagnosticRelatedInformation) -> Diagnostic
+ Language.Haskell.LSP.Types: Diagnostic :: Range -> Maybe DiagnosticSeverity -> Maybe NumberOrString -> Maybe DiagnosticSource -> Text -> Maybe (List DiagnosticRelatedInformation) -> Diagnostic
- Language.Haskell.LSP.Types: InitializeResponseCapabilitiesInner :: Maybe TDS -> Maybe Bool -> Maybe CompletionOptions -> Maybe SignatureHelpOptions -> Maybe Bool -> Maybe GotoOptions -> Maybe GotoOptions -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe CodeLensOptions -> Maybe Bool -> Maybe Bool -> Maybe DocumentOnTypeFormattingOptions -> Maybe Bool -> Maybe DocumentLinkOptions -> Maybe ColorOptions -> Maybe FoldingRangeOptions -> Maybe ExecuteCommandOptions -> Maybe WorkspaceOptions -> Maybe Value -> InitializeResponseCapabilitiesInner
+ Language.Haskell.LSP.Types: InitializeResponseCapabilitiesInner :: Maybe TDS -> Maybe Bool -> Maybe CompletionOptions -> Maybe SignatureHelpOptions -> Maybe Bool -> Maybe GotoOptions -> Maybe GotoOptions -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe CodeActionOptions -> Maybe CodeLensOptions -> Maybe Bool -> Maybe Bool -> Maybe DocumentOnTypeFormattingOptions -> Maybe RenameOptions -> Maybe DocumentLinkOptions -> Maybe ColorOptions -> Maybe FoldingRangeOptions -> Maybe ExecuteCommandOptions -> Maybe WorkspaceOptions -> Maybe Value -> InitializeResponseCapabilitiesInner
- Language.Haskell.LSP.Types: [$sel:_code:Diagnostic] :: Diagnostic -> Maybe Text
+ Language.Haskell.LSP.Types: [$sel:_code:Diagnostic] :: Diagnostic -> Maybe NumberOrString
- Language.Haskell.LSP.Types: [$sel:_codeActionProvider:InitializeResponseCapabilitiesInner] :: InitializeResponseCapabilitiesInner -> Maybe Bool
+ Language.Haskell.LSP.Types: [$sel:_codeActionProvider:InitializeResponseCapabilitiesInner] :: InitializeResponseCapabilitiesInner -> Maybe CodeActionOptions
- Language.Haskell.LSP.Types: [$sel:_renameProvider:InitializeResponseCapabilitiesInner] :: InitializeResponseCapabilitiesInner -> Maybe Bool
+ Language.Haskell.LSP.Types: [$sel:_renameProvider:InitializeResponseCapabilitiesInner] :: InitializeResponseCapabilitiesInner -> Maybe RenameOptions
- Language.Haskell.LSP.Types: type ShutdownRequest = RequestMessage ClientMethod (Maybe Value) Text
+ Language.Haskell.LSP.Types: type ShutdownRequest = RequestMessage ClientMethod (Maybe Value) (Maybe ())
- Language.Haskell.LSP.Types: type ShutdownResponse = ResponseMessage Text
+ Language.Haskell.LSP.Types: type ShutdownResponse = ResponseMessage (Maybe ())
- Language.Haskell.LSP.Types.Capabilities: RenameClientCapabilities :: Maybe Bool -> RenameClientCapabilities
+ Language.Haskell.LSP.Types.Capabilities: RenameClientCapabilities :: Maybe Bool -> Maybe Bool -> RenameClientCapabilities
Files
- ChangeLog.md +4/−0
- haskell-lsp-types.cabal +2/−2
- src/Language/Haskell/LSP/Types/Capabilities.hs +4/−1
- src/Language/Haskell/LSP/Types/ClientCapabilities.hs +8/−0
- src/Language/Haskell/LSP/Types/CodeAction.hs +1/−1
- src/Language/Haskell/LSP/Types/DataTypesJSON.hs +103/−6
- src/Language/Haskell/LSP/Types/Diagnostic.hs +11/−1
- src/Language/Haskell/LSP/Types/Message.hs +3/−0
- src/Language/Haskell/LSP/Types/MessageFuncs.hs +4/−0
ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for haskell-lsp-types +## 0.15.0.1 -- 2019-09-07++* Relax base constraints for GHC 8.8+ ## 0.15.0.0 -- 2019-07-01 * Normalize URIs to avoid issues with percent encoding (@cocreature)
haskell-lsp-types.cabal view
@@ -1,5 +1,5 @@ name: haskell-lsp-types-version: 0.15.0.0+version: 0.15.0.1 synopsis: Haskell library for the Microsoft Language Server Protocol, data types description: An implementation of the types to allow language implementors to@@ -45,7 +45,7 @@ -- other-extensions: ghc-options: -Wall -- ghc-options: -Werror- build-depends: base >=4.9 && <4.13+ build-depends: base >= 4.9 && < 4.14 , aeson >=1.2.2.0 , bytestring , data-default
src/Language/Haskell/LSP/Types/Capabilities.hs view
@@ -21,6 +21,9 @@ -- | Capabilities for full conformance to the LSP specification up until a version. -- Some important milestones: --+-- * 3.12 textDocument/prepareRename request+-- * 3.11 CodeActionOptions provided by the server+-- * 3.10 hierarchical document symbols, folding ranges -- * 3.9 completion item preselect -- * 3.8 codeAction literals -- * 3.7 related information in diagnostics@@ -99,7 +102,7 @@ (Just (CodeLensClientCapabilities dynamicReg)) (Just (DocumentLinkClientCapabilities dynamicReg)) (since 3 6 (ColorProviderClientCapabilities dynamicReg))- (Just (RenameClientCapabilities dynamicReg))+ (Just (RenameClientCapabilities dynamicReg (since 3 12 True))) (Just (PublishDiagnosticsClientCapabilities (since 3 7 True))) (since 3 10 foldingRangeCapability) sync =
src/Language/Haskell/LSP/Types/ClientCapabilities.hs view
@@ -564,6 +564,13 @@ * Whether rename supports dynamic registration. */ dynamicRegistration?: boolean;+ /**+ * The client supports testing for validity of rename operations+ * before execution.+ *+ * Since 3.12.0+ */+ prepareSupport?: boolean; }; /**@@ -896,6 +903,7 @@ data RenameClientCapabilities = RenameClientCapabilities { _dynamicRegistration :: Maybe Bool+ , _prepareSupport :: Maybe Bool } deriving (Show, Read, Eq) $(deriveJSON lspOptions ''RenameClientCapabilities)
src/Language/Haskell/LSP/Types/CodeAction.hs view
@@ -23,7 +23,7 @@ https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#code-action-request -The code action request is sent from the client to the server tocompute commands+The code action request is sent from the client to the server to compute commands for a given text document and range. These commands are typically code fixes to either fix problems or to beautify/refactor code. The result of a textDocument/codeAction request is an array of Command literals which are
src/Language/Haskell/LSP/Types/DataTypesJSON.hs view
@@ -18,6 +18,7 @@ import Data.Text (Text) import qualified Data.Text as T import Language.Haskell.LSP.Types.ClientCapabilities+import Language.Haskell.LSP.Types.CodeAction import Language.Haskell.LSP.Types.Command import Language.Haskell.LSP.Types.Constants import Language.Haskell.LSP.Types.Diagnostic@@ -262,6 +263,30 @@ -- --------------------------------------------------------------------- {- /**+ * Code Action options.+ */+export interface CodeActionOptions {+ /**+ * CodeActionKinds that this server may return.+ *+ * The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server+ * may list out every specific kind they provide.+ */+ codeActionKinds?: CodeActionKind[];+}+-}++data CodeActionOptions =+ CodeActionOptionsStatic Bool+ | CodeActionOptions+ { _codeActionKinds :: Maybe [CodeActionKind]+ } deriving (Read,Show,Eq)++deriveJSON (lspOptions { sumEncoding = A.UntaggedValue }) ''CodeActionOptions++-- ---------------------------------------------------------------------+{-+/** * Format document on type options */ interface DocumentOnTypeFormattingOptions {@@ -308,7 +333,32 @@ deriveJSON lspOptions ''DocumentLinkOptions -- ---------------------------------------------------------------------+{-+New in 3.12+---------- +/**+ * Rename options+ */+export interface RenameOptions {+ /**+ * Renames should be checked and tested before being executed.+ */+ prepareProvider?: boolean;+}+-}++data RenameOptions =+ RenameOptionsStatic Bool+ | RenameOptions+ { -- |Renames should be checked and tested before being executed.+ _prepareProvider :: Maybe Bool+ } deriving (Show, Read, Eq)++deriveJSON lspOptions { sumEncoding = A.UntaggedValue } ''RenameOptions++-- ---------------------------------------------------------------------+ {- New in 3.0 -----------@@ -463,9 +513,11 @@ */ workspaceSymbolProvider?: boolean; /**- * The server provides code actions.+ * The server provides code actions. The `CodeActionOptions` return type is only+ * valid if the client signals code action literal support via the property+ * `textDocument.codeAction.codeActionLiteralSupport`. */- codeActionProvider?: boolean;+ codeActionProvider?: boolean | CodeActionOptions; /** * The server provides code lens. */@@ -662,7 +714,7 @@ -- | The server provides workspace symbol support. , _workspaceSymbolProvider :: Maybe Bool -- | The server provides code actions.- , _codeActionProvider :: Maybe Bool+ , _codeActionProvider :: Maybe CodeActionOptions -- | The server provides code lens. , _codeLensProvider :: Maybe CodeLensOptions -- | The server provides document formatting.@@ -672,7 +724,7 @@ -- | The server provides document formatting on typing. , _documentOnTypeFormattingProvider :: Maybe DocumentOnTypeFormattingOptions -- | The server provides rename support.- , _renameProvider :: Maybe Bool+ , _renameProvider :: Maybe RenameOptions -- | The server provides document link support. , _documentLinkProvider :: Maybe DocumentLinkOptions -- | The server provides color provider support. Since LSP 3.6@@ -794,8 +846,8 @@ -} -type ShutdownRequest = RequestMessage ClientMethod (Maybe A.Value) Text-type ShutdownResponse = ResponseMessage Text+type ShutdownRequest = RequestMessage ClientMethod (Maybe A.Value) (Maybe ())+type ShutdownResponse = ResponseMessage (Maybe ()) -- --------------------------------------------------------------------- {-@@ -2585,6 +2637,51 @@ type RenameRequest = RequestMessage ClientMethod RenameParams WorkspaceEdit type RenameResponse = ResponseMessage WorkspaceEdit++-- ---------------------------------------------------------------------+{-+Prepare Rename Request++Since version 3.12.0++The prepare rename request is sent from the client to the server to setup+and test the validity of a rename operation at a given location.++Request:++ method: ‘textDocument/prepareRename’+ params: TextDocumentPositionParams++Response:++ result: Range | { range: Range, placeholder: string } | null describing+ the range of the string to rename and optionally a placeholder+ text of the string content to be renamed. If null is returned+ then it is deemed that a ‘textDocument/rename’ request is not+ valid at the given position.+ error: code and message set in case an exception happens during the+ prepare rename request.++-}++-- {\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"textDocument/rename\",\"params\":{\"textDocument\":{\"uri\":\"file:///home/alanz/mysrc/github/alanz/haskell-lsp/src/HieVscode.hs\"},\"position\":{\"line\":37,\"character\":17},\"newName\":\"getArgs'\"}}++data RangeWithPlaceholder =+ RangeWithPlaceholder+ {+ _range :: Range+ , _placeholder :: Text+ }++deriveJSON lspOptions { sumEncoding = A.UntaggedValue } ''RangeWithPlaceholder++data RangeOrRangeWithPlaceholder = RangeWithPlaceholderValue RangeWithPlaceholder+ | RangeValue Range++deriveJSON lspOptions { sumEncoding = A.UntaggedValue } ''RangeOrRangeWithPlaceholder++type PrepareRenameRequest = RequestMessage ClientMethod TextDocumentPositionParams Range+type PrepareRenameResponse = ResponseMessage (Maybe RangeOrRangeWithPlaceholder) -- --------------------------------------------------------------------- {-
src/Language/Haskell/LSP/Types/Diagnostic.hs view
@@ -7,6 +7,7 @@ import Control.DeepSeq import qualified Data.Aeson as A import Data.Aeson.TH+import Data.Scientific import Data.Text import GHC.Generics import Language.Haskell.LSP.Types.Constants@@ -132,12 +133,21 @@ } -} +data NumberOrString =+ NumberValue Scientific+ | StringValue Text+ deriving (Show, Read, Eq, Ord, Generic)++instance NFData NumberOrString++deriveJSON lspOptions { sumEncoding = A.UntaggedValue } ''NumberOrString+ type DiagnosticSource = Text data Diagnostic = Diagnostic { _range :: Range , _severity :: Maybe DiagnosticSeverity- , _code :: Maybe Text -- Note: Protocol allows Int too.+ , _code :: Maybe NumberOrString , _source :: Maybe DiagnosticSource , _message :: Text , _relatedInformation :: Maybe (List DiagnosticRelatedInformation)
src/Language/Haskell/LSP/Types/Message.hs view
@@ -112,6 +112,7 @@ | TextDocumentRangeFormatting | TextDocumentOnTypeFormatting | TextDocumentRename+ | TextDocumentPrepareRename | TextDocumentFoldingRange -- A custom message type. It is not enforced that this starts with $/. | CustomClientMethod Text@@ -158,6 +159,7 @@ parseJSON (A.String "textDocument/rangeFormatting") = return TextDocumentRangeFormatting parseJSON (A.String "textDocument/onTypeFormatting") = return TextDocumentOnTypeFormatting parseJSON (A.String "textDocument/rename") = return TextDocumentRename+ parseJSON (A.String "textDocument/prepareRename") = return TextDocumentPrepareRename parseJSON (A.String "textDocument/foldingRange") = return TextDocumentFoldingRange parseJSON (A.String "window/progress/cancel") = return WindowProgressCancel parseJSON (A.String x) = return (CustomClientMethod x)@@ -202,6 +204,7 @@ toJSON TextDocumentRangeFormatting = A.String "textDocument/rangeFormatting" toJSON TextDocumentOnTypeFormatting = A.String "textDocument/onTypeFormatting" toJSON TextDocumentRename = A.String "textDocument/rename"+ toJSON TextDocumentPrepareRename = A.String "textDocument/prepareRename" toJSON TextDocumentFoldingRange = A.String "textDocument/foldingRange" toJSON TextDocumentDocumentLink = A.String "textDocument/documentLink" toJSON DocumentLinkResolve = A.String "documentLink/resolve"
src/Language/Haskell/LSP/Types/MessageFuncs.hs view
@@ -329,3 +329,7 @@ fmClientRenameRequest rid params = J.RequestMessage "2.0" rid J.TextDocumentRename params +-- * :leftwards_arrow_with_hook: [textDocument/prepareRename](#textDocument_prepareRename)+fmClientPrepareRenameRequest :: J.LspId -> J.TextDocumentPositionParams -> J.PrepareRenameRequest+fmClientPrepareRenameRequest rid params+ = J.RequestMessage "2.0" rid J.TextDocumentPrepareRename params