refactor(struct_tags): add type annotation, dont force write

This commit is contained in:
Oleksandr Smirnov 2025-03-19 17:59:45 +02:00
parent 0b62f3b419
commit a047cf2a13
No known key found for this signature in database

View file

@ -32,6 +32,9 @@ local c = require "gopher.config"
local log = require "gopher._utils.log" local log = require "gopher._utils.log"
local struct_tags = {} local struct_tags = {}
---@param fpath string
---@param bufnr integer
---@param user_args string[]
local function handle_tags(fpath, bufnr, user_args) local function handle_tags(fpath, bufnr, user_args)
local st = ts.get_struct_under_cursor(bufnr) local st = ts.get_struct_under_cursor(bufnr)
@ -52,7 +55,7 @@ local function handle_tags(fpath, bufnr, user_args)
local rs = r.sync(cmd) local rs = r.sync(cmd)
if rs.code ~= 0 then if rs.code ~= 0 then
log.error("tags: failed to set tags " .. rs.stderr) log.error("tags: failed to set tags " .. rs.stderr)
error("failed to set tags " .. rs.stdout) error("failed to set tags " .. rs.stderr)
end end
local res = vim.json.decode(rs.stdout) local res = vim.json.decode(rs.stdout)
@ -73,7 +76,6 @@ local function handle_tags(fpath, bufnr, user_args)
true, true,
res["lines"] res["lines"]
) )
vim.cmd "write"
end end
---@param args string[] ---@param args string[]