refactor: commands runner (#42)

* feat(utils): first impl of own commands runner

* refactor(gotests): uses own runner instead of vendored

* refactor(utils): back to plenary.job

* refactor(gotests): use new runner, clean code

* fix(runner): now it returns output correctly

* refactor(iferr): use vim.system

i have tried to use _utils.runner, but i can't figure out how to make `< file.go` for the command

* refactor(impl): use new runner

* refactor(installer): use new runner

* refactor(struct_tags): use new runner

* refactor: commands such as :GoGet runs with new runner

* refactor: throw errors in more lua way, i think

* refactor(utils): notify now has title

* refactor: use more correct way of notifying

* refactor(runner): write error message on error
This commit is contained in:
Smirnov Oleksandr 2023-08-10 12:04:33 +03:00
parent 011769b99b
commit 2e89cea6f3
11 changed files with 163 additions and 178 deletions

View file

@ -1,5 +1,7 @@
local utils = {}
local TITLE = "gopher.nvim"
---@param t table
---@return boolean
function utils.is_tbl_empty(t)
@ -10,13 +12,24 @@ function utils.is_tbl_empty(t)
end
---@param msg string
---@param lvl any
---@param lvl number
function utils.deferred_notify(msg, lvl)
vim.defer_fn(function()
vim.notify(msg, lvl)
vim.notify(msg, lvl, {
title = TITLE,
})
end, 0)
end
---@param msg string
---@param lvl? number
function utils.notify(msg, lvl)
lvl = lvl or vim.log.levels.INFO
vim.notify(msg, lvl, {
title = TITLE,
})
end
-- safe require
---@param module string module name
function utils.sreq(module)