1
0
Fork 0

formatter: only Format if buffer doesn't have LSP clients attached

This commit is contained in:
Felipe 2023-04-17 22:40:25 -04:00
parent 8d5acb64cb
commit d6de981fae
Signed by: pitbuster
SSH key fingerprint: SHA256:HDYu2Pm4/TmSX8GBwV49UvFWr1Ljg8XlHxKeCpjJpOk

View file

@ -166,8 +166,11 @@ local servers = {
-- Auto format on save
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
callback = function()
if next(vim.lsp.get_active_clients()) == nil then
cmd("Format")
else
vim.lsp.buf.format({ async = false })
end
end,
})