From 9272a9660e25bb599398fd043baa73344fab656d Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 4 Mar 2026 19:01:10 -0500 Subject: [PATCH] feat(submit): show progress notifications during submit Problem: `M.submit` gave no UI feedback between credential entry and final result, leaving users staring at a silent hang for 10-30s. Solution: Add `STATUS_MSGS` map and emit an immediate `vim.notify` on submit start. Pass an `on_status` handler to `scraper.submit` that fires a notification for each phase (`checking_login`, `logging_in`, etc.). --- lua/cp/submit.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lua/cp/submit.lua b/lua/cp/submit.lua index d7f91fa..4efe25e 100644 --- a/lua/cp/submit.lua +++ b/lua/cp/submit.lua @@ -4,6 +4,13 @@ local cache = require('cp.cache') local logger = require('cp.log') local state = require('cp.state') +local STATUS_MSGS = { + installing_browser = 'Installing browser (first time setup)...', + checking_login = 'Checking login...', + logging_in = 'Logging in...', + submitting = 'Submitting...', +} + local function prompt_credentials(platform, callback) local saved = cache.get_credentials(platform) if saved and saved.username and saved.password then @@ -48,6 +55,8 @@ function M.submit(opts) local source_lines = vim.fn.readfile(source_file) local source_code = table.concat(source_lines, '\n') + vim.notify('[cp.nvim] Submitting...', vim.log.levels.INFO) + require('cp.scraper').submit( platform, contest_id, @@ -55,6 +64,11 @@ function M.submit(opts) language, source_code, creds, + function(status) + vim.schedule(function() + vim.notify('[cp.nvim] ' .. (STATUS_MSGS[status] or status), vim.log.levels.INFO) + end) + end, function(result) vim.schedule(function() if result and result.success then