Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
feat(nvim): restart golang_ci_lint on GoModTydi too
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed Nov 17, 2022
1 parent 018b6ff commit 436d520
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions nvim/config/after/ftplugin/go.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
vim.opt_local.formatoptions:append("jno")

local function restart()
local function restart(name)
local configs = require("lspconfig.configs")
local bufnr = vim.api.nvim_get_current_buf()
for _, client in
ipairs(vim.lsp.get_active_clients({
bufnr = bufnr,
name = "gopls",
name = name,
}))
do
vim.notify("restarting gopls...")
vim.notify("Restarting " .. client.name .. "...")
client.stop()
-- clear the codelens et al
vim.api.nvim_buf_clear_namespace(bufnr, -1, 0, -1)
Expand All @@ -20,7 +20,7 @@ local function restart()
end

local function tidy()
vim.notify("running go mod tidy...")
vim.notify("Running `go mod tidy`...")
local uv = vim.loop
local stdout = uv.new_pipe(false)
local stderr = uv.new_pipe(false)
Expand Down Expand Up @@ -51,7 +51,9 @@ local function tidy()
stderr:close()
handle:close()
vim.schedule(function()
restart()
for _, name in ipairs({ "gopls", "golangci_lint_ls" }) do
restart(name)
end
end)
end)
)
Expand Down

0 comments on commit 436d520

Please sign in to comment.