From 5b04524a7c134e101da1bc7e6a99402ca07ad4cc Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 2 Mar 2026 14:27:34 +0200 Subject: hexailsp: add ConfigurableServerRunner for runtime ApplyOptions (task 408) --- internal/hexailsp/run.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'internal/hexailsp/run.go') diff --git a/internal/hexailsp/run.go b/internal/hexailsp/run.go index 3c86414..09889ec 100644 --- a/internal/hexailsp/run.go +++ b/internal/hexailsp/run.go @@ -23,6 +23,12 @@ import ( // ServerRunner is the minimal interface satisfied by lsp.Server. type ServerRunner interface{ Run() error } +// ConfigurableServerRunner supports runtime option updates. +type ConfigurableServerRunner interface { + ServerRunner + ApplyOptions(lsp.ServerOptions) +} + // ServerFactory creates a ServerRunner. Default uses lsp.NewServer. type ServerFactory func(r io.Reader, w io.Writer, logger *log.Logger, opts lsp.ServerOptions) ServerRunner @@ -81,7 +87,7 @@ func RunWithFactory(logPath string, configPath string, stdin io.Reader, stdout i opts.ConfigLoadOptions = loadOpts opts.ConfigStore = store server := factory(stdin, stdout, logger, opts) - if configurable, ok := server.(interface{ ApplyOptions(lsp.ServerOptions) }); ok { + if configurable, ok := server.(ConfigurableServerRunner); ok { store.Subscribe(func(oldCfg, newCfg appconfig.App) { updated := newCfg normalizeLoggingConfig(&updated) -- cgit v1.2.3