From ec05a0872254fcc551a35cef0331711651c77652 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Wed, 18 Dec 2024 15:17:58 +0100 Subject: [PATCH] Review/Comment Suggestions are offset by one line if you make local changes first Fixes #6495 --- src/common/diffPositionMapping.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/diffPositionMapping.ts b/src/common/diffPositionMapping.ts index 16b0fa66db..ddb8657d68 100644 --- a/src/common/diffPositionMapping.ts +++ b/src/common/diffPositionMapping.ts @@ -83,14 +83,14 @@ export function mapNewPositionToOld(patch: string, line: number): number { } else { // Part of the hunk is before line, part is after. for (const diffLine of diffHunk.diffLines) { - if (diffLine.newLineNumber > line) { - return line + delta; - } if (diffLine.type === DiffChangeType.Add) { delta--; } else if (diffLine.type === DiffChangeType.Delete) { delta++; } + if (diffLine.newLineNumber > line) { + return line + delta; + } } return line + delta; }