[mirror] Make your go dev experience better github.com/olexsmir/gopher.nvim
neovim golang

revert: automatically restart lsp server (#128)

semi revert of 7c198a1b3673a29e95ffed41c297933ba8467fee

authored by olexsmir.xyz and committed by GitHub 7764f6e3 f599e759

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