feat(format): add env option

This commit is contained in:
2025-05-21 00:16:19 +02:00
parent 7fe5d29c74
commit b35e22c560
+3
View File
@@ -165,6 +165,7 @@ end
---@field auto_indent? boolean Perform auto indent on formatted range. False by default. ---@field auto_indent? boolean Perform auto indent on formatted range. False by default.
---@field only_selection? boolean Only send the selected lines to `stdin`. False by default. ---@field only_selection? boolean Only send the selected lines to `stdin`. False by default.
---@field ignore_ret? boolean Ignore non-zero return codes ---@field ignore_ret? boolean Ignore non-zero return codes
---@field env? table<string, string> Map of environment variables
--- Format buffer --- Format buffer
---@param opts FormatOptions ---@param opts FormatOptions
@@ -174,6 +175,7 @@ function M.format(opts)
output = opts.output, output = opts.output,
auto_indent = opts.auto_indent or false, auto_indent = opts.auto_indent or false,
only_selection = opts.only_selection or false, only_selection = opts.only_selection or false,
env = opts.env,
} }
if if
@@ -260,6 +262,7 @@ function M.format(opts)
err = err and err .. e or e err = err and err .. e or e
end end
end, end,
env = opts.env,
}):wait() }):wait()
local tmp_out local tmp_out