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:
parent
73be6b8277
commit
4381b9f861
1 changed files with 3 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue