Search and replace fixes (#2830)

* Allow replacing with an empty string

* Visual cleanup
This commit is contained in:
Matt Rubens 2025-04-21 22:57:58 -04:00 committed by GitHub
parent 8b5d48013e
commit 3e2d20f37c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 8 additions and 30 deletions

View file

@ -41,7 +41,7 @@ async function validateParams(
return false
}
if (!replace) {
if (replace === undefined) {
cline.consecutiveMistakeCount++
cline.recordToolError("search_and_replace")
pushToolResult(await cline.sayAndCreateMissingParamError("search_and_replace", "replace"))

View file

@ -323,36 +323,14 @@ export const ChatRowContent = ({
case "searchAndReplace":
return (
<>
<div className="flex items-center gap-2.5 mb-2.5">
<div style={headerStyle}>
{toolIcon("replace")}
<span className="font-bold">
<span style={{ fontWeight: "bold" }}>
{message.type === "ask"
? t("chat:fileOperations.wantsToSearchReplace")
: t("chat:fileOperations.didSearchReplace")}
</span>
</div>
<div className="mb-2.5">
<div className="flex items-center gap-2.5 mb-1.5">
<span className="text-vscode-descriptionForeground">Search:</span>
<code>{tool.search}</code>
{tool.useRegex && <span className="text-vscode-descriptionForeground">(regex)</span>}
{tool.ignoreCase && (
<span className="text-vscode-descriptionForeground">(case-insensitive)</span>
)}
</div>
<div className="flex items-center gap-2.5 mb-1.5">
<span className="text-vscode-descriptionForeground">Replace:</span>
<code>{tool.replace}</code>
</div>
{(tool.startLine !== undefined || tool.endLine !== undefined) && (
<div className="flex items-center gap-2.5">
<span className="text-vscode-descriptionForeground">Lines:</span>
<code>
{tool.startLine ?? 1} - {tool.endLine ?? "end"}
</code>
</div>
)}
</div>
<CodeAccordian
progressStatus={message.progressStatus}
isLoading={message.partial}

View file

@ -121,7 +121,7 @@
"wantsToEdit": "Roo möchte diese Datei bearbeiten:",
"wantsToEditOutsideWorkspace": "Roo möchte diese Datei außerhalb des Arbeitsbereichs bearbeiten:",
"wantsToCreate": "Roo möchte eine neue Datei erstellen:",
"wantsToSearchReplace": "Roo möchte Suchen und Ersetzen in dieser Datei durchführen:",
"wantsToSearchReplace": "Roo möchte in dieser Datei suchen und ersetzen:",
"didSearchReplace": "Roo hat Suchen und Ersetzen in dieser Datei durchgeführt:",
"wantsToInsert": "Roo möchte Inhalte in diese Datei einfügen:",
"wantsToInsertWithLineNumber": "Roo möchte Inhalte in diese Datei in Zeile {{lineNumber}} einfügen:",

View file

@ -116,7 +116,7 @@
"wantsToEdit": "Roo wants to edit this file:",
"wantsToEditOutsideWorkspace": "Roo wants to edit this file outside of the workspace:",
"wantsToCreate": "Roo wants to create a new file:",
"wantsToSearchReplace": "Roo wants to perform search and replace on this file:",
"wantsToSearchReplace": "Roo wants to search and replace in this file:",
"didSearchReplace": "Roo performed search and replace on this file:",
"wantsToInsert": "Roo wants to insert content into this file:",
"wantsToInsertWithLineNumber": "Roo wants to insert content into this file at line {{lineNumber}}:",

View file

@ -121,7 +121,7 @@
"wantsToEdit": "Rooはこのファイルを編集したい:",
"wantsToEditOutsideWorkspace": "Rooはワークスペース外のこのファイルを編集したい:",
"wantsToCreate": "Rooは新しいファイルを作成したい:",
"wantsToSearchReplace": "Rooはこのファイルで検索と置換を実行したい:",
"wantsToSearchReplace": "Rooはこのファイルで検索と置換を行う:",
"didSearchReplace": "Rooはこのファイルで検索と置換を実行しました:",
"wantsToInsert": "Rooはこのファイルにコンテンツを挿入したい:",
"wantsToInsertWithLineNumber": "Rooはこのファイルの{{lineNumber}}行目にコンテンツを挿入したい:",

View file

@ -121,7 +121,7 @@
"wantsToEdit": "需要编辑文件:",
"wantsToEditOutsideWorkspace": "需要编辑外部文件:",
"wantsToCreate": "需要新建文件:",
"wantsToSearchReplace": "需要执行搜索和替换:",
"wantsToSearchReplace": "需要在此文件中搜索和替换:",
"didSearchReplace": "已完成搜索和替换:",
"wantsToInsert": "需要在此文件中插入内容:",
"wantsToInsertWithLineNumber": "需要在第 {{lineNumber}} 行插入内容:",

View file

@ -121,7 +121,7 @@
"wantsToEdit": "Roo 想要編輯此檔案:",
"wantsToEditOutsideWorkspace": "Roo 想要編輯此工作區外的檔案:",
"wantsToCreate": "Roo 想要建立新檔案:",
"wantsToSearchReplace": "Roo 想要在此檔案執行搜尋和取代:",
"wantsToSearchReplace": "Roo 想要在此檔案搜尋和取代:",
"didSearchReplace": "Roo 已在此檔案執行搜尋和取代:",
"wantsToInsert": "Roo 想要在此檔案中插入內容:",
"wantsToInsertWithLineNumber": "Roo 想要在此檔案第 {{lineNumber}} 行插入內容:",