Skip to content

Commit 3e2d20f

Browse files
authored
Search and replace fixes (#2830)
* Allow replacing with an empty string * Visual cleanup
1 parent 8b5d480 commit 3e2d20f

File tree

7 files changed

+8
-30
lines changed

7 files changed

+8
-30
lines changed

src/core/tools/searchAndReplaceTool.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async function validateParams(
4141
return false
4242
}
4343

44-
if (!replace) {
44+
if (replace === undefined) {
4545
cline.consecutiveMistakeCount++
4646
cline.recordToolError("search_and_replace")
4747
pushToolResult(await cline.sayAndCreateMissingParamError("search_and_replace", "replace"))

webview-ui/src/components/chat/ChatRow.tsx

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -323,36 +323,14 @@ export const ChatRowContent = ({
323323
case "searchAndReplace":
324324
return (
325325
<>
326-
<div className="flex items-center gap-2.5 mb-2.5">
326+
<div style={headerStyle}>
327327
{toolIcon("replace")}
328-
<span className="font-bold">
328+
<span style={{ fontWeight: "bold" }}>
329329
{message.type === "ask"
330330
? t("chat:fileOperations.wantsToSearchReplace")
331331
: t("chat:fileOperations.didSearchReplace")}
332332
</span>
333333
</div>
334-
<div className="mb-2.5">
335-
<div className="flex items-center gap-2.5 mb-1.5">
336-
<span className="text-vscode-descriptionForeground">Search:</span>
337-
<code>{tool.search}</code>
338-
{tool.useRegex && <span className="text-vscode-descriptionForeground">(regex)</span>}
339-
{tool.ignoreCase && (
340-
<span className="text-vscode-descriptionForeground">(case-insensitive)</span>
341-
)}
342-
</div>
343-
<div className="flex items-center gap-2.5 mb-1.5">
344-
<span className="text-vscode-descriptionForeground">Replace:</span>
345-
<code>{tool.replace}</code>
346-
</div>
347-
{(tool.startLine !== undefined || tool.endLine !== undefined) && (
348-
<div className="flex items-center gap-2.5">
349-
<span className="text-vscode-descriptionForeground">Lines:</span>
350-
<code>
351-
{tool.startLine ?? 1} - {tool.endLine ?? "end"}
352-
</code>
353-
</div>
354-
)}
355-
</div>
356334
<CodeAccordian
357335
progressStatus={message.progressStatus}
358336
isLoading={message.partial}

webview-ui/src/i18n/locales/de/chat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
"wantsToEdit": "Roo möchte diese Datei bearbeiten:",
122122
"wantsToEditOutsideWorkspace": "Roo möchte diese Datei außerhalb des Arbeitsbereichs bearbeiten:",
123123
"wantsToCreate": "Roo möchte eine neue Datei erstellen:",
124-
"wantsToSearchReplace": "Roo möchte Suchen und Ersetzen in dieser Datei durchführen:",
124+
"wantsToSearchReplace": "Roo möchte in dieser Datei suchen und ersetzen:",
125125
"didSearchReplace": "Roo hat Suchen und Ersetzen in dieser Datei durchgeführt:",
126126
"wantsToInsert": "Roo möchte Inhalte in diese Datei einfügen:",
127127
"wantsToInsertWithLineNumber": "Roo möchte Inhalte in diese Datei in Zeile {{lineNumber}} einfügen:",

webview-ui/src/i18n/locales/en/chat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
"wantsToEdit": "Roo wants to edit this file:",
117117
"wantsToEditOutsideWorkspace": "Roo wants to edit this file outside of the workspace:",
118118
"wantsToCreate": "Roo wants to create a new file:",
119-
"wantsToSearchReplace": "Roo wants to perform search and replace on this file:",
119+
"wantsToSearchReplace": "Roo wants to search and replace in this file:",
120120
"didSearchReplace": "Roo performed search and replace on this file:",
121121
"wantsToInsert": "Roo wants to insert content into this file:",
122122
"wantsToInsertWithLineNumber": "Roo wants to insert content into this file at line {{lineNumber}}:",

webview-ui/src/i18n/locales/ja/chat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
"wantsToEdit": "Rooはこのファイルを編集したい:",
122122
"wantsToEditOutsideWorkspace": "Rooはワークスペース外のこのファイルを編集したい:",
123123
"wantsToCreate": "Rooは新しいファイルを作成したい:",
124-
"wantsToSearchReplace": "Rooはこのファイルで検索と置換を実行したい:",
124+
"wantsToSearchReplace": "Rooはこのファイルで検索と置換を行う:",
125125
"didSearchReplace": "Rooはこのファイルで検索と置換を実行しました:",
126126
"wantsToInsert": "Rooはこのファイルにコンテンツを挿入したい:",
127127
"wantsToInsertWithLineNumber": "Rooはこのファイルの{{lineNumber}}行目にコンテンツを挿入したい:",

webview-ui/src/i18n/locales/zh-CN/chat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
"wantsToEdit": "需要编辑文件:",
122122
"wantsToEditOutsideWorkspace": "需要编辑外部文件:",
123123
"wantsToCreate": "需要新建文件:",
124-
"wantsToSearchReplace": "需要执行搜索和替换:",
124+
"wantsToSearchReplace": "需要在此文件中搜索和替换:",
125125
"didSearchReplace": "已完成搜索和替换:",
126126
"wantsToInsert": "需要在此文件中插入内容:",
127127
"wantsToInsertWithLineNumber": "需要在第 {{lineNumber}} 行插入内容:",

webview-ui/src/i18n/locales/zh-TW/chat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
"wantsToEdit": "Roo 想要編輯此檔案:",
122122
"wantsToEditOutsideWorkspace": "Roo 想要編輯此工作區外的檔案:",
123123
"wantsToCreate": "Roo 想要建立新檔案:",
124-
"wantsToSearchReplace": "Roo 想要在此檔案執行搜尋和取代",
124+
"wantsToSearchReplace": "Roo 想要在此檔案中搜尋和取代",
125125
"didSearchReplace": "Roo 已在此檔案執行搜尋和取代:",
126126
"wantsToInsert": "Roo 想要在此檔案中插入內容:",
127127
"wantsToInsertWithLineNumber": "Roo 想要在此檔案第 {{lineNumber}} 行插入內容:",

0 commit comments

Comments
 (0)