summaryrefslogtreecommitdiff
path: root/internal/lsp/server.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/server.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/server.go')
-rw-r--r--internal/lsp/server.go16
1 files changed, 16 insertions, 0 deletions
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)