From f5ae20b971514a6d924928a1b603d2a2a1c68af9 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Fri, 6 Mar 2026 18:28:56 -0500 Subject: [PATCH] fix(race): improve cancellation log and prefix timer notifications Problem: Race cancellation logged a generic message without identifying which race was cancelled. Timer notifications used `[cp.nvim]` without the colon prefix that `logger.log` uses. Solution: Log cancelled race with platform display name and contest name. Add colon to `[cp.nvim]:` prefix in timer countdown notifications. --- lua/cp/race.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/cp/race.lua b/lua/cp/race.lua index bbc0960..04b433c 100644 --- a/lua/cp/race.lua +++ b/lua/cp/race.lua @@ -126,7 +126,7 @@ function M.start(platform, contest_id, language) require('cp.setup').setup_contest(p, c, nil, l) else vim.notify( - ('[cp.nvim] %s starts in %s'):format(race_state.contest_name, format_countdown(r)), + ('[cp.nvim]: %s starts in %s'):format(race_state.contest_name, format_countdown(r)), vim.log.levels.INFO ) end @@ -137,8 +137,11 @@ end function M.stop() local timer = race_state.timer if not timer then + logger.log('No active race', { level = vim.log.levels.WARN }) return end + local display = constants.PLATFORM_DISPLAY_NAMES[race_state.platform] or race_state.platform + local name = race_state.contest_name or race_state.contest_id timer:stop() timer:close() race_state.timer = nil @@ -147,6 +150,7 @@ function M.stop() race_state.contest_name = nil race_state.language = nil race_state.start_time = nil + logger.log(('Cancelled %s race "%s"'):format(display, name), { level = vim.log.levels.INFO, override = true }) end function M.status()