Преглед изворни кода

tweak: grep tool to handle single file better (#3004)

Aiden Cline пре 4 месеци
родитељ
комит
06c42093c8
1 измењених фајлова са 1 додато и 2 уклоњено
  1. 1 2
      packages/opencode/src/tool/grep.ts

+ 1 - 2
packages/opencode/src/tool/grep.ts

@@ -20,12 +20,11 @@ export const GrepTool = Tool.define("grep", {
     const searchPath = params.path || Instance.directory
     const searchPath = params.path || Instance.directory
 
 
     const rgPath = await Ripgrep.filepath()
     const rgPath = await Ripgrep.filepath()
-    const args = ["-n", params.pattern]
+    const args = ["-nH", "--field-match-separator=|", params.pattern]
     if (params.include) {
     if (params.include) {
       args.push("--glob", params.include)
       args.push("--glob", params.include)
     }
     }
     args.push(searchPath)
     args.push(searchPath)
-    args.push("--field-match-separator=|")
 
 
     const proc = Bun.spawn([rgPath, ...args], {
     const proc = Bun.spawn([rgPath, ...args], {
       stdout: "pipe",
       stdout: "pipe",