File tree 3 files changed +11
-1
lines changed
lsp/src/Language/LSP/Server
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
33
33
import qualified Language.LSP.Server.IO as IO
34
34
import Language.LSP.Logging (defaultClientLogger )
35
35
import System.IO
36
+ import Debug.Trace (traceM )
37
+ import Control.Exception
36
38
37
39
data LspServerLog =
38
40
LspProcessingLog Processing. LspProcessingLog
@@ -140,4 +142,7 @@ runServerWith ioLogger logger clientIn clientOut serverDefinition = do
140
142
Async. withAsync processingLoop $ \ a3 ->
141
143
Async. waitAny [a1, a2, a3]
142
144
145
+ traceM " Threads killed, exiting"
143
146
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
14
14
import qualified Data.Text.Encoding as T
15
15
import Data.Text.Prettyprint.Doc
16
16
import Data.List
17
+ import Debug.Trace (traceM )
17
18
18
19
data LspIoLog =
19
20
HeaderParseFail [String ] String
@@ -57,6 +58,8 @@ serverIn logger msgOut clientIn = do
57
58
if BS. null bs
58
59
then do
59
60
logger <& EOF `WithSeverity ` Error
61
+
62
+ traceM " Exiting due to EOF"
60
63
pure ()
61
64
else loop (c bs)
62
65
loop (Done remainder parsed) = do
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ import Data.Default (def)
51
51
import Control.Monad.State
52
52
import Control.Monad.Writer.Strict
53
53
import Data.Foldable (traverse_ )
54
+ import Debug.Trace (traceM )
54
55
55
56
data LspProcessingLog =
56
57
VfsLog VfsLog
@@ -108,7 +109,8 @@ processingLoop ioLogger logger vfs serverDefinition sendMsg recvMsg = do
108
109
msg <- liftIO recvMsg
109
110
processMessage logger msg
110
111
`E.catch`
111
- (\ (_ :: RequestedShutdown ) -> pure () )
112
+ (\ (_ :: RequestedShutdown ) -> traceM " Exiting due to shutdown request" >> pure () )
113
+
112
114
113
115
processMessage :: (m ~ LspM config ) => LogAction m (WithSeverity LspProcessingLog ) -> Value -> m ()
114
116
processMessage logger val = do
You can’t perform that action at this time.
0 commit comments