-- You can send and receive messages to the server within 'Session' via 'getMessage',
-- 'sendRequest' and 'sendNotification'.
--
--- @
--- runSession \"path\/to\/root\/dir\" $ do
--- docItem <- getDocItem "Desktop/simple.hs" "haskell"
--- sendNotification TextDocumentDidOpen (DidOpenTextDocumentParams docItem)
--- diagnostics <- getMessage :: Session PublishDiagnosticsNotification
--- @
+
type Session = ParserStateReader FromServerMessage SessionState SessionContext IO
-- | Stuff you can configure for a 'Session'.
, logColor :: Bool -- ^ Add ANSI color to the logged messages, defaults to True.
}
+-- | The configuration used in 'Language.Haskell.LSP.Test.runSession'.
defaultConfig :: SessionConfig
defaultConfig = SessionConfig 60 False True True
}
return res
--- logClientMsg :: (MonadIO m, HasReader SessionContext m)
--- => FromClientMessage -> m ()
--- logClientMsg = logMsg True
-
--- logServerMsg :: (MonadIO m, HasReader SessionContext m)
--- => FromServerMessage -> m ()
--- logServerMsg = logMsg False
-
data LogMsgType = LogServer | LogClient
deriving Eq
| t == LogServer = Magenta
| otherwise = Cyan
-
-showPretty :: ToJSON a => a -> String
showPretty = B.unpack . encodePretty