File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed
lsp/src/Language/LSP/Server Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ import Language.LSP.VFS
3333import qualified Language.LSP.Server.IO as IO
3434import Language.LSP.Logging (defaultClientLogger )
3535import System.IO
36+ import Debug.Trace (traceM )
37+ import Control.Exception
3638
3739data LspServerLog =
3840 LspProcessingLog Processing. LspProcessingLog
@@ -140,4 +142,7 @@ runServerWith ioLogger logger clientIn clientOut serverDefinition = do
140142 Async. withAsync processingLoop $ \ a3 ->
141143 Async. waitAny [a1, a2, a3]
142144
145+ traceM " Threads killed, exiting"
143146 ioLogger <& Stopping `WithSeverity ` Info
147+ `catch`
148+ \ (e :: SomeException ) -> traceM (" Dying due to escaping exception " ++ show e) >> throw e
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import qualified Data.Text as T
1414import qualified Data.Text.Encoding as T
1515import Data.Text.Prettyprint.Doc
1616import Data.List
17+ import Debug.Trace (traceM )
1718
1819data LspIoLog =
1920 HeaderParseFail [String ] String
@@ -57,6 +58,8 @@ serverIn logger msgOut clientIn = do
5758 if BS. null bs
5859 then do
5960 logger <& EOF `WithSeverity ` Error
61+
62+ traceM " Exiting due to EOF"
6063 pure ()
6164 else loop (c bs)
6265 loop (Done remainder parsed) = do
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ import Data.Default (def)
5151import Control.Monad.State
5252import Control.Monad.Writer.Strict
5353import Data.Foldable (traverse_ )
54+ import Debug.Trace (traceM )
5455
5556data LspProcessingLog =
5657 VfsLog VfsLog
@@ -108,7 +109,8 @@ processingLoop ioLogger logger vfs serverDefinition sendMsg recvMsg = do
108109 msg <- liftIO recvMsg
109110 processMessage logger msg
110111 `E.catch`
111- (\ (_ :: RequestedShutdown ) -> pure () )
112+ (\ (_ :: RequestedShutdown ) -> traceM " Exiting due to shutdown request" >> pure () )
113+
112114
113115processMessage :: (m ~ LspM config ) => LogAction m (WithSeverity LspProcessingLog ) -> Value -> m ()
114116processMessage logger val = do
You can’t perform that action at this time.
0 commit comments