import { Disposable } from "../../../../base/common/lifecycle.js"; import { IObservable } from "../../../../base/common/observable.js"; import { URI } from "../../../../base/common/uri.js"; import { IRange } from "../../../../editor/common/core/range.js"; import { ILogService } from "../../../../platform/log/common/log.service.js"; import { IGitHubService } from "../../github/browser/githubService.service.js"; import { IGitHubPullRequestReview } from "../../github/common/types.js"; import { IGitHubPullRequestRef } from "../../../services/sessions/common/session.js"; import { ISessionsManagementService } from "../../../services/sessions/common/sessionsManagement.service.js"; import { ISessionsService } from "../../../services/sessions/browser/sessionsService.service.js"; import { ICodeReviewService } from "./codeReviewService.service.js"; export interface ICodeReviewSuggestion { readonly edits: readonly ICodeReviewSuggestionChange[]; } export interface ICodeReviewSuggestionChange { readonly range: IRange; readonly newText: string; readonly oldText: string; } export declare enum PRReviewStateKind { None = "none", Loading = "loading", Loaded = "loaded", Error = "error" } export type IPRReviewState = { readonly kind: PRReviewStateKind.None; } | { readonly kind: PRReviewStateKind.Loading; } | { readonly kind: PRReviewStateKind.Loaded; readonly comments: readonly IPRReviewComment[]; readonly incompletePullRequests: readonly Pick[]; } | { readonly kind: PRReviewStateKind.Error; readonly reason: string; }; export interface IPRReviewComment { readonly id: string; readonly pullRequest: IGitHubPullRequestRef; readonly uri: URI; readonly range: IRange; readonly body: string; readonly author: string; } export interface IPRReviewCommentTarget { readonly pullRequest: IGitHubPullRequestRef; readonly commitId: string; readonly path: string; readonly startLine: number | undefined; readonly line: number; readonly pendingReview: Pick | undefined; } export declare function commentableRightLines(patch: string): ReadonlySet; export declare function mapCurrentLineToPullRequestLine(pullRequestContent: string, currentContent: string, currentLine: number): number | undefined; export declare function mapCurrentRangeToPullRequestRange(pullRequestContent: string, currentContent: string, currentRange: Pick): Pick | undefined; export declare class CodeReviewService extends Disposable implements ICodeReviewService { private readonly _logService; private readonly _gitHubService; private readonly _sessionsManagementService; private readonly _sessionsService; readonly _serviceBrand: undefined; private readonly _prReviewBySession; /** * PR review comment IDs that have been locally handled — converted to agent * feedback or dismissed from the `viewUnreviewedComments` confirmation — and * are therefore hidden from the PR review state (per session). */ private readonly _convertedPRCommentsBySession; constructor(_logService: ILogService, _gitHubService: IGitHubService, _sessionsManagementService: ISessionsManagementService, _sessionsService: ISessionsService); private _registerSessionListeners; getPRReviewState(sessionResource: URI): IObservable; getPRReviewCommentPullRequests(sessionResource: URI, resource: URI): readonly IGitHubPullRequestRef[]; private _getPRReviewCommentContext; private _getFocusedChat; getPRReviewCommentTargets(sessionResource: URI, resource: URI, range: IRange, currentContent: string, pullRequest?: Pick): Promise; private _resolveWorkspaceResource; createPRReviewComment(target: IPRReviewCommentTarget, body: string): Promise; resolvePRReviewThread(sessionResource: URI, threadId: string, pullRequest?: Pick): Promise; markPRReviewCommentConverted(sessionResource: URI, commentId: string): void; dismissPRReviewComment(sessionResource: URI, commentId: string): void; /** * Hide a PR review comment from the session's review state and remember it * so the projection autorun keeps filtering it. Shared by * {@link markPRReviewCommentConverted} and {@link dismissPRReviewComment}. */ private _suppressPRReviewComment; private _getOrCreatePRReviewData; private _disposePRReview; dispose(): void; }