@@ -83,7 +83,10 @@ func NewInoHandler(stdio io.ReadWriteCloser, board lsp.Board) *InoHandler {
83
83
handler .clangdStarted = sync .NewCond (& handler .dataMux )
84
84
stdStream := jsonrpc2 .NewBufferedStream (stdio , jsonrpc2.VSCodeObjectCodec {})
85
85
var stdHandler jsonrpc2.Handler = jsonrpc2 .HandlerWithError (handler .HandleMessageFromIDE )
86
- handler .StdioConn = jsonrpc2 .NewConn (context .Background (), stdStream , stdHandler )
86
+ handler .StdioConn = jsonrpc2 .NewConn (context .Background (), stdStream , stdHandler ,
87
+ jsonrpc2 .OnRecv (streams .JSONRPCConnLogOnRecv ("IDE --> LS CL:" )),
88
+ jsonrpc2 .OnSend (streams .JSONRPCConnLogOnSend ("IDE <-- LS CL:" )),
89
+ )
87
90
88
91
handler .progressHandler = NewProgressProxy (handler .StdioConn )
89
92
@@ -176,6 +179,8 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr
176
179
// method "initialize"
177
180
178
181
go func () {
182
+ defer streams .CatchAndLogPanic ()
183
+
179
184
// Start clangd asynchronously
180
185
log .Printf ("LS --- initializing workbench (queued)" )
181
186
handler .dataMux .Lock ()
@@ -514,7 +519,9 @@ func (handler *InoHandler) initializeWorkbench(ctx context.Context, params *lsp.
514
519
515
520
clangdStream := jsonrpc2 .NewBufferedStream (clangdStdio , jsonrpc2.VSCodeObjectCodec {})
516
521
clangdHandler := AsyncHandler {jsonrpc2 .HandlerWithError (handler .FromClangd )}
517
- handler .ClangdConn = jsonrpc2 .NewConn (context .Background (), clangdStream , clangdHandler )
522
+ handler .ClangdConn = jsonrpc2 .NewConn (context .Background (), clangdStream , clangdHandler ,
523
+ jsonrpc2 .OnRecv (streams .JSONRPCConnLogOnRecv ("IDE LS <-- CL:" )),
524
+ jsonrpc2 .OnSend (streams .JSONRPCConnLogOnSend ("IDE LS --> CL:" )))
518
525
519
526
// Send initialization command to clangd
520
527
ctx , cancel := context .WithTimeout (context .Background (), time .Second )
@@ -1087,12 +1094,15 @@ func (handler *InoHandler) transformClangdResult(method string, inoURI, cppURI l
1087
1094
1088
1095
if r .DocumentSymbolArray != nil {
1089
1096
// Treat the input as []DocumentSymbol
1097
+ log .Printf (" <-- documentSymbol(%d document symbols)" , len (* r .DocumentSymbolArray ))
1090
1098
return handler .cpp2inoDocumentSymbols (* r .DocumentSymbolArray , inoURI )
1091
1099
} else if r .SymbolInformationArray != nil {
1092
1100
// Treat the input as []SymbolInformation
1101
+ log .Printf (" <-- documentSymbol(%d symbol information)" , len (* r .SymbolInformationArray ))
1093
1102
return handler .cpp2inoSymbolInformation (* r .SymbolInformationArray )
1094
1103
} else {
1095
1104
// Treat the input as null
1105
+ log .Printf (" <-- null documentSymbol" )
1096
1106
}
1097
1107
1098
1108
case * []lsp.CommandOrCodeAction :
0 commit comments