X-Git-Url: http://git.lukelau.me/?p=lsp-test.git;a=blobdiff_plain;f=src%2FLanguage%2FHaskell%2FLSP%2FTest.hs;h=1b2e7ba867a6ebc4356b008e29a7c4ce53eee962;hp=016abc22cb6b6ea6fb898db0264e3ce4da9594ff;hb=f0a961503e19c2d281c3d6319df1096f5bf6cfcf;hpb=02c7c7c4e3783fef173f63b8f6421ced55285bff diff --git a/src/Language/Haskell/LSP/Test.hs b/src/Language/Haskell/LSP/Test.hs index 016abc2..1b2e7ba 100644 --- a/src/Language/Haskell/LSP/Test.hs +++ b/src/Language/Haskell/LSP/Test.hs @@ -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