summaryrefslogtreecommitdiff
path: root/internal/lsp/handlers_completion.go
diff options
context:
space:
mode:
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()