From ea3155aef6d47e744cb2b4a7a3b567288d780f8d Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 19 Oct 2023 07:52:45 +0200 Subject: [PATCH] fix(conform): allow overriding all conform format options. Fixes #1790 --- lua/lazyvim/plugins/formatting.lua | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lua/lazyvim/plugins/formatting.lua b/lua/lazyvim/plugins/formatting.lua index 6d8c9bc7..eb2dd1a8 100644 --- a/lua/lazyvim/plugins/formatting.lua +++ b/lua/lazyvim/plugins/formatting.lua @@ -2,9 +2,6 @@ local Util = require("lazyvim.util") local M = {} ----@type ConformOpts -local conform_opts = {} - ---@param opts ConformOpts function M.setup(_, opts) for name, formatter in pairs(opts.formatters or {}) do @@ -29,7 +26,6 @@ function M.setup(_, opts) opts[key] = nil end end - conform_opts = opts require("conform").setup(opts) end @@ -57,11 +53,10 @@ return { priority = 100, primary = true, format = function(buf) - require("conform").format(Util.merge({ - timeout_ms = conform_opts.format.timeout_ms, - async = conform_opts.format.async, - quiet = conform_opts.format.quiet, - }, { bufnr = buf })) + local plugin = require("lazy.core.config").plugins["conform.nvim"] + local Plugin = require("lazy.core.plugin") + local opts = Plugin.values(plugin, "opts", false) + require("conform").format(Util.merge(opts.format, { bufnr = buf })) end, sources = function(buf) local ret = require("conform").list_formatters(buf)