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.
This commit is contained in:
Barrett Ruth 2026-03-05 18:23:50 -05:00
parent 73be6b8277
commit 4381b9f861

View file

@ -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)