From 0e8a9fea429b29f4af11892cce730f17a2785dbc Mon Sep 17 00:00:00 2001 From: Tai Lai Date: Tue, 22 Apr 2025 09:57:12 -0700 Subject: [PATCH] fix(amazonq): diff not appearing for new files --- packages/amazonq/src/lsp/chat/messages.ts | 2 +- .../core/src/amazonq/commons/controllers/contentController.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/amazonq/src/lsp/chat/messages.ts b/packages/amazonq/src/lsp/chat/messages.ts index 9a53610f761..01a3624f195 100644 --- a/packages/amazonq/src/lsp/chat/messages.ts +++ b/packages/amazonq/src/lsp/chat/messages.ts @@ -452,7 +452,7 @@ export function registerMessageListeners( activeFileContext: { filePath: params.originalFileUri }, focusAreaContext: { selectionInsideExtendedCodeBlock: entireDocumentSelection }, }, - code: params.fileContent, + code: params.fileContent ?? '', }, amazonQDiffScheme, true diff --git a/packages/core/src/amazonq/commons/controllers/contentController.ts b/packages/core/src/amazonq/commons/controllers/contentController.ts index edb9ac7bd87..2586951a18e 100644 --- a/packages/core/src/amazonq/commons/controllers/contentController.ts +++ b/packages/core/src/amazonq/commons/controllers/contentController.ts @@ -161,7 +161,7 @@ export class EditorContentController { const { filePath, selection } = extractFileAndCodeSelectionFromMessage(message) try { - if (filePath && message?.code?.trim().length > 0 && selection) { + if (filePath && message?.code !== undefined && selection) { const originalFileUri = vscode.Uri.file(filePath) const uri = await createTempFileForDiff(originalFileUri, message, selection, scheme)