fix: type errors

This commit is contained in:
Barrett Ruth 2025-09-22 18:51:00 -04:00
parent ba81df2266
commit a69d9f3756
2 changed files with 8 additions and 8 deletions

View file

@ -42,7 +42,7 @@ end
---@param problem_id? string ---@param problem_id? string
---@param language? string ---@param language? string
local function setup_problem(contest_id, problem_id, language) local function setup_problem(contest_id, problem_id, language)
if not state.get_platform() then if state.get_platform() == '' then
logger.log('no platform set. run :CP <platform> <contest> first', vim.log.levels.ERROR) logger.log('no platform set. run :CP <platform> <contest> first', vim.log.levels.ERROR)
return return
end end
@ -222,7 +222,7 @@ local function toggle_run_panel(is_debug)
return return
end end
if not state.get_platform() then if state.get_platform() == '' then
logger.log( logger.log(
'No contest configured. Use :CP <platform> <contest> <problem> to set up first.', 'No contest configured. Use :CP <platform> <contest> <problem> to set up first.',
vim.log.levels.ERROR vim.log.levels.ERROR
@ -665,7 +665,7 @@ end
---@param contest_id string ---@param contest_id string
---@param language? string ---@param language? string
local function setup_contest(contest_id, language) local function setup_contest(contest_id, language)
if not state.get_platform() then if state.get_platform() == '' then
logger.log('no platform set', vim.log.levels.ERROR) logger.log('no platform set', vim.log.levels.ERROR)
return false return false
end end

View file

@ -1,8 +1,8 @@
local M = {} local M = {}
local state = { local state = {
platform = nil, platform = '',
contest_id = nil, contest_id = '',
problem_id = nil, problem_id = nil,
test_cases = nil, test_cases = nil,
run_panel_active = false, run_panel_active = false,
@ -66,12 +66,12 @@ function M.get_context()
end end
function M.has_context() function M.has_context()
return state.platform and state.contest_id return state.platform ~= '' and state.contest_id ~= ''
end end
function M.reset() function M.reset()
state.platform = nil state.platform = ''
state.contest_id = nil state.contest_id = ''
state.problem_id = nil state.problem_id = nil
state.test_cases = nil state.test_cases = nil
state.run_panel_active = false state.run_panel_active = false