Skip to content

Commit 6782509

Browse files
authored
fix(amazonq): diff not appearing for new files (#7127)
## Problem Clicking on diff for newly created files did not open diff ## Solution Allow opening diffs for empty string --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 61805b7 commit 6782509

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/amazonq/src/lsp/chat/messages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ export function registerMessageListeners(
452452
activeFileContext: { filePath: params.originalFileUri },
453453
focusAreaContext: { selectionInsideExtendedCodeBlock: entireDocumentSelection },
454454
},
455-
code: params.fileContent,
455+
code: params.fileContent ?? '',
456456
},
457457
amazonQDiffScheme,
458458
true

packages/core/src/amazonq/commons/controllers/contentController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export class EditorContentController {
161161
const { filePath, selection } = extractFileAndCodeSelectionFromMessage(message)
162162

163163
try {
164-
if (filePath && message?.code?.trim().length > 0 && selection) {
164+
if (filePath && message?.code !== undefined && selection) {
165165
const originalFileUri = vscode.Uri.file(filePath)
166166
const uri = await createTempFileForDiff(originalFileUri, message, selection, scheme)
167167

0 commit comments

Comments
 (0)