-3
README.md
-3
README.md
···
219
219
-- timeout for running installer commands(e.g :GoDepsInstall, :GoDepsInstallSync)
220
220
installer_timeout = 999999,
221
221
222
-
-- restart gopls server after commands like `:GoMod`, `:GoGet`, `:GoWork`
223
-
restart_lsp = false,
224
-
225
222
-- user specified paths to binaries
226
223
commands = {
227
224
go = "go",
-3
doc/gopher.nvim.txt
-3
doc/gopher.nvim.txt
-11
lua/gopher/_utils/lsp.lua
-11
lua/gopher/_utils/lsp.lua
-4
lua/gopher/config.lua
-4
lua/gopher/config.lua
···
33
33
---@type number
34
34
installer_timeout = 999999,
35
35
36
-
-- restart gopls server after commands like `:GoMod`, `:GoGet`, `:GoWork`
37
-
restart_lsp = false,
38
-
39
36
-- user specified paths to binaries
40
37
---@class gopher.ConfigCommand
41
38
commands = {
···
101
98
vim.validate("log_level", _config.log_level, "number")
102
99
vim.validate("timeout", _config.timeout, "number")
103
100
vim.validate("installer_timeout", _config.timeout, "number")
104
-
vim.validate("restart_lsp", _config.restart_lsp, "boolean")
105
101
vim.validate("commands", _config.commands, "table")
106
102
vim.validate("commands.go", _config.commands.go, "string")
107
103
vim.validate("commands.gomodifytags", _config.commands.gomodifytags, "string")
-10
lua/gopher/go.lua
-10
lua/gopher/go.lua
···
1
1
local c = require "gopher.config"
2
2
local u = require "gopher._utils"
3
-
local lsp = require "gopher._utils.lsp"
4
3
local r = require "gopher._utils.runner"
5
4
local go = {}
6
5
···
14
13
return rs.stdout
15
14
end
16
15
17
-
local function restart_lsp()
18
-
if c.restart_lsp then
19
-
lsp.restart()
20
-
end
21
-
end
22
-
23
16
---@param args string[]
24
17
function go.get(args)
25
18
for i, arg in ipairs(args) do
···
29
22
end
30
23
31
24
run("get", args)
32
-
restart_lsp()
33
25
end
34
26
35
27
---@param args string[]
36
28
function go.mod(args)
37
29
run("mod", args)
38
-
restart_lsp()
39
30
end
40
31
41
32
---@param args string[]
···
43
34
-- TODO: use `gopls.tidy`
44
35
45
36
run("work", args)
46
-
restart_lsp()
47
37
end
48
38
49
39
---Executes `go generate`