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

View file

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