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)