Skip to content

Commit

Permalink
Improve suggestion applying (#6187)
Browse files Browse the repository at this point in the history
Part of #6171
  • Loading branch information
alexr00 authored Aug 28, 2024
1 parent 554e4ca commit 5d3f2e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/github/prComment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export class GHPRComment extends CommentBase {
const match = this.rawComment.body.match(SUGGESTION_EXPRESSION);
const suggestionBody = match?.groups?.suggestion;
if (match) {
return suggestionBody ? `${suggestionBody}\n` : '';
return suggestionBody ? suggestionBody : '';
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/view/reviewCommentController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ ${suggestionInformation.suggestionContent}
throw new Error('Cannot find the editor to apply the suggestion to.');
}
await editor.edit(builder => {
builder.replace(range.with(undefined, new vscode.Position(range.end.line + 1, 0)), suggestion);
builder.replace(range.with(undefined, editor.document.lineAt(range.end.line).range.end), suggestion);
});
}

Expand Down

0 comments on commit 5d3f2e0

Please sign in to comment.