summaryrefslogtreecommitdiff
path: root/internal/lsp
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-23 08:27:18 +0200
committerPaul Buetow <paul@buetow.org>2026-03-23 08:27:18 +0200
commit3ea11bc5d671d962d01b57fa0fba0bda611025fe (patch)
tree4aa8c9d8a380a2a176a0a7302d07452a6996e2ef /internal/lsp
parent2d03ad0ba42bade8579578d12aecbf9a73d9af07 (diff)
fix: code quality improvements across lsp, askcli, appconfig, integrationtests
- lsp/handlers_completion.go: track collectFirstCompletion goroutine in inflight WaitGroup (goroutine leak fix) - lsp/transport.go: use %w instead of %v for error wrapping - askcli/command_list.go: extract handleListWithFilters shared helper; handleList/handleAll/handleReady are now single-liners - askcli/command_list.go, urgency.go, dep.go: log ParseTaskExport errors to stderr instead of returning 1 silently - appconfig/config_load.go: rename 'any' variable to 'found' to avoid shadowing the built-in identifier - llm/provider.go: add explanatory comment for package-level registry - integrationtests/ask_test.go: add //go:build integration tag; move repoRoot init from init() to TestMain with diagnostic error message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/lsp')
-rw-r--r--internal/lsp/handlers_completion.go8
-rw-r--r--internal/lsp/transport.go2
2 files changed, 8 insertions, 2 deletions
diff --git a/internal/lsp/handlers_completion.go b/internal/lsp/handlers_completion.go
index aa22fc2..527d020 100644
--- a/internal/lsp/handlers_completion.go
+++ b/internal/lsp/handlers_completion.go
@@ -216,7 +216,13 @@ func collectCompletionResults(results <-chan completionJobResult) []CompletionIt
func (s *Server) firstCompletionAndStore(results <-chan completionJobResult, cacheKey string, end func()) ([]CompletionItem, bool) {
firstCh := make(chan []CompletionItem, 1)
- go s.collectFirstCompletion(results, cacheKey, firstCh, end)
+ // Track this goroutine in inflight so Run's deferred Wait() catches it
+ // and prevents use-after-close writes on shutdown.
+ s.inflight.Add(1)
+ go func() {
+ defer s.inflight.Done()
+ s.collectFirstCompletion(results, cacheKey, firstCh, end)
+ }()
firstItems, ok := <-firstCh
if !ok || len(firstItems) == 0 {
return nil, false
diff --git a/internal/lsp/transport.go b/internal/lsp/transport.go
index bca2c37..3547dfa 100644
--- a/internal/lsp/transport.go
+++ b/internal/lsp/transport.go
@@ -33,7 +33,7 @@ func (s *Server) readMessage() ([]byte, error) {
case "content-length":
n, err := strconv.Atoi(val)
if err != nil {
- return nil, fmt.Errorf("invalid Content-Length: %v", err)
+ return nil, fmt.Errorf("invalid Content-Length: %w", err)
}
contentLength = n
}