Skip to content

Commit 7482840

Browse files
committed
refactor(ripgrep): improve search result formatting
Enhance the output format of Ripgrep search results by adding clear separators and a descriptive header when results are found. This improves readability and user experience.
1 parent 66880e2 commit 7482840

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/compiler/exec/RipgrepSearchInsCommand.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ class RipgrepSearchInsCommand(
2323
val searchDirectory = myProject.baseDir!!.path
2424
val searchContent = text ?: scope
2525
val result = RipgrepSearcher.searchFiles(myProject, searchDirectory, searchContent, null).get()
26-
return result ?: "No result found for /$commandName:$searchContent"
26+
return if (result?.isNotEmpty() == true) {
27+
"RipGrep Search Result: \n===============================$result\n===============================\n"
28+
} else {
29+
"No result found for /$commandName:$searchContent"
30+
}
2731
}
2832
}

0 commit comments

Comments
 (0)