def
(Just TraceOff)
- runSessionWithHandler listenServer rootDir $ do
+ runSessionWithHandler listenServer serverExe rootDir $ do
-- Wrap the session around initialize and shutdown calls
- sendRequest (Proxy :: Proxy InitializeRequest) Initialize initializeParams
- RspInitialize initRsp <- response
+ sendRequest Initialize initializeParams
+ initRsp <- response :: Session InitializeResponse
liftIO $ maybe (return ()) (putStrLn . ("Error while initializing: " ++) . show ) (initRsp ^. LSP.error)
sendNotification Initialized InitializedParams
rspSema <- newEmptyMVar
passVar <- newEmptyMVar :: IO (MVar Bool)
- forkIO $ runSessionWithHandler (listenServer serverMsgs requestMap reqSema rspSema passVar) serverExe sessionDir $
- sendMessages clientMsgs reqSema rspSema
+ threadId <- forkIO $
+ runSessionWithHandler (listenServer serverMsgs requestMap reqSema rspSema passVar)
++ serverExe
+ sessionDir
+ (sendMessages clientMsgs reqSema rspSema)
- takeMVar passVar
+ result <- takeMVar passVar
+ killThread threadId
+ return result
where
isClientMsg (FromClient _ _) = True
import ParsingTests
main = hspec $ do
- describe "manual session validation" $ do
+ describe "manual session" $ do
it "passes a test" $
- runSession "test/recordings/renamePass" $ do
+ runSession "hie" "test/recordings/renamePass" $ do
doc <- openDoc "Desktop/simple.hs" "haskell"
skipMany loggingNotification
it "fails a test" $
-- TODO: Catch the exception in haskell-lsp-test and provide nicer output
- let session = runSession "test/recordings/renamePass" $ do
+ let session = runSession "hie" "test/recordings/renamePass" $ do
openDoc "Desktop/simple.hs" "haskell"
skipMany loggingNotification
- request
+ anyRequest
in session `shouldThrow` anyException
describe "replay session" $ do