[BUG] search_files hides matching text on long lines

未關閉 適合新手
#2,496 1 則留言 0 個 reaction 已指派 1 人 在 GitHub 檢視

維護者通常 3 天內回覆

@DananjayaNadun 已經在處理了。

開始於 2026年11月20日。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
74/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
node.js, typescript, vscode
領域
tooling

研究方向

從 search_files 工具處理常式和片段產生程式碼著手,該程式碼會將每一行截斷至 500 個字元的預覽上限,並附加 [truncated...]。使用 issue 中的 node -e 命令重現並建立 sample.txt,接著執行相同的 search_files 參數。完成條件是:長行會以匹配項為中心截取,使 TARGET 顯示出來,同時預覽維持在一般大小範圍內,並有一項涵蓋匹配位置超出預覽上限的測試。

由索引模型根據 Issue 內容生成。

描述

Problem

search_files can report a match and omit the matching text from the preview.

Context

This affects searches in files with long lines, including minified JavaScript. The agent receives a file name and line number but cannot see the code that matched.

Reproduction steps
  1. Open an empty workspace in VS Code with Zoo Code installed.

  2. Run this command in the workspace terminal to create a one-line file:

    node -e "require('node:fs').writeFileSync('sample.txt', 'a'.repeat(600) + 'TARGET')"
    
  3. Ask Zoo Code to use search_files with these arguments:

    { "path": ".", "regex": "TARGET", "file_pattern": "sample.txt" }
    
  4. Inspect line 1 in the tool result.

Expected result

The preview shows TARGET on line 1 and stays within the usual preview size.

Actual result

The tool reports Found 1 result. It shows the first 500 a characters and [truncated...] on line 1. The preview omits TARGET. The chat display and the tool result sent to the provider show the same text.

App version

Zoo Code 3.98.0, VS Code 1.146.0 (x64), Windows. Reproduced with a local OpenAI-compatible test provider.

主要語言
TypeScript
星號
2k
分支
301
平均合併
3 天 14 小時
30 天內合併 PR
103

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

Zoo-Code-Org/Zoo-Code 的其他 Issue

查看 Zoo-Code-Org/Zoo-Code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。