diff --git a/package.json b/package.json index 16cb91b838..c663c77cf7 100644 --- a/package.json +++ b/package.json @@ -3100,6 +3100,11 @@ "command": "pr.unresolveReviewThreadFromView", "group": "context@1", "when": "commentController =~ /^github-(browse|review)/ && commentThread =~ /canUnresolve/" + }, + { + "command": "pr.applySuggestionWithCopilot", + "group": "context@2", + "when": "commentController =~ /^github-review/" } ], "editor/title": [ @@ -3256,7 +3261,7 @@ }, { "command": "pr.applySuggestionWithCopilot", - "when": "commentController =~ /^github-review/ && !(comment =~ /hasSuggestion/)" + "when": "commentController =~ /^github-review/" } ], "comments/comment/title": [ @@ -3268,7 +3273,7 @@ { "command": "pr.applySuggestionWithCopilot", "group": "overflow@0", - "when": "commentController =~ /^github-review/ && !(comment =~ /hasSuggestion/)" + "when": "commentController =~ /^github-review/" }, { "command": "pr.editComment", diff --git a/src/@types/vscode.proposed.chatParticipantAdditions.d.ts b/src/@types/vscode.proposed.chatParticipantAdditions.d.ts index 8ef3f9335e..df0f1045c8 100644 --- a/src/@types/vscode.proposed.chatParticipantAdditions.d.ts +++ b/src/@types/vscode.proposed.chatParticipantAdditions.d.ts @@ -171,8 +171,8 @@ declare module 'vscode' { pastTenseMessage?: string | MarkdownString; isConfirmed?: boolean; isComplete?: boolean; - toolSpecificData?: ChatTerminalToolInvocationData | ChatMcpToolInvocationData; - subAgentInvocationId?: string; + toolSpecificData?: ChatTerminalToolInvocationData; + fromSubAgent?: boolean; presentation?: 'hidden' | 'hiddenAfterComplete' | undefined; constructor(toolName: string, toolCallId: string, isError?: boolean); @@ -244,7 +244,7 @@ declare module 'vscode' { constructor(uris: Uri[], callback: () => Thenable); } - export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseWorkspaceEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatToolInvocationPart | ChatResponseMultiDiffPart | ChatResponseThinkingProgressPart | ChatResponseExternalEditPart; + export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatPrepareToolInvocationPart | ChatToolInvocationPart | ChatResponseMultiDiffPart | ChatResponseThinkingProgressPart | ChatResponseExternalEditPart; export class ChatResponseWarningPart { value: MarkdownString; constructor(value: string | MarkdownString); diff --git a/src/commands.ts b/src/commands.ts index c59075f7a0..380087aaa8 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -1768,20 +1768,30 @@ ${contents} } })); context.subscriptions.push( - vscode.commands.registerCommand('pr.applySuggestionWithCopilot', async (comment: GHPRComment) => { + vscode.commands.registerCommand('pr.applySuggestionWithCopilot', async (comment: GHPRComment | GHPRCommentThread) => { /* __GDPR__ "pr.applySuggestionWithCopilot" : {} */ telemetry.sendTelemetryEvent('pr.applySuggestionWithCopilot'); - const commentThread = comment.parent; + const isThread = GHPRCommentThread.is(comment); + const commentThread = isThread ? comment : comment.parent; + const commentBody = isThread ? comment.comments[0].body : comment.body; commentThread.collapsibleState = vscode.CommentThreadCollapsibleState.Collapsed; - const message = comment.body instanceof vscode.MarkdownString ? comment.body.value : comment.body; - await vscode.commands.executeCommand('vscode.editorChat.start', { - initialRange: commentThread.range, - message: message, - autoSend: true, - }); + const message = commentBody instanceof vscode.MarkdownString ? commentBody.value : commentBody; + + if (isThread) { + // For threads, open the Chat view instead of inline chat + await vscode.commands.executeCommand(commands.NEW_CHAT, { inputValue: message, isPartialQuery: true, agentMode: true }); + + } else { + // For single comments, use inline chat + await vscode.commands.executeCommand('vscode.editorChat.start', { + initialRange: commentThread.range, + message: message, + autoSend: true, + }); + } }) ); context.subscriptions.push(