summaryrefslogtreecommitdiff
path: root/internal/lsp/handlers_codeaction.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-23 08:08:57 +0200
committerPaul Buetow <paul@buetow.org>2026-03-23 08:08:57 +0200
commit4958ea5100ebf8d4ff9fd818b7bc59d01989feb4 (patch)
tree44bc03cdfa7d58ea948023c87bfbe8a37fe315c9 /internal/lsp/handlers_codeaction.go
parentba929c035c7c74113d061c57cc5b500af0b20b74 (diff)
fix: address all HIGH-severity code quality audit findings
- lsp/server.go: track request goroutines in inflight WaitGroup to prevent use-after-close writes on shutdown - lsp/llm_client_registry.go: acquire write lock before calling build() to eliminate TOCTOU race on cache population - lsp/handlers_codeaction.go: resolveSimplifyCodeAction now uses PromptCodeActionSimplify{System,User} (was wrongly using rewrite prompts) - askcli/taskexport.go: remove exported MustParseTaskExport to prevent panic on malformed external input; move to unexported test helper - cmd/ask/main.go: print error to stderr before os.Exit - llm/{openai,ollama,openrouter}.go: add interface satisfaction assertions - integrationtests/ask_test.go: replace type assertions with errors.As for robust exec.ExitError unwrapping Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/lsp/handlers_codeaction.go')
-rw-r--r--internal/lsp/handlers_codeaction.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/lsp/handlers_codeaction.go b/internal/lsp/handlers_codeaction.go
index 1d8a36f..aba2113 100644
--- a/internal/lsp/handlers_codeaction.go
+++ b/internal/lsp/handlers_codeaction.go
@@ -266,10 +266,10 @@ func resolveGoTestCodeAction(s *Server, action CodeAction, payload codeActionPay
func resolveSimplifyCodeAction(s *Server, action CodeAction, payload codeActionPayload) (CodeAction, bool) {
cfg := s.currentConfig()
- sys := cfg.PromptCodeActionRewriteSystem
- user := renderTemplate(cfg.PromptCodeActionRewriteUser, map[string]string{
- "instruction": "Simplify and improve the code while preserving behavior. Return only the improved code.",
- "selection": payload.Selection,
+ // Use the simplify-specific prompts, not the rewrite prompts.
+ sys := cfg.PromptCodeActionSimplifySystem
+ user := renderTemplate(cfg.PromptCodeActionSimplifyUser, map[string]string{
+ "selection": payload.Selection,
})
return s.completeCodeAction(action, payload.URI, payload.Range, sys, user, 20*time.Second)
}