fix: compatible with some incorrect tool results (#2530)
This commit is contained in:
@@ -131,7 +131,7 @@ function M.on_render(input, opts)
|
|||||||
summary = string.format("View %s: failed", path)
|
summary = string.format("View %s: failed", path)
|
||||||
else
|
else
|
||||||
local ok, result = pcall(vim.json.decode, tool_result.content)
|
local ok, result = pcall(vim.json.decode, tool_result.content)
|
||||||
if ok then
|
if ok and type(result) == "table" and type(result.content) == "string" then
|
||||||
local lines = vim.split(result.content, "\n")
|
local lines = vim.split(result.content, "\n")
|
||||||
summary = string.format("View %s: %d lines", path, #lines)
|
summary = string.format("View %s: %d lines", path, #lines)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user