From c3c71345db9086392cd9b7529c7f5287009c226e Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 24 Sep 2025 23:21:43 +0300 Subject: Add runtime config store and reload command --- internal/lsp/debounce_throttle_test.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'internal/lsp/debounce_throttle_test.go') diff --git a/internal/lsp/debounce_throttle_test.go b/internal/lsp/debounce_throttle_test.go index 0b49b1b..81a2c1a 100644 --- a/internal/lsp/debounce_throttle_test.go +++ b/internal/lsp/debounce_throttle_test.go @@ -22,9 +22,11 @@ func (t *timeLLM) DefaultModel() string { return "m" } func TestCompletionDebounce_WaitsUntilQuiet(t *testing.T) { s := newTestServer() s.compCache = make(map[string]string) - s.triggerChars = []string{".", ":", "/", "_"} - s.maxTokens = 32 - s.completionDebounce = 30 * time.Millisecond + cfg := s.cfg + cfg.TriggerCharacters = []string{".", ":", "/", "_"} + cfg.MaxTokens = 32 + cfg.CompletionDebounceMs = 30 + s.cfg = cfg s.markActivity() // simulate recent input f := &timeLLM{} @@ -50,9 +52,11 @@ func TestCompletionDebounce_WaitsUntilQuiet(t *testing.T) { func TestCompletionThrottle_SerializesCalls(t *testing.T) { s := newTestServer() s.compCache = make(map[string]string) - s.triggerChars = []string{".", ":", "/", "_"} - s.maxTokens = 32 - s.throttleInterval = 25 * time.Millisecond + cfg := s.cfg + cfg.TriggerCharacters = []string{".", ":", "/", "_"} + cfg.MaxTokens = 32 + cfg.CompletionThrottleMs = 25 + s.cfg = cfg // first call uses timeLLM to record time f1 := &timeLLM{} @@ -79,7 +83,8 @@ func TestCompletionThrottle_SerializesCalls(t *testing.T) { if f2.t.IsZero() { t.Fatalf("expected second call time recorded") } - if f2.t.Sub(start) < s.throttleInterval { - t.Fatalf("expected throttle spacing >= %s, got %s", s.throttleInterval, f2.t.Sub(start)) + interval := time.Duration(cfg.CompletionThrottleMs) * time.Millisecond + if f2.t.Sub(start) < interval { + t.Fatalf("expected throttle spacing >= %s, got %s", interval, f2.t.Sub(start)) } } -- cgit v1.2.3