diff --git a/lua/lazyvim/plugins/formatting.lua b/lua/lazyvim/plugins/formatting.lua index f4160b4d..ae32c0ef 100644 --- a/lua/lazyvim/plugins/formatting.lua +++ b/lua/lazyvim/plugins/formatting.lua @@ -1,6 +1,6 @@ local M = {} ----@param opts ConformOpts +---@param opts conform.setupOpts function M.setup(_, opts) for _, key in ipairs({ "format_on_save", "format_after_save" }) do if opts[key] then @@ -10,6 +10,10 @@ function M.setup(_, opts) opts[key] = nil end end + ---@diagnostic disable-next-line: undefined-field + if opts.format then + LazyVim.warn("**conform.nvim** `opts.format` is deprecated. Please use `opts.default_format_opts` instead.") + end require("conform").setup(opts) end @@ -37,8 +41,7 @@ return { priority = 100, primary = true, format = function(buf) - local opts = LazyVim.opts("conform.nvim") - require("conform").format(LazyVim.merge({}, opts.format, { bufnr = buf })) + require("conform").format({ bufnr = buf }) end, sources = function(buf) local ret = require("conform").list_formatters(buf) @@ -59,16 +62,14 @@ return { "Please refer to the docs at https://www.lazyvim.org/plugins/formatting", }, { title = "LazyVim" }) end - ---@class ConformOpts + ---@type conform.setupOpts local opts = { - -- LazyVim will use these options when formatting with the conform.nvim formatter - format = { + default_format_opts = { timeout_ms = 3000, async = false, -- not recommended to change quiet = false, -- not recommended to change lsp_format = "fallback", -- not recommended to change }, - ---@type table formatters_by_ft = { lua = { "stylua" }, fish = { "fish_indent" },