feat(config): add language version selection with setup-time validation

Problem: users cannot choose which C++ standard (e.g. C++17 vs C++20
vs C++23) to submit with — the plugin hardcodes a single platform ID
per language with no discoverability or override mechanism.

Solution: add `LANGUAGE_VERSIONS` and `DEFAULT_VERSIONS` tables in
`constants.lua` as the single source of truth. `config.lua` gains
`version` and `submit_id` fields on `CpLanguage`/`CpPlatformOverrides`,
validated at setup time. `submit.lua` resolves the effective config to
a platform ID (priority: `submit_id` > `version` > default). Helpdocs
document the new `*cp-submit-language*` section with per-platform
available versions and the `submit_id` escape hatch. Tests cover
`LANGUAGE_IDS` completeness and `get_language_id` lookups.
This commit is contained in:
Barrett Ruth 2026-03-06 18:04:04 -05:00
parent 4e709c8470
commit b90ac67826
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
5 changed files with 153 additions and 11 deletions

View file

@ -74,4 +74,21 @@ M.signal_codes = {
[143] = 'SIGTERM',
}
M.LANGUAGE_VERSIONS = {
atcoder = { cpp = { ['c++23'] = '6017' }, python = { python3 = '6082' } },
codeforces = { cpp = { ['c++17'] = '89' }, python = { python3 = '70' } },
cses = { cpp = { ['c++17'] = 'C++17' }, python = { python3 = 'Python3' } },
kattis = {
cpp = { ['c++17'] = 'C++', ['c++20'] = 'C++', ['c++23'] = 'C++' },
python = { python3 = 'Python 3' },
},
usaco = {
cpp = { ['c++17'] = 'cpp', ['c++20'] = 'cpp', ['c++23'] = 'cpp' },
python = { python3 = 'python' },
},
codechef = { cpp = { ['c++17'] = 'C++ 17' }, python = { python3 = 'Python 3' } },
}
M.DEFAULT_VERSIONS = { cpp = 'c++17', python = 'python3' }
return M