aboutsummaryrefslogtreecommitdiffstats
path: root/lua/conform/util.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/conform/util.lua')
-rw-r--r--lua/conform/util.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/lua/conform/util.lua b/lua/conform/util.lua
index 8a0073a..bbb711a 100644
--- a/lua/conform/util.lua
+++ b/lua/conform/util.lua
@@ -156,6 +156,17 @@ M.add_formatter_args = function(formatter, extra_args, opts)
end
end
+---@param config conform.FormatterConfig
+---@param override conform.FormatterConfigOverride
+---@return conform.FormatterConfig
+M.merge_formatter_configs = function(config, override)
+ local ret = vim.tbl_deep_extend("force", config, override)
+ if override.prepend_args then
+ M.add_formatter_args(ret, override.prepend_args, { append = false })
+ end
+ return ret
+end
+
---@param bufnr integer
---@return integer
M.buf_get_changedtick = function(bufnr)