mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-30 12:34:37 +02:00
fix(conform): allow overriding all conform format options. Fixes #1790
This commit is contained in:
parent
98b51a608c
commit
ea3155aef6
1 changed files with 4 additions and 9 deletions
|
@ -2,9 +2,6 @@ local Util = require("lazyvim.util")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
---@type ConformOpts
|
|
||||||
local conform_opts = {}
|
|
||||||
|
|
||||||
---@param opts ConformOpts
|
---@param opts ConformOpts
|
||||||
function M.setup(_, opts)
|
function M.setup(_, opts)
|
||||||
for name, formatter in pairs(opts.formatters or {}) do
|
for name, formatter in pairs(opts.formatters or {}) do
|
||||||
|
@ -29,7 +26,6 @@ function M.setup(_, opts)
|
||||||
opts[key] = nil
|
opts[key] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
conform_opts = opts
|
|
||||||
require("conform").setup(opts)
|
require("conform").setup(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -57,11 +53,10 @@ return {
|
||||||
priority = 100,
|
priority = 100,
|
||||||
primary = true,
|
primary = true,
|
||||||
format = function(buf)
|
format = function(buf)
|
||||||
require("conform").format(Util.merge({
|
local plugin = require("lazy.core.config").plugins["conform.nvim"]
|
||||||
timeout_ms = conform_opts.format.timeout_ms,
|
local Plugin = require("lazy.core.plugin")
|
||||||
async = conform_opts.format.async,
|
local opts = Plugin.values(plugin, "opts", false)
|
||||||
quiet = conform_opts.format.quiet,
|
require("conform").format(Util.merge(opts.format, { bufnr = buf }))
|
||||||
}, { bufnr = buf }))
|
|
||||||
end,
|
end,
|
||||||
sources = function(buf)
|
sources = function(buf)
|
||||||
local ret = require("conform").list_formatters(buf)
|
local ret = require("conform").list_formatters(buf)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue