feat(strct-tags): add support for tag options (#126)

* feat(struct_tags): add options support

* refactor(struct-tags): give input field better name

* feat(struct-tag): add default option

* refactor: make it work on neovim version below 0.12

* chore(struct-tags): update the demo

* refactor: unite struct_tags util with main logic
This commit is contained in:
Oleksandr Smirnov 2025-10-30 12:25:42 +02:00
parent 0de1892ca9
commit 7a18d9f7bd
No known key found for this signature in database
19 changed files with 301 additions and 15 deletions

View file

@ -61,6 +61,10 @@ local default_config = {
-- default tags to add to struct fields
default_tag = "json",
-- default tag option added struct fields, set to nil to disable
---@type string|nil
option = nil,
},
iferr = {
-- choose a custom error message
@ -105,6 +109,7 @@ function config.setup(user_config)
vim.validate("gotag", _config.gotag, "table")
vim.validate("gotag.transform", _config.gotag.transform, "string")
vim.validate("gotag.default_tag", _config.gotag.default_tag, "string")
vim.validate("gotag.option", _config.gotag.option, { "string", "nil" })
vim.validate("iferr", _config.iferr, "table")
vim.validate("iferr.message", _config.iferr.message, { "string", "nil" })
end