@@ -305,7 +305,7 @@ func (s *Server) RefreshInlayHints(ctx context.Context) error {
305305 return nil
306306 }
307307
308- if _ , err := sendClientRequest ( ctx , s , lsproto .WorkspaceInlayHintRefreshInfo , lsproto.NoParams {}); err != nil {
308+ if err := sendClientRequestFireAndForget ( s , lsproto .WorkspaceInlayHintRefreshInfo , lsproto.NoParams {}); err != nil {
309309 return fmt .Errorf ("failed to refresh inlay hints: %w" , err )
310310 }
311311 return nil
@@ -316,7 +316,7 @@ func (s *Server) RefreshCodeLens(ctx context.Context) error {
316316 return nil
317317 }
318318
319- if _ , err := sendClientRequest ( ctx , s , lsproto .WorkspaceCodeLensRefreshInfo , lsproto.NoParams {}); err != nil {
319+ if err := sendClientRequestFireAndForget ( s , lsproto .WorkspaceCodeLensRefreshInfo , lsproto.NoParams {}); err != nil {
320320 return fmt .Errorf ("failed to refresh code lens: %w" , err )
321321 }
322322 return nil
@@ -565,6 +565,8 @@ func (s *Server) writeLoop(ctx context.Context) error {
565565 }
566566}
567567
568+ // WARNING: this should only be called in the async portion of a request handler,
569+ // otherwise a deadlock can occur.
568570func sendClientRequest [Req , Resp any ](ctx context.Context , s * Server , info lsproto.RequestInfo [Req , Resp ], params Req ) (Resp , error ) {
569571 id := jsonrpc .NewIDString (fmt .Sprintf ("ts%d" , s .clientSeq .Add (1 )))
570572 req := info .NewRequestMessage (id , params )
0 commit comments