From 8fa31daeba7a6617f08027a5f9f68bb612587772 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 2 Mar 2026 14:05:16 +0200 Subject: lsp: cancel handler contexts on shutdown via server context (task 423) --- internal/lsp/handlers_codeaction.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'internal/lsp/handlers_codeaction.go') diff --git a/internal/lsp/handlers_codeaction.go b/internal/lsp/handlers_codeaction.go index f61b79f..f45dec4 100644 --- a/internal/lsp/handlers_codeaction.go +++ b/internal/lsp/handlers_codeaction.go @@ -2,7 +2,6 @@ package lsp import ( - "context" "encoding/json" "fmt" "os" @@ -392,7 +391,7 @@ func (s *Server) customActionByID(id string) *CustomAction { } func (s *Server) completeCodeAction(ca CodeAction, uri string, rng Range, sys, user string, timeout time.Duration) (CodeAction, bool) { - ctx, cancel := context.WithTimeout(context.Background(), timeout) + ctx, cancel := s.requestTimeoutContext(timeout) defer cancel() messages := []llm.Message{{Role: "system", Content: sys}, {Role: "user", Content: user}} spec := s.buildRequestSpec(surfaceCodeAction) @@ -724,7 +723,7 @@ func (s *Server) generateGoTestFunction(funcCode string) string { cfg := s.currentConfig() sys := cfg.PromptCodeActionGoTestSystem user := renderTemplate(cfg.PromptCodeActionGoTestUser, map[string]string{"function": funcCode}) - ctx, cancel := context.WithTimeout(context.Background(), 18*time.Second) + ctx, cancel := s.requestTimeoutContext(18 * time.Second) defer cancel() messages := []llm.Message{{Role: "system", Content: sys}, {Role: "user", Content: user}} if out, err := s.chatWithStats(ctx, surfaceCodeAction, spec, messages); err == nil { -- cgit v1.2.3