diff --git a/package.json b/package.json index 121adffe67..dac8fced79 100644 --- a/package.json +++ b/package.json @@ -1181,6 +1181,18 @@ "category": "%command.pull.request.category%", "enablement": "!commentIsEmpty" }, + { + "command": "pr.createCommentAndResolve", + "title": "%command.pr.createCommentAndResolve.title%", + "category": "%command.pull.request.category%", + "enablement": "!commentIsEmpty" + }, + { + "command": "pr.createSingleCommentAndResolve", + "title": "%command.pr.createSingleCommentAndResolve.title%", + "category": "%command.pull.request.category%", + "enablement": "!commentIsEmpty" + }, { "command": "pr.makeSuggestion", "title": "%command.pr.makeSuggestion.title%", @@ -2290,6 +2302,14 @@ "command": "pr.createSingleComment", "when": "false" }, + { + "command": "pr.createCommentAndResolve", + "when": "false" + }, + { + "command": "pr.createSingleCommentAndResolve", + "when": "false" + }, { "command": "pr.makeSuggestion", "when": "false" @@ -3221,6 +3241,16 @@ "command": "pr.createSingleComment", "group": "inline@2", "when": "config.githubPullRequests.defaultCommentType == review && ((commentController =~ /^github-browse/ && !prInDraft) || commentController =~ /^github-review/ && !reviewInDraftMode)" + }, + { + "command": "pr.createCommentAndResolve", + "group": "inline@3", + "when": "commentThread =~ /canResolve/ && ((commentController =~ /^github-browse/ && prInDraft) || (commentController =~ /^github-review/ && reviewInDraftMode))" + }, + { + "command": "pr.createSingleCommentAndResolve", + "group": "inline@3", + "when": "commentThread =~ /canResolve/ && config.githubPullRequests.defaultCommentType != review && ((commentController =~ /^github-browse/ && !prInDraft) || (commentController =~ /^github-review/ && !reviewInDraftMode))" } ], "comments/comment/editorActions": [ diff --git a/package.nls.json b/package.nls.json index 73c02b7684..4bd45d8266 100644 --- a/package.nls.json +++ b/package.nls.json @@ -234,6 +234,8 @@ "command.pr.deleteLocalBranchesNRemotes.title": "Delete local branches and remotes", "command.pr.createComment.title": "Add Review Comment", "command.pr.createSingleComment.title": "Add Comment", + "command.pr.createCommentAndResolve.title": "Add Review Comment and Resolve", + "command.pr.createSingleCommentAndResolve.title": "Add Comment and Resolve", "command.pr.makeSuggestion.title": "Make Code Suggestion", "command.pr.startReview.title": "Start Review", "command.pr.editComment.title": "Edit Comment", diff --git a/src/@types/vscode.proposed.chatParticipantAdditions.d.ts b/src/@types/vscode.proposed.chatParticipantAdditions.d.ts index 71520fa1ec..aa7001a3d2 100644 --- a/src/@types/vscode.proposed.chatParticipantAdditions.d.ts +++ b/src/@types/vscode.proposed.chatParticipantAdditions.d.ts @@ -105,6 +105,7 @@ declare module 'vscode' { isComplete?: boolean; toolSpecificData?: ChatTerminalToolInvocationData; fromSubAgent?: boolean; + presentation?: 'hidden' | 'hiddenAfterComplete' | undefined; constructor(toolName: string, toolCallId: string, isError?: boolean); } diff --git a/src/commands.ts b/src/commands.ts index ddb34e8736..88dce4824c 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -1209,6 +1209,36 @@ export function registerCommands( }), ); + context.subscriptions.push( + vscode.commands.registerCommand('pr.createCommentAndResolve', async (reply: CommentReply) => { + /* __GDPR__ + "pr.createCommentAndResolve" : {} + */ + telemetry.sendTelemetryEvent('pr.createCommentAndResolve'); + const handler = resolveCommentHandler(reply.thread); + + if (handler) { + await handler.createOrReplyComment(reply.thread, reply.text, false); + await handler.resolveReviewThread(reply.thread); + } + }), + ); + + context.subscriptions.push( + vscode.commands.registerCommand('pr.createSingleCommentAndResolve', async (reply: CommentReply) => { + /* __GDPR__ + "pr.createSingleCommentAndResolve" : {} + */ + telemetry.sendTelemetryEvent('pr.createSingleCommentAndResolve'); + const handler = resolveCommentHandler(reply.thread); + + if (handler) { + await handler.createOrReplyComment(reply.thread, reply.text, true); + await handler.resolveReviewThread(reply.thread); + } + }), + ); + context.subscriptions.push( vscode.commands.registerCommand('pr.makeSuggestion', async (reply: CommentReply | GHPRComment | undefined) => { let potentialThread: GHPRCommentThread | undefined;