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
7
init.lua
7
init.lua
|
|
@ -166,8 +166,11 @@ local servers = {
|
|||
-- Auto format on save
|
||||
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||
callback = function()
|
||||
cmd("Format")
|
||||
vim.lsp.buf.format({ async = false })
|
||||
if next(vim.lsp.get_active_clients()) == nil then
|
||||
cmd("Format")
|
||||
else
|
||||
vim.lsp.buf.format({ async = false })
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue