+1
.envrc
+1
.envrc
-10
.luarc.json
-10
.luarc.json
-12
lua/gopher/_utils/init.lua
-12
lua/gopher/_utils/init.lua
···
4
4
5
5
---@param msg string
6
6
---@param lvl? number
7
-
function utils.deferred_notify(msg, lvl)
8
-
lvl = lvl or vim.log.levels.INFO
9
-
vim.defer_fn(function()
10
-
vim.notify(msg, lvl, {
11
-
title = c.___plugin_name,
12
-
})
13
-
log.debug(msg)
14
-
end, 0)
15
-
end
16
-
17
-
---@param msg string
18
-
---@param lvl? number
19
7
function utils.notify(msg, lvl)
20
8
lvl = lvl or vim.log.levels.INFO
21
9
vim.notify(msg, lvl, {
lua/gopher/_utils/runner/gocmd.lua
lua/gopher/_utils/gocmd.lua
lua/gopher/_utils/runner/gocmd.lua
lua/gopher/_utils/gocmd.lua
lua/gopher/_utils/runner/init.lua
lua/gopher/_utils/runner.lua
lua/gopher/_utils/runner/init.lua
lua/gopher/_utils/runner.lua
+1
-1
lua/gopher/init.lua
+1
-1
lua/gopher/init.lua
···
12
12
local log = require "gopher._utils.log"
13
13
local tags = require "gopher.struct_tags"
14
14
local tests = require "gopher.gotests"
15
-
local gocmd = require("gopher._utils.runner.gocmd").run
15
+
local gocmd = require("gopher._utils.gocmd").run
16
16
local gopher = {}
17
17
18
18
---@toc_entry Setup
+8
-3
lua/gopher/installer.lua
+8
-3
lua/gopher/installer.lua
···
15
15
---@param url string
16
16
local function handle_intall_exit(opt, url)
17
17
if opt.code ~= 0 then
18
-
u.deferred_notify("go install failed: " .. url)
18
+
vim.schedule(function()
19
+
u.notify("go install failed: " .. url)
20
+
end)
21
+
19
22
log.error("go install failed:", "url", url, "opt", vim.inspect(opt))
20
23
return
21
24
end
22
25
23
-
u.deferred_notify("go install-ed: " .. url)
26
+
vim.schedule(function()
27
+
u.notify("go install-ed: " .. url)
28
+
end)
24
29
end
25
30
26
31
---@param url string
···
40
45
---@param opts? {sync:boolean}
41
46
function installer.install_deps(opts)
42
47
opts = opts or {}
43
-
for url, _ in pairs(urls) do
48
+
for _, url in pairs(urls) do
44
49
if opts.sync then
45
50
install_sync(url)
46
51
else
+29
spec/unit/utils_test.lua
+29
spec/unit/utils_test.lua
···
1
+
local t = require "spec.testutils"
2
+
local child = MiniTest.new_child_neovim()
3
+
local T = MiniTest.new_set {
4
+
hooks = {
5
+
post_once = child.stop,
6
+
pre_case = function()
7
+
child.restart { "-u", t.mininit_path }
8
+
end,
9
+
},
10
+
}
11
+
12
+
T["utils"] = MiniTest.new_set()
13
+
T["utils"]["should .remove_empty_lines()"] = function()
14
+
local u = require "gopher._utils"
15
+
local inp = { "hi", "", "a", "", "", "asdf" }
16
+
17
+
t.eq(u.remove_empty_lines(inp), { "hi", "a", "asdf" })
18
+
end
19
+
20
+
T["utils"]["should .readfile_joined()"] = function()
21
+
local data = "line1\nline2\nline3"
22
+
local tmp = t.tmpfile()
23
+
local u = require "gopher._utils"
24
+
25
+
t.writefile(tmp, data)
26
+
t.eq(u.readfile_joined(tmp), data)
27
+
end
28
+
29
+
return T