diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-02 14:43:42 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-02 14:43:42 +0200 |
| commit | bd1e20279725c03c0d7244d1bb4425fe07dac787 (patch) | |
| tree | 29c5ca759542c9ec8a74792e8a9ffe4d52669d31 /internal/hexailsp | |
| parent | 36c332b4a3deef68c93232416c68ec2b74f108fb (diff) | |
lsp: inject StatusSink to decouple core from tmux package (task 407)
Diffstat (limited to 'internal/hexailsp')
| -rw-r--r-- | internal/hexailsp/run.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/hexailsp/run.go b/internal/hexailsp/run.go index 09889ec..ca24016 100644 --- a/internal/hexailsp/run.go +++ b/internal/hexailsp/run.go @@ -18,6 +18,7 @@ import ( "codeberg.org/snonux/hexai/internal/lsp" "codeberg.org/snonux/hexai/internal/runtimeconfig" "codeberg.org/snonux/hexai/internal/stats" + tmx "codeberg.org/snonux/hexai/internal/tmux" ) // ServerRunner is the minimal interface satisfied by lsp.Server. @@ -29,6 +30,17 @@ type ConfigurableServerRunner interface { ApplyOptions(lsp.ServerOptions) } +type tmuxStatusSink struct{} + +func (tmuxStatusSink) SetLLMStart(provider, model string) error { + return tmx.SetStatus(tmx.FormatLLMStartStatus(provider, model)) +} + +func (tmuxStatusSink) SetGlobal(reqs int64, rpm float64, sent int64, recv int64, provider, model string, scopeRPM float64, scopeReqs int64, window time.Duration) error { + status := tmx.FormatGlobalStatusColored(reqs, rpm, sent, recv, provider, model, scopeRPM, scopeReqs, window) + return tmx.SetStatus(status) +} + // ServerFactory creates a ServerRunner. Default uses lsp.NewServer. type ServerFactory func(r io.Reader, w io.Writer, logger *log.Logger, opts lsp.ServerOptions) ServerRunner @@ -150,5 +162,6 @@ func makeServerOptions(cfg appconfig.App, logContext bool, client llm.Client, lo Config: &cfg, Client: client, IgnoreChecker: ignoreChecker, + StatusSink: tmuxStatusSink{}, } } |
