mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 10:34:35 -07:00
refactor(cli,core): foundational layout, identity management, and type safety (#23286)
This commit is contained in:
@@ -900,11 +900,36 @@ class EditToolInvocation
|
||||
DEFAULT_DIFF_OPTIONS,
|
||||
);
|
||||
|
||||
// Determine the full content as originally proposed by the AI to ensure accurate diff stats.
|
||||
let fullAiProposedContent = editData.newContent;
|
||||
if (
|
||||
this.params.modified_by_user &&
|
||||
this.params.ai_proposed_content !== undefined
|
||||
) {
|
||||
try {
|
||||
const aiReplacement = await calculateReplacement(this.config, {
|
||||
params: {
|
||||
...this.params,
|
||||
new_string: this.params.ai_proposed_content,
|
||||
},
|
||||
currentContent: editData.currentContent ?? '',
|
||||
abortSignal: signal,
|
||||
});
|
||||
fullAiProposedContent = aiReplacement.newContent;
|
||||
} catch (error) {
|
||||
const errorMsg =
|
||||
error instanceof Error ? error.message : String(error);
|
||||
debugLogger.log(`AI replacement fallback: ${errorMsg}`);
|
||||
// Fallback to newContent if speculative calculation fails
|
||||
fullAiProposedContent = editData.newContent;
|
||||
}
|
||||
}
|
||||
|
||||
const diffStat = getDiffStat(
|
||||
fileName,
|
||||
editData.currentContent ?? '',
|
||||
fullAiProposedContent,
|
||||
editData.newContent,
|
||||
this.params.new_string,
|
||||
);
|
||||
displayResult = {
|
||||
fileDiff,
|
||||
|
||||
Reference in New Issue
Block a user