Skip to content

fix: handle Windows backslash path separator in grep_search tool - #13043

Open
rekha0suthar wants to merge 1 commit into
continuedev:mainfrom
rekha0suthar:fix/windows-grep-search-backslash
Open

fix: handle Windows backslash path separator in grep_search tool#13043
rekha0suthar wants to merge 1 commit into
continuedev:mainfrom
rekha0suthar:fix/windows-grep-search-backslash

Conversation

@rekha0suthar

Copy link
Copy Markdown

Problem

On Windows, ripgrep outputs file paths prefixed with a backslash separator (e.g. .\path\to\file.ts) instead of the Unix-style forward slash (e.g. ./path/to/file.ts).

The formatGrepSearchResults function in core/util/grepSearch.ts only checked for line.startsWith("./") when identifying file header lines, so on Windows none of the lines were detected as file paths, and the grep_search tool silently returned zero results for every query.

Root Cause

// Before — only matches Unix paths
if (line.startsWith("./") || line === "--") {

Fix

Added a second check for the Windows backslash prefix:

// After — matches both Unix and Windows paths
if (line.startsWith("./") || line.startsWith(".\\") || line === "--") {

This is a one-line surgical fix with no risk of affecting Unix behaviour.

Testing

  • On Unix: existing behaviour preserved — ./ prefix still matched correctly
  • On Windows: .\ prefix now detected, file headers correctly identified, results returned

Fixes #13027


🤖 Generated with Claude Code

@rekha0suthar
rekha0suthar requested a review from a team as a code owner July 28, 2026 06:39
@rekha0suthar
rekha0suthar requested review from sestinj and removed request for a team July 28, 2026 06:39
@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@rekha0suthar

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

1 similar comment
@rekha0suthar

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@rekha0suthar

Copy link
Copy Markdown
Author

recheck

@rekha0suthar
rekha0suthar force-pushed the fix/windows-grep-search-backslash branch from 9a2a921 to 842d760 Compare July 28, 2026 07:12
@rekha0suthar

Copy link
Copy Markdown
Author

recheck

On Windows, ripgrep outputs file paths with a backslash prefix (e.g.
`.\path\to\file`) instead of the forward-slash prefix (`./path/to/file`)
used on Unix systems. The existing check only matched `./`, causing the
grep_search tool to return no results on Windows.

Added `line.startsWith(".\\")` to the path-detection condition so that
Windows-style paths are correctly identified as file headers.

Fixes continuedev#13027
@rekha0suthar
rekha0suthar force-pushed the fix/windows-grep-search-backslash branch from 842d760 to 30974a5 Compare July 28, 2026 07:26
@rekha0suthar

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

grep_search tool returns no results on Windows due to backslash path separator in ripgrep output

1 participant