From a69d9f37564821aaf4cf7c9dc181f01bfc214003 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Mon, 22 Sep 2025 18:51:00 -0400 Subject: [PATCH] fix: type errors --- lua/cp/init.lua | 6 +++--- lua/cp/state.lua | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lua/cp/init.lua b/lua/cp/init.lua index 7dba8c9..a3a5f8b 100644 --- a/lua/cp/init.lua +++ b/lua/cp/init.lua @@ -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 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 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 diff --git a/lua/cp/state.lua b/lua/cp/state.lua index ae21fc5..96f7d2f 100644 --- a/lua/cp/state.lua +++ b/lua/cp/state.lua @@ -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