fix(core): recognise Windows backslash paths in grep_search output - #13037
Open
guillaume-flambard wants to merge 2 commits into
Open
fix(core): recognise Windows backslash paths in grep_search output#13037guillaume-flambard wants to merge 2 commits into
guillaume-flambard wants to merge 2 commits into
Conversation
`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 continuedev#13027
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
1 similar comment
Author
|
I have read the CLA Document and I hereby sign the CLA |
Author
|
Heads-up on CI: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #13027.
grep_searchalways returns "The search returned no results" on Windows, even when ripgrep finds matches (verified by the reporter with Process Monitor:rg.exeruns and returns results, but the tool reports none).Root cause
formatGrepSearchResultsincore/util/grepSearch.tsdetects ripgrep file-heading lines with:ripgrep emits headings as the relative path —
./dir/fileon POSIX, but.\dir\fileon Windows. ThestartsWith("./")check never matches the Windows form, so no line is counted as a heading,numResultsstays0, and every match is silently discarded. Diagnosed precisely in the issue by @SpikedCola.Fix
Also accept the
.\prefix:POSIX
./headings and the--context separator are unchanged.Tests
Added a unit test in
core/util/grepSearch.vitest.tsthat feeds backslash-separated ripgrep output and assertsnumResults > 0and the filenames are present — it fails before the change (0 results) and passes after.I verified the header-detection logic in isolation (the Windows heading goes from unrecognised → recognised, POSIX and
--still recognised). I don't have a Windows machine to run the full agent end-to-end, but the parser is pure and the added test covers the regression in CI.