From: Luke Lau Date: Sat, 4 Aug 2018 22:23:23 +0000 (+0100) Subject: Remove capabilites since haskell-lsp now provides it X-Git-Url: http://git.lukelau.me/?p=opengl.git;a=commitdiff_plain;h=eb0bcf9d96d80c05eab5e8bf01e376bfb5df85d8 Remove capabilites since haskell-lsp now provides it --- diff --git a/lsp-test.cabal b/lsp-test.cabal index 4a23da9..fc20dc7 100644 --- a/lsp-test.cabal +++ b/lsp-test.cabal @@ -40,7 +40,7 @@ library , parser-combinators:Control.Applicative.Combinators default-language: Haskell2010 build-depends: base >= 4.7 && < 5 - , haskell-lsp >= 0.4 + , haskell-lsp >= 0.5 , aeson , aeson-pretty , ansi-terminal @@ -64,8 +64,7 @@ library build-depends: Win32 else build-depends: unix - other-modules: Language.Haskell.LSP.Test.Capabilities - Language.Haskell.LSP.Test.Compat + other-modules: Language.Haskell.LSP.Test.Compat Language.Haskell.LSP.Test.Decoding Language.Haskell.LSP.Test.Exceptions Language.Haskell.LSP.Test.Files @@ -84,7 +83,7 @@ test-suite tests , hspec , lens , data-default - , haskell-lsp >= 0.4 + , haskell-lsp >= 0.5 , lsp-test , aeson , unordered-containers diff --git a/src/Language/Haskell/LSP/Test.hs b/src/Language/Haskell/LSP/Test.hs index ed60e58..137cbb7 100644 --- a/src/Language/Haskell/LSP/Test.hs +++ b/src/Language/Haskell/LSP/Test.hs @@ -23,7 +23,7 @@ module Language.Haskell.LSP.Test , runSessionWithConfig , SessionConfig(..) , defaultConfig - , module Language.Haskell.LSP.Test.Capabilities + , module Language.Haskell.LSP.Types.Capabilities -- ** Exceptions , module Language.Haskell.LSP.Test.Exceptions , withTimeout @@ -91,10 +91,9 @@ import qualified Data.Map as Map import Data.Maybe import Language.Haskell.LSP.Types hiding (id, capabilities, message) import qualified Language.Haskell.LSP.Types as LSP -import qualified Language.Haskell.LSP.Types.Capabilities as LSP +import Language.Haskell.LSP.Types.Capabilities import Language.Haskell.LSP.Messages import Language.Haskell.LSP.VFS -import Language.Haskell.LSP.Test.Capabilities import Language.Haskell.LSP.Test.Compat import Language.Haskell.LSP.Test.Decoding import Language.Haskell.LSP.Test.Exceptions @@ -115,7 +114,7 @@ import qualified Yi.Rope as Rope -- > params = TextDocumentPositionParams doc -- > hover <- request TextDocumentHover params runSession :: String -- ^ The command to run the server. - -> LSP.ClientCapabilities -- ^ The capabilities that the client should declare. + -> ClientCapabilities -- ^ The capabilities that the client should declare. -> FilePath -- ^ The filepath to the root directory for the session. -> Session a -- ^ The session to run. -> IO a @@ -124,7 +123,7 @@ runSession = runSessionWithConfig def -- | Starts a new sesion with a custom configuration. runSessionWithConfig :: SessionConfig -- ^ Configuration options for the session. -> String -- ^ The command to run the server. - -> LSP.ClientCapabilities -- ^ The capabilities that the client should declare. + -> ClientCapabilities -- ^ The capabilities that the client should declare. -> FilePath -- ^ The filepath to the root directory for the session. -> Session a -- ^ The session to run. -> IO a @@ -419,9 +418,9 @@ applyEdit doc edit = do caps <- asks sessionCapabilities let supportsDocChanges = fromMaybe False $ do - let LSP.ClientCapabilities mWorkspace _ _ = caps - LSP.WorkspaceClientCapabilities _ mEdit _ _ _ _ <- mWorkspace - LSP.WorkspaceEditClientCapabilities mDocChanges <- mEdit + let ClientCapabilities mWorkspace _ _ = caps + WorkspaceClientCapabilities _ mEdit _ _ _ _ _ _ <- mWorkspace + WorkspaceEditClientCapabilities mDocChanges <- mEdit mDocChanges let wEdit = if supportsDocChanges diff --git a/src/Language/Haskell/LSP/Test/Capabilities.hs b/src/Language/Haskell/LSP/Test/Capabilities.hs deleted file mode 100644 index 2fd3a99..0000000 --- a/src/Language/Haskell/LSP/Test/Capabilities.hs +++ /dev/null @@ -1,69 +0,0 @@ --- TODO: Move this into haskell-lsp -module Language.Haskell.LSP.Test.Capabilities where -import Language.Haskell.LSP.Types -import Language.Haskell.LSP.Types.Capabilities - --- | The whole shebang. The real deal. --- Capabilities for full conformance to the current (v3.10) LSP specification. -fullCaps :: ClientCapabilities -fullCaps = capsForVersion (LSPVersion maxBound maxBound) - --- | A specific version of the LSP specification. -data LSPVersion = LSPVersion Int Int -- ^ Construct a major.minor version - --- | Capabilities for full conformance to the LSP specification up until a version. --- Some important milestones: --- --- * 3.8 codeAction literals --- * 3.0 dynamic registration -capsForVersion :: LSPVersion -> ClientCapabilities -capsForVersion (LSPVersion maj min) = ClientCapabilities (Just w) (Just td) Nothing - where - w = WorkspaceClientCapabilities - (Just True) - (Just (WorkspaceEditClientCapabilities (Just True))) - (Just (DidChangeConfigurationClientCapabilities dynamicReg)) - (Just (DidChangeWatchedFilesClientCapabilities dynamicReg)) - (Just (SymbolClientCapabilities dynamicReg)) - (Just (ExecuteClientCapabilities dynamicReg)) - td = TextDocumentClientCapabilities - (Just sync) - (Just (CompletionClientCapabilities - dynamicReg - (Just (CompletionItemClientCapabilities (Just True))))) - (Just (HoverClientCapabilities dynamicReg)) - (Just (SignatureHelpClientCapabilities dynamicReg)) - (Just (ReferencesClientCapabilities dynamicReg)) - (Just (DocumentHighlightClientCapabilities dynamicReg)) - (Just (DocumentSymbolClientCapabilities dynamicReg)) - (Just (FormattingClientCapabilities (Just True))) - (Just (RangeFormattingClientCapabilities dynamicReg)) - (Just (OnTypeFormattingClientCapabilities dynamicReg)) - (Just (DefinitionClientCapabilities dynamicReg)) - (Just codeAction) - (Just (CodeLensClientCapabilities dynamicReg)) - (Just (DocumentLinkClientCapabilities dynamicReg)) - (Just (RenameClientCapabilities dynamicReg)) - sync = SynchronizationTextDocumentClientCapabilities - dynamicReg - (Just True) - (Just True) - (Just True) - codeAction = CodeActionClientCapabilities - dynamicReg - codeActionLiterals - codeActionLiterals - | maj >= 3 && min >= 8 = Just (CodeActionLiteralSupport kinds) - | otherwise = Nothing - kinds = CodeActionKindValueSet - (List [ CodeActionQuickFix - , CodeActionRefactor - , CodeActionRefactorExtract - , CodeActionRefactorInline - , CodeActionRefactorRewrite - , CodeActionSource - , CodeActionSourceOrganizeImports - ]) - dynamicReg - | maj >= 3 = Just True - | otherwise = Nothing diff --git a/stack.yaml b/stack.yaml index a81dc68..35cbc75 100644 --- a/stack.yaml +++ b/stack.yaml @@ -3,5 +3,5 @@ packages: - . extra-deps: - - haskell-lsp-0.4.0.0 - - haskell-lsp-types-0.4.0.0 + - haskell-lsp-0.5.0.0 + - haskell-lsp-types-0.5.0.0