From abfb1964fce8f742e1b02d83f4983656c49c7b95 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 2 Mar 2026 13:53:29 +0200 Subject: lsp: extract completion/chat/codeaction server subtypes (task 406) --- internal/lsp/server.go | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'internal/lsp/server.go') diff --git a/internal/lsp/server.go b/internal/lsp/server.go index 730169f..fa3b375 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -32,25 +32,18 @@ type Server struct { configStore *runtimeconfig.Store cfg appconfig.App llmClient llm.Client - llmProvider string - altClients map[string]llm.Client - lastInput time.Time + codeActionSubsystem + chatSubsystem // LLM request stats llmReqTotal int64 llmSentBytesTotal int64 llmRespTotal int64 llmRespBytesTotal int64 startTime time.Time - // Small LRU cache for recent code completion outputs (keyed by context) - compCache map[string]string - compCacheOrder []string // most-recent at end; cap ~10 - pendingCompletions map[string][]CompletionItem - configLoadOpts appconfig.LoadOptions + completionSubsystem + configLoadOpts appconfig.LoadOptions // Outgoing JSON-RPC id counter for server-initiated requests - nextID int64 - lastLLMCall time.Time - - completionsDisabled bool + nextID int64 // Gitignore-aware file checker (nil when disabled) ignoreChecker *ignore.Checker @@ -59,6 +52,24 @@ type Server struct { handlers map[string]func(Request) } +type completionSubsystem struct { + // Small LRU cache for recent code completion outputs (keyed by context) + compCache map[string]string + compCacheOrder []string // most-recent at end; cap ~10 + pendingCompletions map[string][]CompletionItem + lastLLMCall time.Time + completionsDisabled bool +} + +type chatSubsystem struct { + lastInput time.Time +} + +type codeActionSubsystem struct { + llmProvider string + altClients map[string]llm.Client +} + // ServerOptions collects configuration for NewServer to avoid long parameter lists. type ServerOptions struct { LogContext bool -- cgit v1.2.3