Skip to content

Commit 40131b8

Browse files
committed
refactor(sketch): rename getSearchTool to lookupSearchTool
- Rename `getSearchTool` to `lookupSearchTool` for clarity. - Add logging to warn when Ripgrep binary is not found.
1 parent d015fa6 commit 40131b8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

core/src/main/kotlin/cc/unitmesh/devti/sketch/SketchRunContext.kt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import cc.unitmesh.devti.provider.context.ChatCreationContext
1010
import cc.unitmesh.devti.provider.context.ChatOrigin
1111
import cc.unitmesh.devti.sketch.run.ShellUtil
1212
import cc.unitmesh.devti.template.context.TemplateContext
13+
import com.intellij.openapi.diagnostic.logger
1314
import com.intellij.openapi.editor.Editor
1415
import com.intellij.openapi.fileEditor.FileDocumentManager
1516
import com.intellij.openapi.fileEditor.FileEditorManager
@@ -72,20 +73,25 @@ data class SketchRunContext(
7273
return@runBlocking ChatContextProvider.collectChatContextList(project, creationContext)
7374
}.joinToString(",", transform = ChatContextItem::text),
7475
buildTool = buildTool,
75-
searchTool = getSearchTool()
76+
searchTool = lookupSearchTool()
7677
)
7778
}
7879
}
7980
}
8081

81-
fun getSearchTool(): String {
82+
fun lookupSearchTool(): String {
8283
val findRipgrepBinary = try {
8384
RipgrepSearcher.findRipgrepBinary()
84-
} catch (e: Exception) {
85+
} catch (_: Exception) {
8586
null
8687
}
8788

88-
return if (findRipgrepBinary != null) "ripgrepSearch" else "localSearch"
89+
return if (findRipgrepBinary != null) {
90+
"ripgrepSearch"
91+
} else {
92+
logger<SketchRunContext>().warn("Ripgrep binary not found, fallback to local search")
93+
"localSearch"
94+
}
8995
}
9096

9197
private fun osInfo() =

0 commit comments

Comments
 (0)