Skip to content

Commit 3084ae1

Browse files
authored
fix(amazonq): fix line break format when getting the current text document
2 parents 69516f4 + cf5d9b3 commit 3084ae1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/amazonq/src/app/inline/EditRendering/svgGenerator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class SvgGenerationService {
3030
origionalCodeHighlightRange: Range[]
3131
}> {
3232
const textDoc = await vscode.workspace.openTextDocument(filePath)
33-
const originalCode = textDoc.getText()
33+
const originalCode = textDoc.getText().replaceAll('\r\n', '\n')
3434
if (originalCode === '') {
3535
logger.error(`udiff format error`)
3636
throw new ToolkitError('udiff format error')

packages/core/src/shared/utilities/diffUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import jaroWinkler from 'jaro-winkler'
2525
*/
2626
export async function getPatchedCode(filePath: string, patch: string, snippetMode = false) {
2727
const document = await vscode.workspace.openTextDocument(filePath)
28-
const fileContent = document.getText()
28+
const fileContent = document.getText().replaceAll('\r\n', '\n')
2929
// Usage with the existing getPatchedCode function:
3030

3131
let updatedPatch = patch

0 commit comments

Comments
 (0)