* refactor: move all plugin functionality to init.lua * fix(commands): now it uses correct module paths * refactor(config): change way how it handles options * refactor(gotests): use correct config, change way how deps required, fix some typos * fix(healthchecker): use correct config * refactor(iferr): change api * refactor(impl): change api * refactor(installer): change api * refactor(struct_tags): change way of importting deps * refactor(struct_tags): rename M to struct_tags * run stylua * refactor(dap): make it all in one file, and make some refactoring * refactor(_utils): change way how it organizes * fix: use new _utils api * refactor(_utils.health): reorganize module * refactor(_utils.ts): some renameing, moving requires lines * run stylua
39 lines
698 B
Lua
39 lines
698 B
Lua
local utils = {}
|
|
|
|
---@param t table
|
|
---@return boolean
|
|
function utils.is_tbl_empty(t)
|
|
if t == nil then
|
|
return true
|
|
end
|
|
return next(t) == nil
|
|
end
|
|
|
|
---@param s string
|
|
---@return string
|
|
function utils.rtrim(s)
|
|
local n = #s
|
|
while n > 0 and s:find("^%s", n) do
|
|
n = n - 1
|
|
end
|
|
|
|
return s:sub(1, n)
|
|
end
|
|
|
|
---@param msg string
|
|
---@param lvl any
|
|
function utils.deferred_notify(msg, lvl)
|
|
vim.defer_fn(function()
|
|
vim.notify(msg, lvl)
|
|
end, 0)
|
|
end
|
|
|
|
-- safe require
|
|
---@param module string module name
|
|
function utils.sreq(module)
|
|
local ok, m = pcall(require, module)
|
|
assert(ok, string.format("gopher.nvim dependency error: %s not installed", module))
|
|
return m
|
|
end
|
|
|
|
return utils
|