Path: blob/main/extensions/copilot/src/extension/review/node/githubPullRequestReviewerCommentsProvider.ts
13399 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { IInteractionService } from '../../../platform/chat/common/interactionService';6import { ProgressLocation } from '../../../platform/notification/common/notificationService';7import { CancellationToken } from '../../../util/vs/base/common/cancellation';8import { IInstantiationService } from '../../../util/vs/platform/instantiation/common/instantiation';9import { Uri } from '../../../vscodeTypes';10import { ReviewerComments, ReviewerCommentsProvider } from '../../githubPullRequest';11import { ReviewSession } from './doReview';1213export class GitHubPullRequestReviewerCommentsProvider implements ReviewerCommentsProvider {14constructor(15@IInstantiationService private readonly instantiationService: IInstantiationService,16@IInteractionService private readonly interactionService: IInteractionService,17) { }1819async provideReviewerComments(context: { repositoryRoot: string; commitMessages: string[]; patches: { patch: string; fileUri: string; previousFileUri?: string }[] }, token: CancellationToken): Promise<ReviewerComments> {20this.interactionService.startInteraction();21const reviewSession = this.instantiationService.createInstance(ReviewSession);22const reviewResult = await reviewSession.review(context, ProgressLocation.Notification, token);23const files: Uri[] = [];24if (reviewResult?.type === 'success') {25for (const comment of reviewResult.comments) {26files.push(comment.uri);27}28}29const succeeded = reviewResult?.type === 'success';30return { files, succeeded };31}3233}3435