feat: race countdown support and language version selection (#346)
## Problem Two gaps in the plugin: (1) contest pickers have no way to know whether a contest supports countdown (race), so the UI can't surface that affordance; (2) `:CP submit` hardcodes a single language ID per platform with no way to choose C++ standard or override the platform ID. ## Solution **Race countdown** (`4e709c8`): Add `supports_countdown` boolean to `ContestListResult` and wire it through CSES/USACO scrapers, cache, race module, and pickers. **Language version selection** (`b90ac67`): Add `LANGUAGE_VERSIONS` and `DEFAULT_VERSIONS` tables in `constants.lua`. Config gains `version` and `submit_id` fields validated at setup time. `submit.lua` resolves the effective config to a platform ID (priority: `submit_id` > `version` > default). Helpdocs add `*cp-submit-language*` section. Tests cover `LANGUAGE_IDS` completeness.
This commit is contained in:
parent
592f977296
commit
58b6840815
13 changed files with 265 additions and 46 deletions
|
|
@ -109,6 +109,9 @@ end, {
|
|||
end
|
||||
return filter_candidates(candidates)
|
||||
elseif args[2] == 'race' then
|
||||
if require('cp.race').status().active then
|
||||
return filter_candidates({ 'stop' })
|
||||
end
|
||||
local candidates = { 'stop' }
|
||||
vim.list_extend(candidates, platforms)
|
||||
return filter_candidates(candidates)
|
||||
|
|
@ -126,7 +129,11 @@ end, {
|
|||
if args[2] == 'stress' then
|
||||
local utils = require('cp.utils')
|
||||
return filter_candidates(utils.cwd_executables())
|
||||
elseif args[2] == 'race' and vim.tbl_contains(platforms, args[3]) then
|
||||
elseif
|
||||
args[2] == 'race'
|
||||
and not require('cp.race').status().active
|
||||
and vim.tbl_contains(platforms, args[3])
|
||||
then
|
||||
local cache = require('cp.cache')
|
||||
cache.load()
|
||||
local contests = cache.get_cached_contest_ids(args[3])
|
||||
|
|
@ -153,7 +160,11 @@ end, {
|
|||
return filter_candidates(candidates)
|
||||
end
|
||||
elseif num_args == 5 then
|
||||
if args[2] == 'race' and vim.tbl_contains(platforms, args[3]) then
|
||||
if
|
||||
args[2] == 'race'
|
||||
and not require('cp.race').status().active
|
||||
and vim.tbl_contains(platforms, args[3])
|
||||
then
|
||||
return filter_candidates({ '--lang' })
|
||||
elseif args[2] == 'cache' and args[3] == 'clear' and vim.tbl_contains(platforms, args[4]) then
|
||||
local cache = require('cp.cache')
|
||||
|
|
@ -168,7 +179,12 @@ end, {
|
|||
end
|
||||
end
|
||||
elseif num_args == 6 then
|
||||
if args[2] == 'race' and vim.tbl_contains(platforms, args[3]) and args[5] == '--lang' then
|
||||
if
|
||||
args[2] == 'race'
|
||||
and not require('cp.race').status().active
|
||||
and vim.tbl_contains(platforms, args[3])
|
||||
and args[5] == '--lang'
|
||||
then
|
||||
return filter_candidates(get_enabled_languages(args[3]))
|
||||
elseif vim.tbl_contains(platforms, args[2]) and args[5] == '--lang' then
|
||||
return filter_candidates(get_enabled_languages(args[2]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue