Skip to content

Commit

Permalink
Review/Comment Suggestions are offset by one line if you make local c…
Browse files Browse the repository at this point in the history
…hanges first

Fixes #6495
  • Loading branch information
alexr00 committed Dec 18, 2024
1 parent 9f6b715 commit ec05a08
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/common/diffPositionMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit ec05a08

Please sign in to comment.