This commit is contained in:
Saoud Rizwan 2024-12-17 19:10:09 -08:00
parent ebb603feb8
commit 67f53899f9
3 changed files with 15 additions and 13 deletions

View file

@ -1134,8 +1134,7 @@ export class Cline {
const sharedMessageProps: ClineSayTool = {
tool: fileExists ? "editedExistingFile" : "newFileCreated",
path: getReadablePath(cwd, removeClosingTag("path", relPath)),
content: fileExists ? undefined : newContent,
diff: fileExists ? diff : undefined,
content: diff || content,
}
if (block.partial) {
@ -1191,8 +1190,7 @@ export class Cline {
const completeMessage = JSON.stringify({
...sharedMessageProps,
content: fileExists ? undefined : newContent,
diff: fileExists ? diff : undefined,
content: diff || content,
// ? formatResponse.createPrettyPatch(
// relPath,
// this.diffViewProvider.originalContent,
@ -1204,6 +1202,9 @@ export class Cline {
if (this.shouldAutoApproveTool(block.name)) {
await this.say("tool", completeMessage, undefined, false)
this.consecutiveAutoApprovedRequestsCount++
// we need an artificial delay to let the diagnostics catch up to the changes
await delay(3_500)
} else {
// If auto-approval is enabled but this tool wasn't auto-approved, send notification
showNotificationForApprovalIfAutoApprovalEnabled(
@ -1649,12 +1650,13 @@ export class Cline {
try {
if (block.partial) {
if (this.shouldAutoApproveTool(block.name)) {
await this.say(
"command",
removeClosingTag("command", command),
undefined,
block.partial,
).catch(() => {})
// since depending on an upcoming parameter, requiresApproval this may become an ask - we cant partially stream a say prematurely. So in this particular case we have to wait for the requiresApproval parameter to be completed before presenting it.
// await this.say(
// "command",
// removeClosingTag("command", command),
// undefined,
// block.partial,
// ).catch(() => {})
} else {
await this.ask(
"command",

View file

@ -205,7 +205,7 @@ export async function constructNewFileContent(
;[searchMatchIndex, searchEndIndex] = fallbackMatch
} else {
throw new Error(
`The SEARCH block:\n${currentSearchContent.trimEnd()}\n...does not match anything in the file.`,
`The SEARCH block:\n${currentSearchContent.trimEnd()}\n...does not match anything in the file.\nThis is likely due to differences in whitespace or line endings between the SEARCH block and the actual file. Try again with a more precise SEARCH block.\n(If you keep running into this error, you may use the write_to_file tool as a workaround.)`,
)
}
}

View file

@ -281,7 +281,7 @@ export const ChatRowContent = ({
</div>
<CodeAccordian
// isLoading={message.partial}
code={tool.diff!}
code={tool.content}
path={tool.path!}
isExpanded={isExpanded}
onToggleExpand={onToggleExpand}
@ -565,7 +565,7 @@ export const ChatRowContent = ({
color: "var(--vscode-errorForeground)",
}}>
<i className="codicon codicon-warning"></i>
<span>The model has determined this command requires explicit approval</span>
<span>The model has determined this command requires explicit approval.</span>
</div>
)}
</>