diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..e83a348 --- /dev/null +++ b/.luarc.json @@ -0,0 +1,16 @@ +{ + "runtime.version": "LuaJIT", + "runtime.path": [ + "lua/?.lua", + "lua/?/init.lua" + ], + "diagnostics.globals": [ + "vim" + ], + "workspace.library": [ + "$VIMRUNTIME/lua", + "${3rd}/luv/library" + ], + "workspace.checkThirdParty": false, + "completion.callSnippet": "Replace" +} \ No newline at end of file diff --git a/lua/cp/config.lua b/lua/cp/config.lua index 1ed0214..8a88495 100644 --- a/lua/cp/config.lua +++ b/lua/cp/config.lua @@ -4,6 +4,12 @@ ---@field debug_flags string[] ---@field timeout_ms number +---@class cp.PartialContestConfig +---@field cpp_version? number +---@field compile_flags? string[] +---@field debug_flags? string[] +---@field timeout_ms? number + ---@class cp.HooksConfig ---@field before_run? function ---@field before_debug? function @@ -13,6 +19,11 @@ ---@field snippets table ---@field hooks cp.HooksConfig +---@class cp.PartialConfig +---@field contests? table +---@field snippets? table +---@field hooks? cp.HooksConfig + local M = {} ---@type cp.Config @@ -42,7 +53,7 @@ M.defaults = { } ---@param base_config cp.ContestConfig ----@param contest_config cp.ContestConfig +---@param contest_config cp.PartialContestConfig ---@return cp.ContestConfig local function extend_contest_config(base_config, contest_config) local result = vim.tbl_deep_extend("force", base_config, contest_config) @@ -80,7 +91,7 @@ local function validate_contest_config(path, contest_config) }) end ----@param user_config cp.Config|nil +---@param user_config cp.PartialConfig|nil ---@return cp.Config function M.setup(user_config) local ok, err = validate_path("config", {