fix TSamFailedOnly and the output formatting for the go-runner

This commit is contained in:
2025-12-25 17:27:30 +01:00
parent 1e2e881acd
commit 2c2cb35953
6 changed files with 443 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ local state = {
last_win = nil,
last_buf = nil,
last_command = nil,
last_runner = nil,
last_scope_command = nil,
last_scope_runner = nil,
last_scope_kind = nil,
@@ -57,6 +58,7 @@ function M.setup()
load_runners()
ensure_output_autocmds()
state.last_command = nil
state.last_runner = nil
state.last_scope_command = nil
state.last_scope_runner = nil
state.last_scope_kind = nil
@@ -337,6 +339,7 @@ local function run_command(command, opts)
cmd = vim.deepcopy(command.cmd),
cwd = command.cwd,
}
state.last_runner = options.runner
end
if options.track_scope then
state.last_scope_command = {
@@ -489,7 +492,18 @@ function M.run_last()
cmd = vim.deepcopy(state.last_command.cmd),
cwd = state.last_command.cwd,
}
run_command(command)
local runner = state.last_runner
local parser = nil
if runner then
parser = runner.output_parser
if type(parser) == "function" then
parser = parser()
end
end
run_command(command, {
runner = runner,
output_parser = parser or (runner and runner.parse_results),
})
end
function M.run_nearest()
@@ -642,7 +656,18 @@ function M.run_failed_only()
return
end
run_command(command, { save_last = false })
local runner = state.last_scope_runner
local parser = nil
if runner then
parser = runner.output_parser
if type(parser) == "function" then
parser = parser()
end
end
run_command(command, {
save_last = false,
output_parser = parser or (runner and runner.parse_results),
})
end
function M.show_output()