refactor(impl): use new runner
This commit is contained in:
parent
2307043fda
commit
55ee6bd9d6
1 changed files with 7 additions and 14 deletions
|
|
@ -64,7 +64,7 @@ function impl.impl(...)
|
||||||
iface = vim.fn.input "impl: generating method stubs for interface: "
|
iface = vim.fn.input "impl: generating method stubs for interface: "
|
||||||
vim.cmd "redraw!"
|
vim.cmd "redraw!"
|
||||||
if iface == "" then
|
if iface == "" then
|
||||||
u.deferred_notify("usage: GoImpl f *File io.Reader", vim.log.levels.INFO)
|
u.notify("usage: GoImpl f *File io.Reader", vim.log.levels.INFO)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
elseif #args == 1 then -- :GoImpl io.Reader
|
elseif #args == 1 then -- :GoImpl io.Reader
|
||||||
|
|
@ -82,21 +82,14 @@ function impl.impl(...)
|
||||||
recv = string.format("%s %s", recv_name, recv)
|
recv = string.format("%s %s", recv_name, recv)
|
||||||
end
|
end
|
||||||
|
|
||||||
local output = r.sync(c.impl, {
|
local rs = r.sync { c.impl, "-dir", vim.fn.fnameescape(vim.fn.expand "%:p:h"), recv, iface }
|
||||||
args = {
|
if rs.code ~= 0 then
|
||||||
"-dir",
|
error("failed to implement interface: " .. rs.stderr)
|
||||||
vim.fn.fnameescape(vim.fn.expand "%:p:h" --[[@as string]]),
|
end
|
||||||
recv,
|
|
||||||
iface,
|
|
||||||
},
|
|
||||||
on_exit = function(data, status)
|
|
||||||
if not status == 0 then
|
|
||||||
error("impl failed: " .. data)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
local pos = vim.fn.getcurpos()[2]
|
local pos = vim.fn.getcurpos()[2]
|
||||||
|
local output = vim.fn.split(rs.stdout, "\n")
|
||||||
|
|
||||||
table.insert(output, 1, "")
|
table.insert(output, 1, "")
|
||||||
vim.fn.append(pos, output)
|
vim.fn.append(pos, output)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue