feat(struct_tags): add :GoTagClear
This commit is contained in:
parent
10abcb661e
commit
07f86d669b
6 changed files with 50 additions and 5 deletions
|
|
@ -43,6 +43,7 @@ gopher.comment = require("gopher.comment").comment
|
|||
gopher.tags = {
|
||||
add = tags.add,
|
||||
rm = tags.remove,
|
||||
clear = tags.clear,
|
||||
}
|
||||
|
||||
gopher.test = {
|
||||
|
|
|
|||
|
|
@ -89,7 +89,8 @@ local function handler_user_args(args)
|
|||
return res
|
||||
end
|
||||
|
||||
-- add tags to struct under cursor
|
||||
---Adds tags to a struct under the cursor
|
||||
---@param ... string Tags to add to the struct fields. If not provided, it will use [config.tag.default_tag]
|
||||
function struct_tags.add(...)
|
||||
local args = { ... }
|
||||
local fpath = vim.fn.expand "%"
|
||||
|
|
@ -101,7 +102,8 @@ function struct_tags.add(...)
|
|||
handle_tags(fpath, bufnr, user_args)
|
||||
end
|
||||
|
||||
-- remove tags to struct under cursor
|
||||
---Removes tags from a struct under the cursor
|
||||
---@param ... string Tags to add to the struct fields. If not provided, it will use [config.tag.default_tag]
|
||||
function struct_tags.remove(...)
|
||||
local args = { ... }
|
||||
local fpath = vim.fn.expand "%"
|
||||
|
|
@ -113,4 +115,11 @@ function struct_tags.remove(...)
|
|||
handle_tags(fpath, bufnr, user_args)
|
||||
end
|
||||
|
||||
---Removes all tags from a struct under the cursor
|
||||
function struct_tags.clear()
|
||||
local fpath = vim.fn.expand "%"
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
handle_tags(fpath, bufnr, { "-clear-tags" })
|
||||
end
|
||||
|
||||
return struct_tags
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue