+1
lua/gopher/config.lua
+1
lua/gopher/config.lua
···
84
84
vim.validate {
85
85
log_level = { _config.log_level, "number" },
86
86
timeout = { _config.timeout, "number" },
87
+
installer_timeout = { _config.installer_timeout, "number" },
87
88
["commands"] = { _config.commands, "table" },
88
89
["commands.go"] = { _config.commands.go, "string" },
89
90
["commands.gomodifytags"] = { _config.commands.gomodifytags, "string" },
+9
-2
lua/gopher/impl.lua
+9
-2
lua/gopher/impl.lua
···
44
44
local iface, recv = "", ""
45
45
local bufnr = vim.api.nvim_get_current_buf()
46
46
47
-
if #args == 1 then -- :GoImpl io.Reader
47
+
if #args == 0 then
48
+
u.notify("arguments not provided. usage: :GoImpl f *File io.Reader", vim.log.levels.ERROR)
49
+
return
50
+
elseif #args == 1 then -- :GoImpl io.Reader
48
51
local st = ts_utils.get_struct_under_cursor(bufnr)
49
52
iface = args[1]
50
53
recv = string.lower(st.name) .. " *" .. st.name
···
57
60
iface = args[3]
58
61
end
59
62
60
-
local rs = r.sync { c.impl, "-dir", vim.fn.fnameescape(vim.fn.expand "%:p:h"), recv, iface }
63
+
assert(iface ~= "", "interface not provided")
64
+
assert(recv ~= "", "receiver not provided")
65
+
66
+
local dir = vim.fn.fnameescape(vim.fn.expand "%:p:h")
67
+
local rs = r.sync { c.impl, "-dir", dir, recv, iface }
61
68
if rs.code ~= 0 then
62
69
error("failed to implement interface: " .. rs.stderr)
63
70
end