Skip to content

📝 CodeRabbit Chat: Update search.ts in src/tools directory #161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/tools/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ export async function searchCode(options: {
}

if (filePattern) {
args.push('-g', filePattern);
const patterns = filePattern
.split('|')
.map(p => p.trim()) // remove surrounding spaces
.filter(Boolean); // drop empty tokens
patterns.forEach(p => args.push('-g', p));
}

// Add pattern and path
Expand Down Expand Up @@ -116,6 +120,9 @@ export async function searchCode(options: {
});
}
} catch (error) {



const errorMessage = error instanceof Error ? error.message : String(error);
capture('server_request_error', {error: `Error parsing ripgrep output: ${errorMessage}`});
console.error(`Error parsing ripgrep output: ${errorMessage}`);
Expand Down Expand Up @@ -239,4 +246,4 @@ export async function searchTextInFiles(options: {
excludeDirs: ['node_modules', '.git', 'dist']
});
}
}
}