From c1529c5d91e4fc7ab4b73c1baf264a3154e33153 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sun, 21 Sep 2025 11:37:08 -0400 Subject: [PATCH] fix(ci): unused vars --- lua/cp/pickers/fzf_lua.lua | 5 +++++ lua/cp/pickers/telescope.lua | 10 +++++++++- spec/picker_spec.lua | 6 +++--- spec/telescope_spec.lua | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lua/cp/pickers/fzf_lua.lua b/lua/cp/pickers/fzf_lua.lua index eaec2e7..7b1b476 100644 --- a/lua/cp/pickers/fzf_lua.lua +++ b/lua/cp/pickers/fzf_lua.lua @@ -82,6 +82,11 @@ local function contest_picker(platform) problem_picker(platform, contest.id) end end, + ['ctrl-r'] = function() + local cache = require('cp.cache') + cache.clear_contest_list(platform) + contest_picker(platform) + end, }, }) end diff --git a/lua/cp/pickers/telescope.lua b/lua/cp/pickers/telescope.lua index 57ef5d8..d42b4cc 100644 --- a/lua/cp/pickers/telescope.lua +++ b/lua/cp/pickers/telescope.lua @@ -75,7 +75,7 @@ local function contest_picker(opts, platform) end, }), sorter = conf.generic_sorter(opts), - attach_mappings = function(prompt_bufnr) + attach_mappings = function(prompt_bufnr, map) actions.select_default:replace(function() local selection = action_state.get_selected_entry() actions.close(prompt_bufnr) @@ -84,6 +84,14 @@ local function contest_picker(opts, platform) problem_picker(opts, platform, selection.value.id) end end) + + map('i', '', function() + local cache = require('cp.cache') + cache.clear_contest_list(platform) + actions.close(prompt_bufnr) + contest_picker(opts, platform) + end) + return true end, }) diff --git a/spec/picker_spec.lua b/spec/picker_spec.lua index 91379e8..eb50d7c 100644 --- a/spec/picker_spec.lua +++ b/spec/picker_spec.lua @@ -106,7 +106,7 @@ describe('cp.picker', function() it('returns problems from cache when available', function() local cache = require('cp.cache') cache.load = function() end - cache.get_contest_data = function(platform, contest_id) + cache.get_contest_data = function() return { problems = { { id = 'a', name = 'Problem A' }, @@ -131,7 +131,7 @@ describe('cp.picker', function() cache.get_contest_data = function() return nil end - scrape.scrape_contest_metadata = function(platform, contest_id) + scrape.scrape_contest_metadata = function() return { success = true, problems = { @@ -154,7 +154,7 @@ describe('cp.picker', function() cache.get_contest_data = function() return nil end - scrape.scrape_contest_metadata = function(platform, contest_id) + scrape.scrape_contest_metadata = function() return { success = false, error = 'test error', diff --git a/spec/telescope_spec.lua b/spec/telescope_spec.lua index 3be344f..bf310ef 100644 --- a/spec/telescope_spec.lua +++ b/spec/telescope_spec.lua @@ -14,7 +14,7 @@ describe('cp.telescope', function() package.preload['telescope.pickers'] = function() return { - new = function(opts, picker_opts) + new = function() return { find = function() end, }