Remove capabilites since haskell-lsp now provides it
authorLuke Lau <luke_lau@icloud.com>
Sat, 4 Aug 2018 22:23:23 +0000 (23:23 +0100)
committerLuke Lau <luke_lau@icloud.com>
Sat, 4 Aug 2018 22:23:23 +0000 (23:23 +0100)
lsp-test.cabal
src/Language/Haskell/LSP/Test.hs
src/Language/Haskell/LSP/Test/Capabilities.hs [deleted file]
stack.yaml

index 4a23da94e6311e8d85ca619829695d6d0c7917ae..fc20dc7b07f1cd33ad6c7cb2af46adb92439b312 100644 (file)
@@ -40,7 +40,7 @@ library
                      , parser-combinators:Control.Applicative.Combinators
   default-language:    Haskell2010
   build-depends:       base >= 4.7 && < 5
                      , 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
                      , aeson
                      , aeson-pretty
                      , ansi-terminal
@@ -64,8 +64,7 @@ library
     build-depends:     Win32
   else
     build-depends:     unix
     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
                        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
                      , hspec
                      , lens
                      , data-default
-                     , haskell-lsp >= 0.4
+                     , haskell-lsp >= 0.5
                      , lsp-test
                      , aeson
                      , unordered-containers
                      , lsp-test
                      , aeson
                      , unordered-containers
index ed60e585822a9c51da7b4a63e35252b2d2179f3b..137cbb7a329e93761f6eb792f9043954d145437d 100644 (file)
@@ -23,7 +23,7 @@ module Language.Haskell.LSP.Test
   , runSessionWithConfig
   , SessionConfig(..)
   , defaultConfig
   , runSessionWithConfig
   , SessionConfig(..)
   , defaultConfig
-  , module Language.Haskell.LSP.Test.Capabilities
+  , module Language.Haskell.LSP.Types.Capabilities
   -- ** Exceptions
   , module Language.Haskell.LSP.Test.Exceptions
   , withTimeout
   -- ** 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 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.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
 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.
 -- >       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
            -> 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.
 -- | 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
                      -> 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
   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
         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 (file)
index 2fd3a99..0000000
+++ /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
index a81dc68004b36252774b3830527eaf797ceb46f5..35cbc75ae464a131ff50c5ec5033b08743ac5ee7 100644 (file)
@@ -3,5 +3,5 @@ packages:
   - .
 
 extra-deps:
   - .
 
 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