summaryrefslogtreecommitdiff
path: root/internal/lsp/handlers_completion.go
diff options
context:
space:
mode:
authorPaul Buetow <pbuetow@mimecast.com>2026-01-30 12:16:31 +0200
committerPaul Buetow <pbuetow@mimecast.com>2026-01-30 12:16:31 +0200
commit3f1ab18cbc996c9467dae6d8deb2c26798aff30e (patch)
treec1a6cdaad61a37bbdd70ddbe161c05aaf13d09ab /internal/lsp/handlers_completion.go
parentd3e0edbe16459f07506f70611b639d0a0a7f054e (diff)
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
Diffstat (limited to 'internal/lsp/handlers_completion.go')
-rw-r--r--internal/lsp/handlers_completion.go18
1 files changed, 18 insertions, 0 deletions
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()