refactor(struct_tags): add type annotation, dont force write
This commit is contained in:
parent
0b62f3b419
commit
a047cf2a13
1 changed files with 4 additions and 2 deletions
|
|
@ -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[]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue