From d6de981fae108c03c638ae58250c66e5f3556cb0 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Salinas Date: Mon, 17 Apr 2023 22:40:25 -0400 Subject: [PATCH] formatter: only Format if buffer doesn't have LSP clients attached --- init.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 1cd69a1..faaeb94 100644 --- a/init.lua +++ b/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, })