import type { IManagedHoverTooltipHTMLElement } from "../../../../base/browser/ui/hover/hover.js";
import { Disposable } from "../../../../base/common/lifecycle.js";
import { IObservable } from "../../../../base/common/observable.js";
import { ThemeIcon } from "../../../../base/common/themables.js";
import { URI } from "../../../../base/common/uri.js";
import { ILogService } from "../../../../platform/log/common/log.service.js";
import { IWorkbenchGitHubService } from "../../../services/github/common/githubService.service.js";
import type { IActionListItemHover } from "../../../../platform/actionWidget/browser/actionList.js";
import { getChatReferencePillPresentation, type ChatReferenceKind } from "../../../browser/chatPills.js";
import { type GitHubChecksStatus, type IGitHubIssueHoverModel, type IGitHubPullRequestHoverModel } from "./githubResourceHover.js";
type GitHubReferenceKind = ChatReferenceKind;
export interface IGitHubReferenceTarget {
readonly owner: string;
readonly repo: string;
readonly number: number;
}
export interface IPullRequestHoverDetails {
readonly pullRequest: IGitHubPullRequestHoverModel;
readonly checksStatus: GitHubChecksStatus | undefined;
readonly checksUnavailable?: boolean;
}
export type LazyGitHubResourceState = {
readonly status: "idle" | "loading" | "failed";
} | {
readonly status: "resolved";
readonly value: T;
readonly stale?: boolean;
};
export declare class GitHubResourceDetailsResolver extends Disposable {
private readonly _gitHubService;
private readonly _logService;
private readonly _lifetime;
private readonly _prefetchLimiter;
private readonly _issues;
private readonly _pullRequests;
private _hovers;
private _details;
private _scope;
private _retainedTargets;
constructor(_gitHubService: IWorkbenchGitHubService, _logService: ILogService);
createHover(identity: object, options: Omit): IGitHubResourceDetailsHover;
resolveReference(identity: object, options: IGitHubResourceDetailsOptions): IGitHubResourceDetails | undefined;
/** Retains current references and warms new arrivals, but not a newly selected session's history. */
retain(references: readonly {
readonly identity: object;
readonly resource: URI;
}[], scope?: string): void;
getIssueState(target: IGitHubReferenceTarget): IObservable>;
getPullRequestState(target: IGitHubReferenceTarget): IObservable>;
isFresh(kind: GitHubReferenceKind, target: IGitHubReferenceTarget): boolean;
resolveIssue(target: IGitHubReferenceTarget): Promise;
prefetchIssue(target: IGitHubReferenceTarget): Promise;
resolvePullRequest(target: IGitHubReferenceTarget): Promise;
prefetchPullRequest(target: IGitHubReferenceTarget): Promise;
private _getEntry;
private _isFresh;
private _resolve;
private _resolveIssue;
private _resolvePullRequest;
dispose(): void;
}
export interface IGitHubResourceDetailsHoverOptions {
readonly kind: GitHubReferenceKind;
readonly target: IGitHubReferenceTarget;
readonly resource: URI;
readonly resolver: GitHubResourceDetailsResolver;
readonly onDidClickRepository: () => void;
readonly onDidClickReference: () => void;
readonly onDidClickBaseBranch: (branch: string) => void;
readonly onDidClickHeadBranch: (branch: string) => void;
}
export interface IGitHubResourceDetailsHover {
readonly hover: IActionListItemHover;
readonly pillHover: IManagedHoverTooltipHTMLElement;
readonly prefetch: () => void;
}
export interface IGitHubResourceDetailsOptions {
readonly kind: GitHubReferenceKind;
readonly resource: URI;
readonly fallbackLabel: string;
readonly enrich?: boolean;
readonly onDidClickRepository: (resource: URI) => void;
readonly onDidClickReference: () => void;
readonly onDidClickBranch: (branch: string) => void;
}
export interface IGitHubResourceDetails {
readonly presentation: IObservable;
readonly hover: IObservable;
readonly prefetch: (() => void) | undefined;
}
export declare function createGitHubResourceDetailsHover(options: IGitHubResourceDetailsHoverOptions): IGitHubResourceDetailsHover;
type GitHubResourcePresentation = ReturnType["entry"] & {
readonly icon?: ThemeIcon;
};
export declare function getGitHubResourcePresentation(resource: URI, kind: GitHubReferenceKind, title?: string, fallbackLabel?: string): GitHubResourcePresentation | undefined;
export declare function getGitHubResourceDetailsPresentation(kind: "issue", target: IGitHubReferenceTarget, state: LazyGitHubResourceState, fallbackLabel: string): GitHubResourcePresentation;
export declare function getGitHubResourceDetailsPresentation(kind: "pullRequest", target: IGitHubReferenceTarget, state: LazyGitHubResourceState, fallbackLabel: string): GitHubResourcePresentation;
export declare function parseGitHubReferenceTarget(resource: URI, kind: GitHubReferenceKind): IGitHubReferenceTarget | undefined;
export {};