X-Git-Url: http://git.lukelau.me/?p=lsp-test.git;a=blobdiff_plain;f=src%2FLanguage%2FHaskell%2FLSP%2FTest%2FReplay.hs;h=6c049d0b56272fd9ff7ff7992ef02370cccdbaa7;hp=73151d75cd8711a0107c65cadff95483014d1d5a;hb=d7593d08be8201ef453c53a2205f4aa4a893df4c;hpb=cdb1ba7038c32bac71a3bc783effc1e07049a985 diff --git a/src/Language/Haskell/LSP/Test/Replay.hs b/src/Language/Haskell/LSP/Test/Replay.hs index 73151d7..6c049d0 100644 --- a/src/Language/Haskell/LSP/Test/Replay.hs +++ b/src/Language/Haskell/LSP/Test/Replay.hs @@ -84,12 +84,12 @@ sendMessages (nextMsg:remainingMsgs) reqSema rspSema = notification msg@(NotificationMessage _ Exit _) = do liftIO $ putStrLn "Will send exit notification soon" liftIO $ threadDelay 10000000 - sendNotification' msg + sendMessage msg liftIO $ error "Done" notification msg@(NotificationMessage _ m _) = do - sendNotification' msg + sendMessage msg liftIO $ putStrLn $ "Sent a notification " ++ show m @@ -116,6 +116,15 @@ sendMessages (nextMsg:remainingMsgs) reqSema rspSema = sendMessages remainingMsgs reqSema rspSema +sendRequestMessage :: (ToJSON a, ToJSON b) => RequestMessage ClientMethod a b -> Session () +sendRequestMessage req = do + -- Update the request map + reqMap <- requestMap <$> ask + liftIO $ modifyMVar_ reqMap $ + \r -> return $ updateRequestMap r (req ^. LSP.id) (req ^. method) + + sendMessage req + isNotification :: FromServerMessage -> Bool isNotification (NotPublishDiagnostics _) = True