X-Git-Url: http://git.lukelau.me/?p=opengl.git;a=blobdiff_plain;f=src%2FLanguage%2FHaskell%2FLSP%2FTest%2FSession.hs;h=641077c83ccaeca38d67990ac6cb056498d5e7fe;hp=0553160aee215862ebb4fbad547f087a9fcbaca6;hb=d8e460543b7cbc32550bed20d20ef4b13d6705a5;hpb=0da56e90a0fd4ada9acb01ca9ce769c5924653ec diff --git a/src/Language/Haskell/LSP/Test/Session.hs b/src/Language/Haskell/LSP/Test/Session.hs index 0553160..641077c 100644 --- a/src/Language/Haskell/LSP/Test/Session.hs +++ b/src/Language/Haskell/LSP/Test/Session.hs @@ -92,6 +92,7 @@ data SessionState = SessionState { curReqId :: LspId , vfs :: VFS + , curDiagnostics :: Map.Map Uri [Diagnostic] } type ParserStateReader a s r m = ConduitParser a (StateT s (ReaderT r m)) @@ -162,7 +163,7 @@ runSessionWithHandles serverIn serverOut serverHandler config rootDir session = initRsp <- newEmptyMVar let context = SessionContext serverIn absRootDir messageChan reqMap initRsp config - initState = SessionState (IdInt 0) mempty + initState = SessionState (IdInt 0) mempty mempty threadId <- forkIO $ void $ runSession meaninglessChan processor context initState (serverHandler serverOut) (result, _) <- runSession messageChan processor context initState session @@ -178,6 +179,13 @@ runSessionWithHandles serverIn serverOut serverHandler config rootDir session = processTextChanges :: FromServerMessage -> SessionProcessor () +processTextChanges (NotPublishDiagnostics n) = do + let List diags = n ^. params . diagnostics + doc = n ^. params . uri + lift $ State.modify (\s -> + let newDiags = Map.insert doc diags (curDiagnostics s) + in s { curDiagnostics = newDiags }) + processTextChanges (ReqApplyWorkspaceEdit r) = do allChangeParams <- case r ^. params . edit . documentChanges of