Skip to content

Use suggested changes from CCR#1840

Merged
chrmarti merged 1 commit intomainfrom
chrmarti/fast-kingfisher
Nov 6, 2025
Merged

Use suggested changes from CCR#1840
chrmarti merged 1 commit intomainfrom
chrmarti/fast-kingfisher

Conversation

@chrmarti
Copy link
Collaborator

@chrmarti chrmarti commented Nov 6, 2025

Copilot AI review requested due to automatic review settings November 6, 2025 21:05
@chrmarti chrmarti enabled auto-merge November 6, 2025 21:05
@chrmarti chrmarti self-assigned this Nov 6, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances GitHub review comments to extract and apply code suggestions from GitHub's suggestion blocks. The changes enable proper handling of multi-line suggestions and improve context value updates for comment threads.

  • Extract suggestions from GitHub review comment bodies using regex parsing
  • Create editable suggestions with proper range calculation for multi-line comments
  • Update comment thread context values to reflect suggestion availability

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/extension/review/node/githubReviewAgent.ts Extracts suggestions from GitHub comment bodies, creates suggestion ranges based on start/end lines, and populates the suggestion field with edits
src/extension/review/node/doReview.ts Adds error logging for review failures
src/extension/inlineChat/vscode-node/inlineChatCommands.ts Updates context values when suggestions are available but marked as hasNoSuggestion

@@ -212,7 +212,9 @@ function createReviewComment(ghComment: ResponseComment | ExcludedComment, reque
const range = new Range(fromLine.lineNumber, fromLine.firstNonWhitespaceCharacterIndex, fromLine.lineNumber, lastNonWhitespaceCharacterIndex);
const raw = ghComment.data.body;
// Remove suggestion because that interfers with our own suggestion rendering later.
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'interfers' to 'interferes'.

Suggested change
// Remove suggestion because that interfers with our own suggestion rendering later.
// Remove suggestion because that interferes with our own suggestion rendering later.

Copilot uses AI. Check for mistakes.
const content = removeSuggestion(raw);
const { content, suggestions } = removeSuggestion(raw);
const startLine = typeof ghComment.data.start_line === 'number' ? ghComment.data.start_line : ghComment.data.line;
const suggestionRange = new Range(startLine - 1, 0, ghComment.data.line, 0);
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suggestionRange end line should be ghComment.data.line - 1 to properly convert from 1-indexed GitHub line numbers to 0-indexed VS Code line numbers. Currently, the start line is correctly adjusted (startLine - 1) but the end line is not, which could cause the range to extend one line too far.

Suggested change
const suggestionRange = new Range(startLine - 1, 0, ghComment.data.line, 0);
const suggestionRange = new Range(startLine - 1, 0, ghComment.data.line - 1, 0);

Copilot uses AI. Check for mistakes.
Comment on lines +232 to +239
edits: suggestions.map(suggestion => {
const oldText = document.getText(suggestionRange);
return {
range: suggestionRange,
newText: suggestion,
oldText,
};
}),
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The document.getText(suggestionRange) call is being made inside the map callback, which means it's called once per suggestion. Since all suggestions use the same suggestionRange, this value should be computed once before the map operation to avoid redundant document access.

Suggested change
edits: suggestions.map(suggestion => {
const oldText = document.getText(suggestionRange);
return {
range: suggestionRange,
newText: suggestion,
oldText,
};
}),
edits: (() => {
const oldText = document.getText(suggestionRange);
return suggestions.map(suggestion => {
return {
range: suggestionRange,
newText: suggestion,
oldText,
};
});
})(),

Copilot uses AI. Check for mistakes.
@chrmarti chrmarti added this pull request to the merge queue Nov 6, 2025
Merged via the queue into main with commit d9f49e5 Nov 6, 2025
22 checks passed
@chrmarti chrmarti deleted the chrmarti/fast-kingfisher branch November 6, 2025 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review code feedback doesn't seem to use the suggested changes from CCR

3 participants