X-Git-Url: http://git.lukelau.me/?a=blobdiff_plain;f=src%2FLanguage%2FHaskell%2FLSP%2FTest.hs;h=c405f67fe990e254a7e1237d31753d661ffb9f10;hb=a8e8371de3168f0faae2f33eae0d97f466c4786f;hp=016abc22cb6b6ea6fb898db0264e3ce4da9594ff;hpb=1b1df64886e90bb77c2804452945ff0d66963e0a;p=lsp-test.git diff --git a/src/Language/Haskell/LSP/Test.hs b/src/Language/Haskell/LSP/Test.hs index 016abc2..c405f67 100644 --- a/src/Language/Haskell/LSP/Test.hs +++ b/src/Language/Haskell/LSP/Test.hs @@ -8,7 +8,7 @@ Module : Language.Haskell.LSP.Test Description : A functional testing framework for LSP servers. Maintainer : luke_lau@icloud.com Stability : experimental -Portability : POSIX +Portability : non-portable Provides the framework to start functionally testing . @@ -37,9 +37,8 @@ module Language.Haskell.LSP.Test , module Language.Haskell.LSP.Test.Parsing -- * Utilities -- | Quick helper functions for common tasks. - -- ** Lifecycle + -- ** Initialization , initializeResponse - , exitServer -- ** Documents , openDoc , openDoc' @@ -138,7 +137,6 @@ runSessionWithConfig :: SessionConfig -- ^ Configuration options for the session -> Session a -- ^ The session to run. -> IO a runSessionWithConfig config serverExe caps rootDir session = do - pid <- getCurrentProcessID absRootDir <- canonicalizePath rootDir @@ -168,6 +166,10 @@ runSessionWithConfig config serverExe caps rootDir session = do result <- session return result where + -- | Asks the server to shutdown and exit politely + exitServer :: Session () + exitServer = request_ Shutdown (Nothing :: Maybe Value) >> sendNotification Exit ExitParams + -- | Listens to the server output until the shutdown ack, -- makes sure it matches the record and signals any semaphores listenServer :: Handle -> SessionContext -> IO () @@ -575,7 +577,3 @@ getCodeLenses tId = do rsp <- request TextDocumentCodeLens (CodeLensParams tId) :: Session CodeLensResponse case getResponseResult rsp of List res -> pure res - --- | Exit the server after request its shutdown -exitServer :: Session() -exitServer = request_ Shutdown (Nothing :: Maybe Value) >> sendNotification Exit ExitParams