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

@ -89,6 +89,10 @@ to install them synchronously pass `{sync = true}` as an argument.
-- 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
@ -124,6 +128,9 @@ How to add/remove tags to struct fields:
2. Run `:GoTagAdd json` to add json tags to struct fields
3. Run `:GoTagRm json` to remove json tags to struct fields
If you want to add/remove tag with options, you can use `json=omitempty` (where json is tag, and omitempty is its option).
Example: `:GoTagAdd xml json=omitempty`
To clear all tags from struct run: `:GoTagClear`
NOTE: if you dont specify the tag it will use `json` as default