From b450ff95c7502fd0c681cc7654f03330e2b4046a Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Fri, 28 Mar 2025 18:45:53 +0100 Subject: [PATCH] feat(format): allow ignoring non-zero exit codes --- lua/utils.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/utils.lua b/lua/utils.lua index f543c7e..8bc7eb8 100644 --- a/lua/utils.lua +++ b/lua/utils.lua @@ -161,6 +161,7 @@ end ---@field output OutputStream What stream to use as the result. May be one of `stdout` or `stderr`. ---@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 --- Format buffer ---@param opts FormatOptions @@ -250,8 +251,7 @@ function M.format(opts) end if - resp.code ~= 0 - or resp.signal ~= 0 + not opts.ignore_ret and (resp.code ~= 0 or resp.signal ~= 0) or (opts.output ~= "stderr" and stderr) then local msg