Update version of lsp
authorLuke Lau <luke_lau@icloud.com>
Wed, 14 Oct 2020 15:30:04 +0000 (16:30 +0100)
committerLuke Lau <luke_lau@icloud.com>
Wed, 14 Oct 2020 15:30:04 +0000 (16:30 +0100)
cabal.project
lsp-test.cabal
src/Language/LSP/Test.hs
test/dummy-server/Main.hs

index b41d336dfdf10bbe3d86b8336ef285d207f5ae4e..07e67eee28ef1c7460451b099cd7c81a80b24cef 100644 (file)
@@ -7,6 +7,6 @@ haddock-quickjump: True
 source-repository-package
     type: git
     location: https://github.com/alanz/lsp.git
-    tag: ba6a7409f830be09f815489265a76499d7b7debb
+    tag: 7577be56392862abe880e0099ea9834a1012a34f
     subdir: .
             lsp-types
index 0f32eb365a9de4d0a1c0450aa86b8f36bc64b1be..e2b0708840e5a7111021b90a3deb914f62be742d 100644 (file)
@@ -83,7 +83,6 @@ executable dummy-server
   ghc-options:         -W
   build-depends:       base >= 4.10 && < 5
                      , lsp == 1.0.*
-                     , data-default
                      , aeson
                      , unordered-containers
                      , directory
index 4447373b78955e5fb4b1d6c196f4af4622297d7e..9d7c020c1bc487344468067d6dce581310389855 100644 (file)
@@ -366,7 +366,7 @@ sendNotification method params =
     IsClientEither -> sendMessage (NotMess $ NotificationMessage "2.0" method params)
 
 -- | Sends a response to the server.
-sendResponse :: ToJSON (ResponseParams m) => ResponseMessage m -> Session ()
+sendResponse :: ToJSON (ResponseResult m) => ResponseMessage m -> Session ()
 sendResponse = sendMessage
 
 -- | Returns the initialize response that was received from the server.
@@ -642,7 +642,7 @@ getImplementations :: TextDocumentIdentifier -- ^ The document the term is in.
 getImplementations = getDeclarationyRequest STextDocumentImplementation ImplementationParams
 
 
-getDeclarationyRequest :: (ResponseParams m ~ (Location |? (List Location |? List LocationLink)))
+getDeclarationyRequest :: (ResponseResult m ~ (Location |? (List Location |? List LocationLink)))
                        => SClientMethod m
                        -> (TextDocumentIdentifier
                             -> Position
@@ -683,7 +683,7 @@ getHighlights doc pos =
 
 -- | Checks the response for errors and throws an exception if needed.
 -- Returns the result if successful.
-getResponseResult :: ResponseMessage m -> ResponseParams m
+getResponseResult :: ResponseMessage m -> ResponseResult m
 getResponseResult rsp =
   case rsp ^. result of
     Right x -> x
index 95b98c9576c8163cbda8d60c2eed164a2a445892..1af140ef5ad0fe7a78f9e1182b8e2a864800dfef 100644 (file)
@@ -3,12 +3,10 @@
 
 import Control.Monad
 import Control.Monad.Reader
-import Data.Aeson
-import Data.Default
+import Data.Aeson hiding (defaultOptions)
 import qualified Data.HashMap.Strict as HM
 import Data.List (isSuffixOf)
-import Language.LSP.Control
-import Language.LSP.Core
+import Language.LSP.Server
 import Language.LSP.Types
 import System.Directory
 import System.FilePath
@@ -17,18 +15,16 @@ import UnliftIO.Concurrent
 
 main = do
   handlerEnv <- HandlerEnv <$> newEmptyMVar <*> newEmptyMVar
-  let initCbs =
-        InitializeCallbacks
+  runServer $ ServerDefinition
     { doInitialize = \env _req -> pure $ Right env,
       onConfigurationChange = const $ pure $ Right (),
       staticHandlers = handlers,
       interpretHandler = \env ->
         Iso
           (\m -> runLspT env (runReaderT m handlerEnv))
-                liftIO
+          liftIO,
+      options = defaultOptions {executeCommandCommands = Just ["doAnEdit"]}
     }
-      options = def {executeCommandCommands = Just ["doAnEdit"]}
-  run initCbs options
 
 data HandlerEnv = HandlerEnv
   { relRegToken :: MVar (RegistrationToken WorkspaceDidChangeWatchedFiles),