diff options
Diffstat (limited to 'internal/lsp')
| -rw-r--r-- | internal/lsp/chat_commands.go | 14 | ||||
| -rw-r--r-- | internal/lsp/chat_commands_test.go | 2 |
2 files changed, 2 insertions, 14 deletions
diff --git a/internal/lsp/chat_commands.go b/internal/lsp/chat_commands.go index 31347e9..89efa49 100644 --- a/internal/lsp/chat_commands.go +++ b/internal/lsp/chat_commands.go @@ -45,19 +45,7 @@ func (s *Server) handleReloadCommand() chatCommandResult { s.logger.Printf("config reload failed: %v", err) return chatCommandResult{message: fmt.Sprintf("Reload failed: %v", err)} } - summary := formatReloadSummary(changes) + summary := runtimeconfig.FormatSummary("Reloaded config", changes) s.logger.Print(summary) return chatCommandResult{message: summary} } - -func formatReloadSummary(changes []runtimeconfig.Change) string { - if len(changes) == 0 { - return "Reloaded config (no changes detected)." - } - lines := make([]string, 0, len(changes)+1) - lines = append(lines, fmt.Sprintf("Reloaded config (%d changes):", len(changes))) - for _, ch := range changes { - lines = append(lines, fmt.Sprintf("- %s: %s → %s", ch.Key, ch.Old, ch.New)) - } - return strings.Join(lines, "\n") -} diff --git a/internal/lsp/chat_commands_test.go b/internal/lsp/chat_commands_test.go index f9bd6a0..87cc1b4 100644 --- a/internal/lsp/chat_commands_test.go +++ b/internal/lsp/chat_commands_test.go @@ -17,7 +17,7 @@ func TestFormatReloadSummary(t *testing.T) { {Key: "max_tokens", Old: "200", New: "128"}, {Key: "provider", Old: "openai", New: "ollama"}, } - got := formatReloadSummary(changes) + got := runtimeconfig.FormatSummary("Reloaded config", changes) if !strings.Contains(got, "Reloaded config (2 changes):") { t.Fatalf("expected change count line, got %q", got) } |
