projects
/
opengl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3581d88
)
Log session messages, don't know why it was ever a good idea to hide them 💩
author
Luke Lau
<luke_lau@icloud.com>
Fri, 29 Jun 2018 00:40:57 +0000
(
01:40
+0100)
committer
Luke Lau
<luke_lau@icloud.com>
Fri, 29 Jun 2018 00:40:57 +0000
(
01:40
+0100)
haskell-lsp-test.cabal
patch
|
blob
|
history
src/Language/Haskell/LSP/Test.hs
patch
|
blob
|
history
src/Language/Haskell/LSP/Test/Messages.hs
patch
|
blob
|
history
src/Language/Haskell/LSP/Test/Parsing.hs
patch
|
blob
|
history
diff --git
a/haskell-lsp-test.cabal
b/haskell-lsp-test.cabal
index 510b7583a128835fcf04903b017846ff24f8a697..4683c6061f13b1adb655110eef92cef2fcd959d4 100644
(file)
--- a/
haskell-lsp-test.cabal
+++ b/
haskell-lsp-test.cabal
@@
-22,6
+22,7
@@
library
, haskell-lsp-types
, haskell-lsp >= 0.3
, aeson
, haskell-lsp-types
, haskell-lsp >= 0.3
, aeson
+ , ansi-terminal
, async
, bytestring
, conduit
, async
, bytestring
, conduit
diff --git
a/src/Language/Haskell/LSP/Test.hs
b/src/Language/Haskell/LSP/Test.hs
index 1ce6871fb211f3a66e75f7ac95d65bbb979a4085..0e8f5bfcaa92259f253defa2d89bbb40610c1e66 100644
(file)
--- a/
src/Language/Haskell/LSP/Test.hs
+++ b/
src/Language/Haskell/LSP/Test.hs
@@
-93,6
+93,7
@@
import Language.Haskell.LSP.Test.Exceptions
import Language.Haskell.LSP.Test.Parsing
import Language.Haskell.LSP.Test.Session
import Language.Haskell.LSP.Test.Server
import Language.Haskell.LSP.Test.Parsing
import Language.Haskell.LSP.Test.Session
import Language.Haskell.LSP.Test.Server
+import System.Console.ANSI
import System.IO
import System.Directory
import System.FilePath
import System.IO
import System.Directory
import System.FilePath
@@
-273,7
+274,16
@@
sendResponse = sendMessage
sendMessage :: ToJSON a => a -> Session ()
sendMessage msg = do
h <- serverIn <$> ask
sendMessage :: ToJSON a => a -> Session ()
sendMessage msg = do
h <- serverIn <$> ask
- liftIO $ B.hPut h $ addHeader (encode msg)
+ let encoded = encode msg
+ liftIO $ do
+
+ setSGR [SetColor Foreground Vivid Cyan]
+ putStrLn $ "--> " ++ B.unpack encoded
+ setSGR [Reset]
+
+ B.hPut h (addHeader encoded)
+
+
-- | Returns the initialize response that was received from the server.
-- The initialize requests and responses are not included the session,
-- | Returns the initialize response that was received from the server.
-- The initialize requests and responses are not included the session,
diff --git
a/src/Language/Haskell/LSP/Test/Messages.hs
b/src/Language/Haskell/LSP/Test/Messages.hs
index fdc2e958bafc45eae1e02deceba80ba4e03657b4..db5e4433b582dde899d7b0ae908eb1fa52b4a850 100644
(file)
--- a/
src/Language/Haskell/LSP/Test/Messages.hs
+++ b/
src/Language/Haskell/LSP/Test/Messages.hs
@@
-17,8
+17,9
@@
import Language.Haskell.LSP.Types hiding (error)
import Language.Haskell.LSP.Test.Exceptions
import Language.Haskell.LSP.Test.Messages
import Language.Haskell.LSP.Test.Session
import Language.Haskell.LSP.Test.Exceptions
import Language.Haskell.LSP.Test.Messages
import Language.Haskell.LSP.Test.Session
+import System.Console.ANSI
-satisfy :: (MonadIO m, MonadSessionConfig m) => (
a -> Bool) -> ConduitParser a m a
+satisfy :: (MonadIO m, MonadSessionConfig m) => (
FromServerMessage -> Bool) -> ConduitParser FromServerMessage m FromServerMessage
satisfy pred = do
timeout <- timeout <$> lift sessionConfig
tId <- liftIO myThreadId
satisfy pred = do
timeout <- timeout <$> lift sessionConfig
tId <- liftIO myThreadId
@@
-27,6
+28,12
@@
satisfy pred = do
throwTo tId TimeoutException
x <- await
liftIO $ killThread timeoutThread
throwTo tId TimeoutException
x <- await
liftIO $ killThread timeoutThread
+
+ liftIO $ do
+ setSGR [SetColor Foreground Vivid Magenta]
+ putStrLn $ "<-- " ++ B.unpack (encodeMsg x)
+ setSGR [Reset]
+
if pred x
then return x
else empty
if pred x
then return x
else empty
diff --cc
src/Language/Haskell/LSP/Test/Parsing.hs
Simple merge