mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-21 16:39:06 +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]
|
||||
-- end,
|
||||
-- },
|
||||
shfmt = {
|
||||
extra_args = { "-i", "2", "-ci" },
|
||||
},
|
||||
},
|
||||
},
|
||||
---@param opts ConformOpts
|
||||
config = function(_, opts)
|
||||
local util = require("conform.util")
|
||||
opts.formatters = opts.formatters or {}
|
||||
for name, formatter in pairs(opts.formatters) do
|
||||
if type(formatter) == "table" then
|
||||
|
@ -72,8 +76,13 @@ return {
|
|||
if ok and type(defaults) == "table" then
|
||||
opts.formatters[name] = vim.tbl_deep_extend("force", {}, defaults, formatter)
|
||||
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
|
||||
|
||||
for _, key in ipairs({ "format_on_save", "format_after_save" }) do
|
||||
if opts[key] then
|
||||
Util.warn(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue