mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-23 09:18:51 +02:00
feat(conform): make it easier to add extra_args
This commit is contained in:
parent
873ff89284
commit
3eb91c64b5
1 changed files with 9 additions and 0 deletions
|
@ -61,10 +61,14 @@ return {
|
||||||
-- return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1]
|
-- return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1]
|
||||||
-- end,
|
-- end,
|
||||||
-- },
|
-- },
|
||||||
|
shfmt = {
|
||||||
|
extra_args = { "-i", "2", "-ci" },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
---@param opts ConformOpts
|
---@param opts ConformOpts
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
|
local util = require("conform.util")
|
||||||
opts.formatters = opts.formatters or {}
|
opts.formatters = opts.formatters or {}
|
||||||
for name, formatter in pairs(opts.formatters) do
|
for name, formatter in pairs(opts.formatters) do
|
||||||
if type(formatter) == "table" then
|
if type(formatter) == "table" then
|
||||||
|
@ -72,8 +76,13 @@ return {
|
||||||
if ok and type(defaults) == "table" then
|
if ok and type(defaults) == "table" then
|
||||||
opts.formatters[name] = vim.tbl_deep_extend("force", {}, defaults, formatter)
|
opts.formatters[name] = vim.tbl_deep_extend("force", {}, defaults, formatter)
|
||||||
end
|
end
|
||||||
|
if opts.formatters[name].extra_args then
|
||||||
|
opts.formatters[name].args =
|
||||||
|
util.extend_args(opts.formatters[name].args or {}, opts.formatters[name].extra_args)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, key in ipairs({ "format_on_save", "format_after_save" }) do
|
for _, key in ipairs({ "format_on_save", "format_after_save" }) do
|
||||||
if opts[key] then
|
if opts[key] then
|
||||||
Util.warn(
|
Util.warn(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue