Merge branch 'main' into feat/template-file-support

This commit is contained in:
Barrett Ruth 2026-02-26 22:56:50 -05:00 committed by GitHub
commit 5b56ff7980
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 159 additions and 30 deletions

View file

@ -346,6 +346,8 @@ function M.get_data_pretty()
return vim.inspect(cache_data)
end
M._cache = cache_data
function M.get_raw_cache()
return cache_data
end
return M

View file

@ -13,7 +13,7 @@ local function check()
vim.health.error('cp.nvim requires Neovim 0.10.0+')
end
local uname = vim.loop.os_uname()
local uname = vim.uv.os_uname()
if uname.sysname == 'Windows_NT' then
vim.health.error('Windows is not supported')
end

View file

@ -276,26 +276,35 @@ function M.run_all_test_cases(indices, debug, on_each, on_done)
end
end
local function run_next(pos)
if pos > #to_run then
logger.log(
('Finished %s %d test cases.'):format(debug and 'debugging' or 'running', #to_run),
vim.log.levels.INFO,
true
)
on_done(panel_state.test_cases)
return
end
M.run_test_case(to_run[pos], debug, function()
if on_each then
on_each(pos, #to_run)
end
run_next(pos + 1)
end)
if #to_run == 0 then
logger.log(
('Finished %s %d test cases.'):format(debug and 'debugging' or 'running', 0),
vim.log.levels.INFO,
true
)
on_done(panel_state.test_cases)
return
end
run_next(1)
local total = #to_run
local remaining = total
for _, idx in ipairs(to_run) do
M.run_test_case(idx, debug, function()
if on_each then
on_each(idx, total)
end
remaining = remaining - 1
if remaining == 0 then
logger.log(
('Finished %s %d test cases.'):format(debug and 'debugging' or 'running', total),
vim.log.levels.INFO,
true
)
on_done(panel_state.test_cases)
end
end)
end
end
---@return PanelState

View file

@ -57,7 +57,7 @@ local function run_scraper(platform, subcommand, args, opts)
env.CONDA_PREFIX = ''
if opts and opts.ndjson then
local uv = vim.loop
local uv = vim.uv
local stdout = uv.new_pipe(false)
local stderr = uv.new_pipe(false)
local buf = ''

View file

@ -198,7 +198,7 @@ function M.setup_contest(platform, contest_id, problem_id, language)
contest_id = contest_id,
language = lang,
requested_problem_id = problem_id,
token = vim.loop.hrtime(),
token = vim.uv.hrtime(),
})
logger.log('Fetching contests problems...', vim.log.levels.INFO, true)

View file

@ -5,7 +5,7 @@ local logger = require('cp.log')
local _nix_python = nil
local _nix_discovered = false
local uname = vim.loop.os_uname()
local uname = vim.uv.os_uname()
local _time_cached = false
local _time_path = nil
@ -336,7 +336,7 @@ function M.timeout_capability()
end
function M.cwd_executables()
local uv = vim.uv or vim.loop
local uv = vim.uv
local req = uv.fs_scandir('.')
if not req then
return {}