diff --git a/packages/amazonq/src/app/inline/EditRendering/svgGenerator.ts b/packages/amazonq/src/app/inline/EditRendering/svgGenerator.ts index 178045afaee..45a615e318e 100644 --- a/packages/amazonq/src/app/inline/EditRendering/svgGenerator.ts +++ b/packages/amazonq/src/app/inline/EditRendering/svgGenerator.ts @@ -30,7 +30,7 @@ export class SvgGenerationService { origionalCodeHighlightRange: Range[] }> { const textDoc = await vscode.workspace.openTextDocument(filePath) - const originalCode = textDoc.getText() + const originalCode = textDoc.getText().replaceAll('\r\n', '\n') if (originalCode === '') { logger.error(`udiff format error`) throw new ToolkitError('udiff format error') diff --git a/packages/core/src/shared/utilities/diffUtils.ts b/packages/core/src/shared/utilities/diffUtils.ts index 64d09c19036..439c87dd7e6 100644 --- a/packages/core/src/shared/utilities/diffUtils.ts +++ b/packages/core/src/shared/utilities/diffUtils.ts @@ -25,7 +25,7 @@ import jaroWinkler from 'jaro-winkler' */ export async function getPatchedCode(filePath: string, patch: string, snippetMode = false) { const document = await vscode.workspace.openTextDocument(filePath) - const fileContent = document.getText() + const fileContent = document.getText().replaceAll('\r\n', '\n') // Usage with the existing getPatchedCode function: let updatedPatch = patch