@@ -178,7 +178,7 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr
178
178
defer handler .dataMux .Unlock ()
179
179
180
180
log .Printf ("LS --- initializing workbench (running)" )
181
- handler .initializeWorkbench (p )
181
+ handler .initializeWorkbench (ctx , p )
182
182
183
183
// clangd should be running now...
184
184
handler .clangdStarted .Broadcast ()
@@ -410,8 +410,6 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr
410
410
err = handler .ClangdConn .Notify (ctx , req .Method , params )
411
411
} else {
412
412
log .Printf (prefix + "sent to Clang" )
413
- ctx , cancel := context .WithTimeout (ctx , 800 * time .Millisecond )
414
- defer cancel ()
415
413
result , err = lsp .SendRequest (ctx , handler .ClangdConn , req .Method , params )
416
414
}
417
415
if err == nil && handler .buildSketchSymbolsLoad {
@@ -450,7 +448,7 @@ func (handler *InoHandler) exit() {
450
448
os .Exit (1 )
451
449
}
452
450
453
- func (handler * InoHandler ) initializeWorkbench (params * lsp.InitializeParams ) error {
451
+ func (handler * InoHandler ) initializeWorkbench (ctx context. Context , params * lsp.InitializeParams ) error {
454
452
currCppTextVersion := 0
455
453
if params != nil {
456
454
log .Printf (" --> initialize(%s)\n " , params .RootURI )
@@ -495,8 +493,6 @@ func (handler *InoHandler) initializeWorkbench(params *lsp.InitializeParams) err
495
493
},
496
494
}
497
495
498
- ctx , cancel := context .WithTimeout (context .Background (), time .Second )
499
- defer cancel ()
500
496
if err := handler .ClangdConn .Notify (ctx , "textDocument/didChange" , syncEvent ); err != nil {
501
497
log .Println (" error reinitilizing clangd:" , err )
502
498
return err
@@ -513,7 +509,7 @@ func (handler *InoHandler) initializeWorkbench(params *lsp.InitializeParams) err
513
509
}
514
510
515
511
clangdStream := jsonrpc2 .NewBufferedStream (clangdStdio , jsonrpc2.VSCodeObjectCodec {})
516
- clangdHandler := jsonrpc2 . AsyncHandler ( jsonrpc2 .HandlerWithError (handler .FromClangd ))
512
+ clangdHandler := AsyncHandler { jsonrpc2 .HandlerWithError (handler .FromClangd )}
517
513
handler .ClangdConn = jsonrpc2 .NewConn (context .Background (), clangdStream , clangdHandler )
518
514
519
515
// Send initialization command to clangd
0 commit comments