fix: remove version
This commit is contained in:
parent
9e84d57b8a
commit
975e829f78
4 changed files with 8 additions and 9 deletions
|
|
@ -109,12 +109,11 @@ Template Variables ~
|
|||
|
||||
• {source} Source file path (e.g. "abc324a.cpp")
|
||||
• {binary} Output binary path (e.g. "build/abc324a.run")
|
||||
• {version} Language version when specified in config
|
||||
• {contest} Contest identifier (e.g. "abc324", "1933")
|
||||
• {problem} Problem identifier (e.g. "a", "b")
|
||||
|
||||
Example template: >
|
||||
compile = { 'g++', '{source}', '-o', '{binary}', '-std=c++{version}' }
|
||||
compile = { 'g++', '{source}', '-o', '{binary}', '-std=c++17' }
|
||||
< Would expand to: >
|
||||
g++ abc324a.cpp -o build/abc324a.run -std=c++17
|
||||
<
|
||||
|
|
@ -196,10 +195,9 @@ Here's an example configuration with lazy.nvim: >lua
|
|||
*cp.LanguageConfig*
|
||||
Fields: ~
|
||||
{compile} (string[], optional) Compile command template with
|
||||
{version}, {source}, {binary} placeholders.
|
||||
{source}, {binary} placeholders.
|
||||
{test} (string[]) Test execution command template.
|
||||
{debug} (string[], optional) Debug compile command template.
|
||||
{version} (number, optional) Language version (e.g. 20, 23 for C++).
|
||||
{extension} (string) File extension (e.g. "cc", "py").
|
||||
{executable} (string, optional) Executable name for interpreted languages.
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
---@field test? string[] Test execution command template
|
||||
---@field debug? string[] Debug command template
|
||||
---@field executable? string Executable name
|
||||
---@field version? number Language version
|
||||
---@field extension? string File extension
|
||||
|
||||
---@class ContestConfig
|
||||
|
|
|
|||
|
|
@ -230,7 +230,6 @@ function M.compile_problem(contest_config, is_debug)
|
|||
local substitutions = {
|
||||
source = source_file,
|
||||
binary = binary_file,
|
||||
version = tostring(language_config.version),
|
||||
}
|
||||
|
||||
local compile_cmd = (is_debug and language_config.debug) and language_config.debug
|
||||
|
|
@ -279,7 +278,6 @@ function M.run_problem(contest_config, is_debug)
|
|||
local substitutions = {
|
||||
source = source_file,
|
||||
binary = binary_file,
|
||||
version = tostring(language_config.version),
|
||||
}
|
||||
|
||||
local compile_cmd = is_debug and language_config.debug or language_config.compile
|
||||
|
|
@ -302,6 +300,11 @@ function M.run_problem(contest_config, is_debug)
|
|||
local platform = state.get_platform()
|
||||
local contest_id = state.get_contest_id()
|
||||
local problem_id = state.get_problem_id()
|
||||
|
||||
if not platform or not contest_id then
|
||||
logger.log('configure a contest before running a problem', vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
local timeout_ms, _ = cache.get_constraints(platform, contest_id, problem_id)
|
||||
timeout_ms = timeout_ms or 2000
|
||||
|
||||
|
|
|
|||
|
|
@ -182,10 +182,9 @@ local function run_single_test_case(contest_config, cp_config, test_case)
|
|||
local substitutions = {
|
||||
source = source_file,
|
||||
binary = binary_file,
|
||||
version = tostring(language_config.version or ''),
|
||||
}
|
||||
|
||||
if language_config.compile and vim.fn.filereadable(binary_file) == 0 then
|
||||
if language_config.compile and binary_file and vim.fn.filereadable(binary_file) == 0 then
|
||||
logger.log('binary not found, compiling first...')
|
||||
local compile_cmd = substitute_template(language_config.compile, substitutions)
|
||||
local redirected_cmd = vim.deepcopy(compile_cmd)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue