@@ -12,8 +12,8 @@ module Language.LSP.Server.Control (
1212import Colog.Core (LogAction (.. ), Severity (.. ), WithSeverity (.. ), (<&) )
1313import Colog.Core qualified as L
1414import Control.Applicative ((<|>) )
15- import Control.Concurrent.Async (withAsync , wait , cancel , race )
1615import Control.Concurrent (threadDelay )
16+ import Control.Concurrent.Async (cancel , race , wait , withAsync )
1717import Control.Concurrent.STM.TChan
1818import Control.Exception (catchJust , throwIO )
1919import Control.Monad.IO.Class
@@ -157,7 +157,7 @@ runServerWith ioLogger logger clientIn clientOut serverDefinition = do
157157 -- Wait up to 3 seconds for the sender to finish; cancel if it doesn't.
158158 r <- race (wait _sendAsync) (threadDelay 3_000_000 )
159159 case r of
160- Left _ -> pure ()
160+ Left _ -> pure ()
161161 Right _ -> ioLogger <& SenderShutdownTimeout `WithSeverity ` Warning
162162 ioLogger <& ServerStopped `WithSeverity ` Info
163163 return res
@@ -196,13 +196,15 @@ ioLoop ioLogger logger clientIn serverDefinition vfs sendMsg = do
196196 where
197197 go r = do
198198 b <- isExiting
199- if b then pure 0 else do
200- res <- parseOne logger clientIn r
201- case res of
202- Nothing -> pure 1
203- Just (msg, remainder) -> do
204- Processing. processMessage pLogger $ BSL. fromStrict msg
205- go (parse parser remainder)
199+ if b
200+ then pure 0
201+ else do
202+ res <- parseOne logger clientIn r
203+ case res of
204+ Nothing -> pure 1
205+ Just (msg, remainder) -> do
206+ Processing. processMessage pLogger $ BSL. fromStrict msg
207+ go (parse parser remainder)
206208
207209 parser = do
208210 try contentType <|> return ()
0 commit comments