refactor: use vim.system instead of pleanry (#85)

* refactor!: migrate to vim.system

* refactor(gotests): use vim.system

* refactor(iferr): use vim.system

* refactor(impl): use vim.system

* refactor(installer): use vim.system and add sync mode

* test: fix gotests' tests

* refactor(struct_tags): use vim.system

* chore(ci): install all deps explicitly

* refactor(installer)!: add sync as an option

* docs: update readme
This commit is contained in:
Smirnov Oleksandr 2025-03-02 16:31:50 +02:00 committed by GitHub
parent 837897a79d
commit 6016ca57d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 169 additions and 126 deletions

View file

@ -43,7 +43,7 @@ local impl = {}
local function get_struct()
local ns = ts_utils.get_struct_node_at_pos(unpack(vim.api.nvim_win_get_cursor(0)))
if ns == nil then
u.deferred_notify("put cursor on a struct or specify a receiver", vim.log.levels.INFO)
u.notify "put cursor on a struct or specify a receiver"
return ""
end
@ -82,21 +82,14 @@ function impl.impl(...)
recv = string.format("%s %s", recv_name, recv)
end
local output = r.sync(c.impl, {
args = {
"-dir",
vim.fn.fnameescape(vim.fn.expand "%:p:h" --[[@as string]]),
recv,
iface,
},
on_exit = function(data, status)
if not status == 0 then
error("impl failed: " .. data)
end
end,
})
local rs = r.sync { c.impl, "-dir", vim.fn.fnameescape(vim.fn.expand "%:p:h"), recv, iface }
if rs.code ~= 0 then
error("failed to implement interface: " .. rs.stderr)
end
local pos = vim.fn.getcurpos()[2]
local output = u.remove_empty_lines(vim.split(rs.stdout, "\n"))
table.insert(output, 1, "")
vim.fn.append(pos, output)
end