From 0cf5045426966583fa3580cc66d8a4ce996be266 Mon Sep 17 00:00:00 2001 From: Guillaume Flambard Date: Mon, 27 Jul 2026 13:45:31 +0200 Subject: [PATCH 1/2] fix(core): recognise Windows backslash paths in grep_search output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `formatGrepSearchResults` detected ripgrep file headings with `line.startsWith("./")`. On Windows ripgrep emits `.\dir\file` instead of `./dir/file`, so no line was ever recognised as a heading, `numResults` stayed 0, and every match was silently discarded — grep_search always returned "no results" on Windows even though ripgrep found matches. Also accept the `.\` prefix. POSIX `./` headings and the `--` context separator are unchanged. Adds a unit test covering backslash-separated output. Fixes #13027 --- core/util/grepSearch.ts | 4 +++- core/util/grepSearch.vitest.ts | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/core/util/grepSearch.ts b/core/util/grepSearch.ts index be5b7ee082f..09051dc13bd 100644 --- a/core/util/grepSearch.ts +++ b/core/util/grepSearch.ts @@ -57,7 +57,9 @@ export function formatGrepSearchResults( let resultLines: string[] = []; for (const line of results.split("\n").filter((l) => !!l)) { - if (line.startsWith("./") || line === "--") { + // ripgrep headings start with the relative path: "./" on POSIX, ".\" on Windows. + // Only checking "./" silently discarded every match on Windows (#13027). + if (line.startsWith("./") || line.startsWith(".\\") || line === "--") { processResult(resultLines); // process previous result resultLines = [line]; numResults++; diff --git a/core/util/grepSearch.vitest.ts b/core/util/grepSearch.vitest.ts index df1a71efd82..aae7270caea 100644 --- a/core/util/grepSearch.vitest.ts +++ b/core/util/grepSearch.vitest.ts @@ -215,3 +215,21 @@ test("decreases indentation when original is more than 2 spaces", () => { expect(result.formatted).toContain(" tooMuchIndent();"); expect(result.formatted).toContain(" }"); }); + +test("parses Windows ripgrep output with backslash path separators", () => { + // On Windows, ripgrep emits headings like `.\dir\file.ext` instead of `./dir/file.ext`. + // The parser must recognise those as file headers, otherwise every match is discarded (#13027). + const windowsOutput = [ + ".\\src\\program.cs", + ' Console.WriteLine("Hello World!");', + "--", + ".\\test\\calc.kt", + " fun subtract(number: Double): Test {", + ].join("\n"); + + const result = formatGrepSearchResults(windowsOutput); + + expect(result.numResults).toBeGreaterThan(0); + expect(result.formatted).toContain("program.cs"); + expect(result.formatted).toContain("calc.kt"); +}); From 6b1e05752da5c7c5ac24f3975406c96d82ac986e Mon Sep 17 00:00:00 2001 From: Guillaume Flambard Date: Mon, 27 Jul 2026 16:28:05 +0200 Subject: [PATCH 2/2] chore: re-trigger CI (flaky darwin build + jetbrains autocomplete test)