formatter: only Format if buffer doesn't have LSP clients attached
This commit is contained in:
parent
8d5acb64cb
commit
d6de981fae
1 changed files with 5 additions and 2 deletions
3
init.lua
3
init.lua
|
|
@ -166,8 +166,11 @@ local servers = {
|
||||||
-- Auto format on save
|
-- Auto format on save
|
||||||
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||||
callback = function()
|
callback = function()
|
||||||
|
if next(vim.lsp.get_active_clients()) == nil then
|
||||||
cmd("Format")
|
cmd("Format")
|
||||||
|
else
|
||||||
vim.lsp.buf.format({ async = false })
|
vim.lsp.buf.format({ async = false })
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue