From 0a1cea9b434dbeb0bee3e05e7c5aba16049442d5 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 27 Jan 2026 17:25:03 -0500 Subject: [PATCH 1/4] feat: debug --- lua/cp/config.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/cp/config.lua b/lua/cp/config.lua index ca5b027..ab99b50 100644 --- a/lua/cp/config.lua +++ b/lua/cp/config.lua @@ -305,6 +305,7 @@ function M.setup(user_config) vim.validate({ hooks = { cfg.hooks, { 'table' } }, ui = { cfg.ui, { 'table' } }, + debug = { cfg.debug, { 'boolean', 'nil' }, true }, open_url = { cfg.open_url, { 'boolean', 'nil' }, true }, before_run = { cfg.hooks.before_run, { 'function', 'nil' }, true }, before_debug = { cfg.hooks.before_debug, { 'function', 'nil' }, true }, From 3f677137de2de028c9d3fe52f230f76e418f93ac Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 27 Jan 2026 17:27:15 -0500 Subject: [PATCH 2/4] fix(config): one of validation --- lua/cp/config.lua | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/lua/cp/config.lua b/lua/cp/config.lua index ab99b50..e77b5a9 100644 --- a/lua/cp/config.lua +++ b/lua/cp/config.lua @@ -315,25 +315,23 @@ function M.setup(user_config) }) local layouts = require('cp.ui.layouts') - local valid_modes_str = table.concat(vim.tbl_keys(layouts.DIFF_MODES), ',') - if type(cfg.ui.panel.diff_modes) == 'table' then - local invalid = {} - for _, mode in ipairs(cfg.ui.panel.diff_modes) do - if not layouts.DIFF_MODES[mode] then - table.insert(invalid, mode) - end - end - if #invalid > 0 then - error( - ('invalid diff modes [%s] - must be one of: {%s}'):format( - table.concat(invalid, ','), - valid_modes_str - ) - ) - end - end vim.validate({ ansi = { cfg.ui.ansi, 'boolean' }, + diff_modes = { + cfg.ui.panel.diff_modes, + function(v) + if type(v) ~= 'table' then + return false + end + for _, mode in ipairs(v) do + if not layouts.DIFF_MODES[mode] then + return false + end + end + return true + end, + ('one of {%s}'):format(table.concat(vim.tbl_keys(layouts.DIFF_MODES), ',')), + }, max_output_lines = { cfg.ui.panel.max_output_lines, function(v) From 383b327442d4b1394a1620121400573e8bc29c87 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 27 Jan 2026 17:32:21 -0500 Subject: [PATCH 3/4] fix(config): validate scraper names better --- lua/cp/config.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lua/cp/config.lua b/lua/cp/config.lua index e77b5a9..4679301 100644 --- a/lua/cp/config.lua +++ b/lua/cp/config.lua @@ -307,6 +307,22 @@ function M.setup(user_config) ui = { cfg.ui, { 'table' } }, debug = { cfg.debug, { 'boolean', 'nil' }, true }, open_url = { cfg.open_url, { 'boolean', 'nil' }, true }, + filename = { cfg.filename, { 'function', 'nil' }, true }, + scrapers = { + cfg.scrapers, + function(v) + if type(v) ~= 'table' then + return false + end + for _, s in ipairs(v) do + if not vim.tbl_contains(constants.PLATFORMS, s) then + return false + end + end + return true + end, + ('one of {%s}'):format(table.concat(constants.PLATFORMS, ',')), + }, before_run = { cfg.hooks.before_run, { 'function', 'nil' }, true }, before_debug = { cfg.hooks.before_debug, { 'function', 'nil' }, true }, setup_code = { cfg.hooks.setup_code, { 'function', 'nil' }, true }, @@ -340,6 +356,14 @@ function M.setup(user_config) 'positive integer', }, git = { cfg.ui.diff.git, { 'table' } }, + git_args = { cfg.ui.diff.git.args, is_string_list, 'string[]' }, + width = { + cfg.ui.run.width, + function(v) + return type(v) == 'number' and v > 0 and v <= 1 + end, + 'number/decimal between 0 and 1', + }, next_test_key = { cfg.ui.run.next_test_key, function(v) From d496509fce77440b6cde47d26957d85871beb18c Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 27 Jan 2026 17:33:16 -0500 Subject: [PATCH 4/4] feat(config): improve config parsing phrasing --- lua/cp/config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/cp/config.lua b/lua/cp/config.lua index 4679301..dec8878 100644 --- a/lua/cp/config.lua +++ b/lua/cp/config.lua @@ -362,7 +362,7 @@ function M.setup(user_config) function(v) return type(v) == 'number' and v > 0 and v <= 1 end, - 'number/decimal between 0 and 1', + 'decimal between 0 and 1', }, next_test_key = { cfg.ui.run.next_test_key,