From 6d87646eafaee39c849caaf1d3657425c413bb48 Mon Sep 17 00:00:00 2001 From: Lander Van den Bulcke Date: Sun, 19 Oct 2025 19:51:13 +0200 Subject: [PATCH] fix: conform format on save Signed-off-by: Lander Van den Bulcke --- plugins/lsp/conform.nix | 38 ++++++-------------------------------- 1 file changed, 6 insertions(+), 32 deletions(-) diff --git a/plugins/lsp/conform.nix b/plugins/lsp/conform.nix index 2ec836e..7c0fb4a 100644 --- a/plugins/lsp/conform.nix +++ b/plugins/lsp/conform.nix @@ -8,39 +8,13 @@ default_format_opts.lsp_format = "prefer"; notify_on_error = true; - format_on_save = '' - function(bufnr) - if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then - return - end + format_on_save = { + lsp_format = "prefer"; + }; - if slow_format_filetypes[vim.bo[bufnr].filetype] then - return - end - - local function on_format(err) - if err and err:match("timeout$") then - slow_format_filetypes[vim.bo[bufnr].filetype] = true - end - end - - return { timeout_ms = 200, lsp_fallback = true }, on_format - end - ''; - - format_after_save = '' - function(bufnr) - if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then - return - end - - if not slow_format_filetypes[vim.bo[bufnr].filetype] then - return - end - - return { lsp_fallback = true } - end - ''; + format_after_save = { + lsp_format = "prefer"; + }; formatters_by_ft = { "_" = [