From 4381b9f8614f3e7e055266eec0686a609565ba08 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Thu, 5 Mar 2026 18:23:50 -0500 Subject: [PATCH] fix(completion): deduplicate pick and cache in second-arg candidates Problem: `pick` and `cache` were inserted unconditionally into the candidate list, then inserted again via `vim.list_extend(candidates, actions)` when a contest was active, producing duplicates in the completion menu. Solution: filter `pick` and `cache` out of the `actions` extend since they are already present in the always-visible candidate set. --- plugin/cp.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/cp.lua b/plugin/cp.lua index 60efb7a..1484da3 100644 --- a/plugin/cp.lua +++ b/plugin/cp.lua @@ -44,7 +44,9 @@ end, { table.insert(candidates, 'cache') table.insert(candidates, 'pick') if platform and contest_id then - vim.list_extend(candidates, actions) + vim.list_extend(candidates, vim.tbl_filter(function(a) + return a ~= 'pick' and a ~= 'cache' + end, actions)) local cache = require('cp.cache') cache.load() local contest_data = cache.get_contest_data(platform, contest_id)