fix quickfix-list filling for TSamFailedOnly

This commit is contained in:
2026-01-03 15:19:35 +01:00
parent 6505a91cce
commit 1d9b682a58
2 changed files with 133 additions and 1 deletions

View File

@@ -1830,6 +1830,7 @@ local function run_command(command, opts)
end
local items = {}
local failures_for_qf = failures
local fallback_failures = options.qf_fallback_failures
if options.track_scope and type(state.last_scope_failures) == "table" then
local merged = {}
local seen = {}
@@ -1865,8 +1866,20 @@ local function run_command(command, opts)
end
failures_for_qf = merged
end
if (not failures_for_qf or #failures_for_qf == 0) and type(fallback_failures) == "table" then
local merged = {}
local seen = {}
for _, name in ipairs(fallback_failures) do
if name and not seen[name] then
seen[name] = true
table.insert(merged, name)
end
end
failures_for_qf = merged
end
if #failures_for_qf > 0 and runner and type(runner.collect_failed_locations) == "function" then
local ok_collect, collected = pcall(runner.collect_failed_locations, failures_for_qf, command, options.scope_kind)
local scope_kind = options.qf_scope_kind or options.scope_kind
local ok_collect, collected = pcall(runner.collect_failed_locations, failures_for_qf, command, scope_kind)
if ok_collect and type(collected) == "table" then
items = collected
end
@@ -2066,7 +2079,10 @@ function M.run_failed_only()
end
run_command(command, {
save_last = false,
runner = runner,
output_parser = parser or (runner and runner.parse_results),
qf_fallback_failures = state.last_scope_failures,
qf_scope_kind = state.last_scope_kind,
})
end