include stdout into the detail-float
All checks were successful
tests / test (push) Successful in 10s
All checks were successful
tests / test (push) Successful in 10s
This commit is contained in:
@@ -248,6 +248,35 @@ local function build_error_lines(error_obj)
|
||||
return lines
|
||||
end
|
||||
|
||||
local function output_lines_from_payload(payload)
|
||||
local output = payload and payload.output
|
||||
if type(output) == "string" then
|
||||
return vim.split(output, "\n", { plain = true, trimempty = false })
|
||||
end
|
||||
if type(output) == "table" then
|
||||
local lines = {}
|
||||
for _, line in ipairs(output) do
|
||||
if type(line) == "string" then
|
||||
if line:find("\n", 1, true) then
|
||||
for _, split_line in ipairs(vim.split(line, "\n", { plain = true, trimempty = false })) do
|
||||
table.insert(lines, split_line)
|
||||
end
|
||||
else
|
||||
table.insert(lines, line)
|
||||
end
|
||||
end
|
||||
end
|
||||
return lines
|
||||
end
|
||||
return {}
|
||||
end
|
||||
|
||||
local function append_lines(target, lines)
|
||||
for _, line in ipairs(lines) do
|
||||
table.insert(target, line)
|
||||
end
|
||||
end
|
||||
|
||||
local function extract_location(stack)
|
||||
if not stack then
|
||||
return nil
|
||||
@@ -356,8 +385,11 @@ local function record_ndjson_result(state, status, payload)
|
||||
end
|
||||
|
||||
local location = normalize_location(payload.location)
|
||||
local output_lines = output_lines_from_payload(payload)
|
||||
if status == "failed" then
|
||||
local lines = build_error_lines(payload.error)
|
||||
local lines = {}
|
||||
append_lines(lines, output_lines)
|
||||
append_lines(lines, build_error_lines(payload.error))
|
||||
if #lines > 0 then
|
||||
state.outputs[full_name] = lines
|
||||
end
|
||||
@@ -377,6 +409,13 @@ local function record_ndjson_result(state, status, payload)
|
||||
location.text = status
|
||||
state.locations[full_name] = location
|
||||
end
|
||||
if #output_lines > 0 then
|
||||
state.outputs[full_name] = output_lines
|
||||
end
|
||||
end
|
||||
|
||||
if (not state.outputs[full_name] or #state.outputs[full_name] == 0) and status ~= "failed" then
|
||||
state.outputs[full_name] = { status }
|
||||
end
|
||||
|
||||
if added then
|
||||
|
||||
Reference in New Issue
Block a user