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/server.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'internal/lsp/server.go') diff --git a/internal/lsp/server.go b/internal/lsp/server.go index 67e3cab..127b089 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -71,6 +71,7 @@ type ServerOptions struct { ManualInvokeMinPrefix int CompletionDebounceMs int CompletionThrottleMs int + CompletionWaitAll *bool // Inline/chat triggers InlineOpen string @@ -160,6 +161,7 @@ func (s *Server) applyOptions(opts ServerOptions) { s.cfg.ManualInvokeMinPrefix = opts.ManualInvokeMinPrefix s.cfg.CompletionDebounceMs = opts.CompletionDebounceMs s.cfg.CompletionThrottleMs = opts.CompletionThrottleMs + s.cfg.CompletionWaitAll = opts.CompletionWaitAll s.cfg.InlineOpen = opts.InlineOpen s.cfg.InlineClose = opts.InlineClose s.cfg.ChatSuffix = opts.ChatSuffix @@ -305,6 +307,12 @@ func (s *Server) clientFor(spec requestSpec) llm.Client { } else if spec.fallbackModel != "" { cfg.OllamaModel = spec.fallbackModel } + case "anthropic": + if modelOverride != "" { + cfg.AnthropicModel = modelOverride + } else if spec.fallbackModel != "" { + cfg.AnthropicModel = spec.fallbackModel + } } client, err := newClientForProvider(cfg, provider) if err != nil { @@ -451,6 +459,14 @@ func (s *Server) completionThrottle() time.Duration { return time.Duration(cfg.CompletionThrottleMs) * time.Millisecond } +func (s *Server) completionWaitAll() bool { + cfg := s.currentConfig() + if cfg.CompletionWaitAll == nil { + return true // default: wait for all backends + } + return *cfg.CompletionWaitAll +} + func (s *Server) inlineMarkers() (open string, close string, openChar byte, closeChar byte) { cfg := s.currentConfig() open = strings.TrimSpace(cfg.InlineOpen) -- cgit v1.2.3