Skip to content

Commit bbecb5d

Browse files
j-eastdaniel-lxs
authored andcommitted
fix test bug and path resolution bug
1 parent 691657f commit bbecb5d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/services/ripgrep/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ function formatResults(fileResults: SearchFileResult[], cwd: string): string {
233233

234234
// Group results by file name
235235
fileResults.slice(0, MAX_RESULTS).forEach((file) => {
236-
const relativeFilePath = path.relative(cwd, file.file)
236+
// If file.file is already a relative path, use it as-is
237+
// Otherwise, make it relative to cwd
238+
const relativeFilePath = path.isAbsolute(file.file) ? path.relative(cwd, file.file) : file.file
237239
if (!groupedResults[relativeFilePath]) {
238240
groupedResults[relativeFilePath] = []
239241

0 commit comments

Comments
 (0)