From 3f1ab18cbc996c9467dae6d8deb2c26798aff30e Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 30 Jan 2026 12:16:31 +0200 Subject: feat: add completion_wait_all config and fix Anthropic system messages - Add completion_wait_all config option (default true) to wait for all backends before returning results, or return first result immediately - Fix Anthropic API: extract system messages to top-level system field as required by Messages API (was causing 400 errors) - Add anthropic case to server.go clientFor() for model overrides --- internal/lsp/handlers_completion.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'internal/lsp/handlers_completion.go') diff --git a/internal/lsp/handlers_completion.go b/internal/lsp/handlers_completion.go index 2fac1f3..28da503 100644 --- a/internal/lsp/handlers_completion.go +++ b/internal/lsp/handlers_completion.go @@ -155,6 +155,24 @@ func (s *Server) tryLLMCompletion(p CompletionParams, above, current, below, fun return res.items, true, false } + waitAll := s.completionWaitAll() + if waitAll { + // Wait for all backends, return combined results + defer end() + combined := make([]CompletionItem, 0) + for res := range results { + if !res.ok || len(res.items) == 0 { + continue + } + combined = append(combined, res.items...) + } + if len(combined) == 0 { + return nil, false, false + } + return combined, true, false + } + + // Return first result immediately, store combined for later firstCh := make(chan []CompletionItem, 1) go func(planKey string) { defer end() -- cgit v1.2.3