Skip to content

Commit 61a61b8

Browse files
committed
fix(diff comment): show comment at correct position.
1 parent 6e44c68 commit 61a61b8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/extension.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,11 @@ export async function activate(context: vscode.ExtensionContext) {
231231
}, [])
232232
.forEach((i) => {
233233
const root = i[0];
234-
const isRight = root.change_type === 1;
235234
const isLeft = root.change_type === 2;
236-
const both = root.change_type === 3;
235+
const isRight = root.change_type === 1;
237236

238237
const rootLine = root.diffFile.diffLines[root.diffFile.diffLines.length - 1];
239-
const lineNum = isLeft ? rootLine.leftNo : rootLine.rightNo;
238+
const lineNum = isLeft ? rootLine.leftNo - 1 : rootLine.rightNo - 1;
240239
const range = new vscode.Range(lineNum - 1, 0, lineNum - 1, 0);
241240

242241
const commentList: vscode.Comment[] = i.map((c) => {
@@ -253,7 +252,7 @@ export async function activate(context: vscode.ExtensionContext) {
253252
return comment;
254253
});
255254
const commentThread = commentController.createCommentThread(
256-
headUri,
255+
isRight ? headUri : parentUri,
257256
range,
258257
commentList,
259258
);

0 commit comments

Comments
 (0)