fix: compatible with some incorrect tool results (#2530)

This commit is contained in:
yetone
2025-07-24 16:44:05 +08:00
committed by GitHub
parent 7af303b421
commit 02aa0a4241

View File

@@ -131,7 +131,7 @@ function M.on_render(input, opts)
summary = string.format("View %s: failed", path)
else
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")
summary = string.format("View %s: %d lines", path, #lines)
end