neovim: update on-save triggers for go

This commit is contained in:
Gabriel Augendre 2024-02-19 20:40:28 +01:00
parent e2e612fc9c
commit ab9f724c28

View file

@ -4,8 +4,8 @@ local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
local opts = { local opts = {
sources = { -- run these on save sources = { -- run these on save
null_ls.builtins.formatting.gofumpt, null_ls.builtins.formatting.gofumpt,
null_ls.builtins.formatting.goimports_reviser, null_ls.builtins.formatting.goimports,
null_ls.builtins.formatting.golines, null_ls.builtins.diagnostics.golangci_lint,
}, },
on_attach = function (client, bufnr) on_attach = function (client, bufnr)
if client.supports_method("textDocument/formatting") then if client.supports_method("textDocument/formatting") then
@ -17,7 +17,7 @@ local opts = {
group = augroup, group = augroup,
buffer = bufnr, buffer = bufnr,
callback = function() callback = function()
vim.lsp.buf.format({bufnr = bufnr}) vim.lsp.buf.format({ async = false })
end, end,
}) })
end end