all repos

gopher.nvim @ a993ece59fcac975f811363dc22ec46e76401415

Minimalistic plugin for Go development
1 files changed, 24 insertions(+), 1 deletions(-)
feat(config): vim.validate all config after setup (#98)

Author: Smirnov Oleksandr ss2316544@gmail.com
Committed by: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2025-03-22 21:19:59 +0200
Parent: 6ee261c
M lua/gopher/config.lua

@@ -90,7 +90,30 @@

---@param user_config? gopher.Config ---@private function config.setup(user_config) - _config = vim.tbl_deep_extend("force", default_config, user_config or {}) + vim.validate { user_config = { user_config, "table", true } } + + _config = vim.tbl_deep_extend("force", vim.deepcopy(default_config), user_config or {}) + + vim.validate { + log_level = { _config.log_level, "number" }, + timeout = { _config.timeout, "number" }, + setup_commands = { _config.setup_commands, "boolean" }, + ["commands"] = { _config.commands, "table" }, + ["commands.go"] = { _config.commands.go, "string" }, + ["commands.gomodifytags"] = { _config.commands.gomodifytags, "string" }, + ["commands.gotests"] = { _config.commands.gotests, "string" }, + ["commands.impl"] = { _config.commands.impl, "string" }, + ["commands.iferr"] = { _config.commands.iferr, "string" }, + ["gotests"] = { _config.gotests, "table" }, + ["gotests.template"] = { _config.gotests.template, "string" }, + ["gotests.template_dir"] = { _config.gotests.template, "string", true }, + ["gotests.named"] = { _config.gotests.named, "boolean" }, + ["gotag"] = { _config.gotag, "table" }, + ["gotag.transform"] = { _config.gotag.transform, "string" }, + ["gotag.default_tag"] = { _config.gotag.default_tag, "string" }, + ["iferr"] = { _config.iferr, "table" }, + ["iferr.message"] = { _config.iferr.message, "string", true }, + } end ---@return boolean