From 6b4dd32683160464319b24bbe5feee0d65eb9ef0 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 24 Sep 2025 22:17:59 -0400 Subject: [PATCH] fix(hook): run hooks truly befoire --- lua/cp/ui/panel.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lua/cp/ui/panel.lua b/lua/cp/ui/panel.lua index c851a04..70ae2fa 100644 --- a/lua/cp/ui/panel.lua +++ b/lua/cp/ui/panel.lua @@ -52,6 +52,14 @@ function M.toggle_run_panel(is_debug) ) local config = config_module.get_config() + if config.hooks and config.hooks.before_run then + config.hooks.before_run(state) + end + + if is_debug and config.hooks and config.hooks.before_debug then + config.hooks.before_debug(state) + end + local run = require('cp.runner.run') local input_file = state.get_input_file() @@ -159,14 +167,6 @@ function M.toggle_run_panel(is_debug) setup_keybindings_for_buffer(test_buffers.tab_buf) - if config.hooks and config.hooks.before_run then - config.hooks.before_run(state) - end - - if is_debug and config.hooks and config.hooks.before_debug then - config.hooks.before_debug(state) - end - local execute = require('cp.runner.execute') local contest_config = config.contests[state.get_platform() or ''] local compile_result = execute.compile_problem(contest_config, is_debug)