From 1022b2115bdb9f0424635448014bc664357620bd Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Wed, 21 May 2025 00:17:23 +0200 Subject: [PATCH] feat(format): add ignore_stderr option --- lua/ow/utils.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/ow/utils.lua b/lua/ow/utils.lua index efbcb22..a02bd8e 100644 --- a/lua/ow/utils.lua +++ b/lua/ow/utils.lua @@ -165,6 +165,7 @@ end ---@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 ignore_ret? boolean Ignore non-zero return codes +---@field ignore_stderr? boolean Ignore stderr output when not using stderr for output ---@field env? table Map of environment variables --- Format buffer @@ -175,6 +176,7 @@ function M.format(opts) output = opts.output, auto_indent = opts.auto_indent or false, only_selection = opts.only_selection or false, + ignore_stderr = opts.ignore_stderr, env = opts.env, } @@ -253,7 +255,7 @@ function M.format(opts) err = err and err .. e or e end end, - stderr = function(e, data) + stderr = not opts.ignore_stderr and function(e, data) if data then stderr = stderr and stderr .. data or data end