remove ai comments
This commit is contained in:
parent
e171017ab0
commit
545793df39
3 changed files with 0 additions and 11 deletions
|
|
@ -41,7 +41,6 @@ local function get_contests_for_platform(platform)
|
||||||
return cached_contests
|
return cached_contests
|
||||||
end
|
end
|
||||||
|
|
||||||
-- No cache: start background scraping, return empty for now
|
|
||||||
local constants = require('cp.constants')
|
local constants = require('cp.constants')
|
||||||
local platform_display_name = constants.PLATFORM_DISPLAY_NAMES[platform] or platform
|
local platform_display_name = constants.PLATFORM_DISPLAY_NAMES[platform] or platform
|
||||||
logger.log(('Loading %s contests...'):format(platform_display_name), vim.log.levels.INFO, true)
|
logger.log(('Loading %s contests...'):format(platform_display_name), vim.log.levels.INFO, true)
|
||||||
|
|
@ -64,7 +63,6 @@ local function get_contests_for_platform(platform)
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
---Get list of problems for a specific contest
|
|
||||||
---@param platform string Platform identifier
|
---@param platform string Platform identifier
|
||||||
---@param contest_id string Contest identifier
|
---@param contest_id string Contest identifier
|
||||||
---@return cp.ProblemItem[]
|
---@return cp.ProblemItem[]
|
||||||
|
|
@ -115,7 +113,6 @@ local function get_problems_for_contest(platform, contest_id)
|
||||||
return problems
|
return problems
|
||||||
end
|
end
|
||||||
|
|
||||||
---Set up a specific problem by calling the main CP handler
|
|
||||||
---@param platform string Platform identifier
|
---@param platform string Platform identifier
|
||||||
---@param contest_id string Contest identifier
|
---@param contest_id string Contest identifier
|
||||||
---@param problem_id string Problem identifier
|
---@param problem_id string Problem identifier
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,6 @@ end
|
||||||
function M.scrape_problem_tests(platform, contest_id, problem_id, callback)
|
function M.scrape_problem_tests(platform, contest_id, problem_id, callback)
|
||||||
run_scraper(platform, 'tests', { contest_id, problem_id }, function(result)
|
run_scraper(platform, 'tests', { contest_id, problem_id }, function(result)
|
||||||
if result.success and result.tests then
|
if result.success and result.tests then
|
||||||
-- Write test files
|
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
local mkdir_ok = pcall(vim.fn.mkdir, 'io', 'p')
|
local mkdir_ok = pcall(vim.fn.mkdir, 'io', 'p')
|
||||||
if mkdir_ok then
|
if mkdir_ok then
|
||||||
|
|
@ -125,7 +124,6 @@ function M.scrape_problem_tests(platform, contest_id, problem_id, callback)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Cache test cases
|
|
||||||
local cached_tests = {}
|
local cached_tests = {}
|
||||||
for i, test_case in ipairs(result.tests) do
|
for i, test_case in ipairs(result.tests) do
|
||||||
table.insert(cached_tests, {
|
table.insert(cached_tests, {
|
||||||
|
|
|
||||||
|
|
@ -61,11 +61,9 @@ function M.setup_contest(platform, contest_id, problem_id, language)
|
||||||
|
|
||||||
logger.log(('found %d problems'):format(#problems))
|
logger.log(('found %d problems'):format(#problems))
|
||||||
|
|
||||||
-- Set up specified problem or first problem
|
|
||||||
state.set_contest_id(contest_id)
|
state.set_contest_id(contest_id)
|
||||||
local target_problem = problem_id or problems[1].id
|
local target_problem = problem_id or problems[1].id
|
||||||
|
|
||||||
-- Validate problem exists if specified
|
|
||||||
if problem_id then
|
if problem_id then
|
||||||
local problem_exists = false
|
local problem_exists = false
|
||||||
for _, prob in ipairs(problems) do
|
for _, prob in ipairs(problems) do
|
||||||
|
|
@ -85,7 +83,6 @@ function M.setup_contest(platform, contest_id, problem_id, language)
|
||||||
|
|
||||||
M.setup_problem(contest_id, target_problem, language)
|
M.setup_problem(contest_id, target_problem, language)
|
||||||
|
|
||||||
-- Scrape remaining problems in background
|
|
||||||
M.scrape_remaining_problems(platform, contest_id, problems)
|
M.scrape_remaining_problems(platform, contest_id, problems)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
@ -103,7 +100,6 @@ function M.setup_problem(contest_id, problem_id, language)
|
||||||
|
|
||||||
local ctx = problem.create_context(platform, contest_id, problem_id, config, language)
|
local ctx = problem.create_context(platform, contest_id, problem_id, config, language)
|
||||||
|
|
||||||
-- Load test cases for current problem
|
|
||||||
local cached_tests = cache.get_test_cases(platform, contest_id, problem_id)
|
local cached_tests = cache.get_test_cases(platform, contest_id, problem_id)
|
||||||
if cached_tests then
|
if cached_tests then
|
||||||
state.set_test_cases(cached_tests)
|
state.set_test_cases(cached_tests)
|
||||||
|
|
@ -134,12 +130,10 @@ function M.setup_problem(contest_id, problem_id, language)
|
||||||
state.set_test_cases({})
|
state.set_test_cases({})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Update state immediately (safe in fast event)
|
|
||||||
state.set_contest_id(contest_id)
|
state.set_contest_id(contest_id)
|
||||||
state.set_problem_id(problem_id)
|
state.set_problem_id(problem_id)
|
||||||
state.set_run_panel_active(false)
|
state.set_run_panel_active(false)
|
||||||
|
|
||||||
-- Schedule vim commands (required for fast event context)
|
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
local ok, err = pcall(function()
|
local ok, err = pcall(function()
|
||||||
vim.cmd.only({ mods = { silent = true } })
|
vim.cmd.only({ mods = { silent = true } })
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue