Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4175,9 +4175,9 @@
},
"overrides": {
"mocha": {
"diff": "7.0.0",
"serialize-javascript": "6.0.1"
"diff": "7.0.0"
},
"serialize-javascript": "7.0.4",
"elliptic": "6.6.1"
},
"resolutions": {
Expand Down
21 changes: 12 additions & 9 deletions src/@types/vscode.proposed.chatSessionsProvider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ declare module 'vscode' {
readonly command?: string;
};

readonly sessionOptions: ReadonlyArray<{ optionId: string; value: ChatSessionProviderOptionItem }>;
readonly sessionOptions: ReadonlyArray<{ optionId: string; value: string | ChatSessionProviderOptionItem }>;
}

/**
Expand All @@ -116,7 +116,7 @@ declare module 'vscode' {
*
* @param sessionResource The resource of the chat session being forked.
* @param request The request turn that marks the fork point. The forked session includes all turns
* upto this request turn and includes this request turn itself. If undefined, fork the full session.
* upto this request turn and excludes this request turn itself. If undefined, fork the full session.
* @param token A cancellation token.
* @returns The forked session item.
*/
Expand Down Expand Up @@ -396,9 +396,12 @@ declare module 'vscode' {
/**
* Options configured for this session as key-value pairs.
* Keys correspond to option group IDs (e.g., 'models', 'subagents').
* Values can be either:
* - A string (the option item ID) for backwards compatibility
* - A ChatSessionProviderOptionItem object to include metadata like locked state
* TODO: Strongly type the keys
*/
readonly options?: Record<string, ChatSessionProviderOptionItem>;
readonly options?: Record<string, string | ChatSessionProviderOptionItem>;

/**
* Callback invoked by the editor for a currently running response. This allows the session to push items for the
Expand Down Expand Up @@ -429,7 +432,7 @@ declare module 'vscode' {
*
* @param sessionResource The resource of the chat session being forked.
* @param request The request turn that marks the fork point. The forked session includes all turns
* until this request turn and includes this request turn itself. If undefined, fork the full session.
* upto this request turn and excludes this request turn itself. If undefined, fork the full session.
* @param token A cancellation token.
* @returns The forked session item.
*/
Expand All @@ -456,7 +459,7 @@ declare module 'vscode' {
/**
* The new value assigned to the option. When `undefined`, the option is cleared.
*/
readonly value: ChatSessionProviderOptionItem;
readonly value: string | ChatSessionProviderOptionItem;
}>;
}

Expand Down Expand Up @@ -489,7 +492,7 @@ declare module 'vscode' {
* @return The {@link ChatSession chat session} associated with the given URI.
*/
provideChatSessionContent(resource: Uri, token: CancellationToken, context: {
readonly sessionOptions: ReadonlyArray<{ optionId: string; value: ChatSessionProviderOptionItem }>;
readonly sessionOptions: ReadonlyArray<{ optionId: string; value: string | ChatSessionProviderOptionItem }>;
}): Thenable<ChatSession> | ChatSession;

/**
Expand All @@ -514,7 +517,7 @@ declare module 'vscode' {
/**
* The new value assigned to the option. When `undefined`, the option is cleared.
*/
readonly value: ChatSessionProviderOptionItem | undefined;
readonly value: string | undefined;
}

export namespace chat {
Expand Down Expand Up @@ -544,7 +547,7 @@ declare module 'vscode' {
* The initial option selections for the session, provided with the first request.
* Contains the options the user selected (or defaults) before the session was created.
*/
readonly initialSessionOptions?: ReadonlyArray<{ optionId: string; value: ChatSessionProviderOptionItem }>;
readonly initialSessionOptions?: ReadonlyArray<{ optionId: string; value: string | ChatSessionProviderOptionItem }>;
}

export interface ChatSessionCapabilities {
Expand Down Expand Up @@ -667,6 +670,6 @@ declare module 'vscode' {
*
* Keys correspond to option group IDs (e.g., 'models', 'subagents').
*/
readonly newSessionOptions?: Record<string, ChatSessionProviderOptionItem>;
readonly newSessionOptions?: Record<string, string | ChatSessionProviderOptionItem>;
}
}
28 changes: 14 additions & 14 deletions src/github/githubRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1430,9 +1430,9 @@ export class GitHubRepository extends Disposable {
}

ret.push(
...result.data.repository.mentionableUsers.nodes.map(node => {
...await Promise.all(result.data.repository.mentionableUsers.nodes.map(node => {
return parseAccount(node, this);
}),
})),
);

hasNextPage = result.data.repository.mentionableUsers.pageInfo.hasNextPage;
Expand All @@ -1457,7 +1457,7 @@ export class GitHubRepository extends Disposable {
login,
},
});
return parseGraphQLUser(data, this);
return await parseGraphQLUser(data, this);
} catch (e) {
// Ignore cases where the user doesn't exist
if (!(e.message as (string | undefined))?.startsWith('GraphQL error: Could not resolve to a User with the login of')) {
Expand Down Expand Up @@ -1518,9 +1518,9 @@ export class GitHubRepository extends Disposable {
const users = (result.data as AssignableUsersResponse).repository?.assignableUsers ?? (result.data as SuggestedActorsResponse).repository?.suggestedActors;

ret.push(
...(users?.nodes.map(node => {
...(await Promise.all(users?.nodes.map(node => {
return parseAccount(node, this);
}) || []),
}) || [])),
);

hasNextPage = users?.pageInfo.hasNextPage;
Expand Down Expand Up @@ -1616,17 +1616,17 @@ export class GitHubRepository extends Disposable {
},
});

result.data.organization.teams.nodes.forEach(node => {
for (const node of result.data.organization.teams.nodes) {
const team: ITeam = {
avatarUrl: getAvatarWithEnterpriseFallback(node.avatarUrl, undefined, this.remote.isEnterprise),
avatarUrl: await getAvatarWithEnterpriseFallback(node.avatarUrl, undefined, this.remote.isEnterprise),
name: node.name,
url: node.url,
slug: node.slug,
id: node.id,
org: remote.owner
};
orgTeams.push({ ...team, repositoryNames: node.repositories.nodes.map(repo => repo.name) });
});
}

hasNextPage = result.data.organization.teams.pageInfo.hasNextPage;
after = result.data.organization.teams.pageInfo.endCursor;
Expand Down Expand Up @@ -1671,9 +1671,9 @@ export class GitHubRepository extends Disposable {
}

ret.push(
...result.data.repository.pullRequest.participants.nodes.map(node => {
...await Promise.all(result.data.repository.pullRequest.participants.nodes.map(node => {
return parseAccount(node, this);
}),
})),
);
} catch (e) {
Logger.debug(`Unable to fetch participants from a PullRequest: ${e}`, this.id);
Expand Down Expand Up @@ -1767,15 +1767,15 @@ export class GitHubRepository extends Disposable {
statuses: []
};
} else {
const dedupedStatuses = this.deduplicateStatusChecks(statusCheckRollup.contexts.nodes.map(context => {
const dedupedStatuses = this.deduplicateStatusChecks(await Promise.all(statusCheckRollup.contexts.nodes.map(async context => {
if (isCheckRun(context)) {
return {
id: context.id,
databaseId: context.databaseId,
url: context.checkSuite?.app?.url,
avatarUrl:
context.checkSuite?.app?.logoUrl &&
getAvatarWithEnterpriseFallback(
await getAvatarWithEnterpriseFallback(
context.checkSuite.app.logoUrl,
undefined,
this.remote.isEnterprise,
Expand All @@ -1795,7 +1795,7 @@ export class GitHubRepository extends Disposable {
databaseId: undefined,
url: context.targetUrl ?? undefined,
avatarUrl: context.avatarUrl
? getAvatarWithEnterpriseFallback(context.avatarUrl, undefined, this.remote.isEnterprise)
? await getAvatarWithEnterpriseFallback(context.avatarUrl, undefined, this.remote.isEnterprise)
: undefined,
state: this.mapStateAsCheckState(context.state),
description: context.description,
Expand All @@ -1807,7 +1807,7 @@ export class GitHubRepository extends Disposable {
isCheckRun: false,
};
}
}));
})));

checks = {
state: this.computeOverallCheckState(dedupedStatuses),
Expand Down
4 changes: 2 additions & 2 deletions src/github/issueModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export class IssueModel<TItem extends Issue = Issue> extends Disposable {
});

this._onDidChange.fire({ timeline: true });
return parseGraphQlIssueComment(data!.addComment.commentEdge.node, this.githubRepository);
return await parseGraphQlIssueComment(data!.addComment.commentEdge.node, this.githubRepository);
}

async editIssueComment(comment: IComment, text: string): Promise<IComment> {
Expand All @@ -299,7 +299,7 @@ export class IssueModel<TItem extends Issue = Issue> extends Disposable {
});

this._onDidChange.fire({ timeline: true });
return parseGraphQlIssueComment(data!.updateIssueComment.issueComment, this.githubRepository);
return await parseGraphQlIssueComment(data!.updateIssueComment.issueComment, this.githubRepository);
} catch (e) {
throw new Error(formatError(e));
}
Expand Down
22 changes: 11 additions & 11 deletions src/github/pullRequestModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe

this.hasPendingReview = false;
await this.updateDraftModeContext();
const reviewEvent = parseGraphQLReviewEvent(data!.submitPullRequestReview.pullRequestReview, this.githubRepository);
const reviewEvent = await parseGraphQLReviewEvent(data!.submitPullRequestReview.pullRequestReview, this.githubRepository);

const threadWithComment = (this._reviewThreadsCache ?? []).find(thread =>
thread.comments.length ? (thread.comments[0].pullRequestReviewId === reviewEvent.id) : undefined,
Expand Down Expand Up @@ -649,7 +649,7 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
});

const { comments, databaseId } = data!.deletePullRequestReview.pullRequestReview;
const deletedReviewComments = comments.nodes.map(comment => parseGraphQLComment(comment, false, false, this.githubRepository));
const deletedReviewComments = await Promise.all(comments.nodes.map(comment => parseGraphQLComment(comment, false, false, this.githubRepository)));

// Update local state: remove all draft comments (and their threads if emptied) that belonged to the deleted review
const deletedCommentIds = new Set(deletedReviewComments.map(c => c.id));
Expand Down Expand Up @@ -772,7 +772,7 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
}

const thread = data.addPullRequestReviewThread.thread;
const newThread = parseGraphQLReviewThread(thread, this.githubRepository);
const newThread = await parseGraphQLReviewThread(thread, this.githubRepository);
if (!this._reviewThreadsCache) {
this._reviewThreadsCache = [];
}
Expand Down Expand Up @@ -824,7 +824,7 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
}

const { comment } = data.addPullRequestReviewComment;
const newComment = parseGraphQLComment(comment, false, false, this.githubRepository);
const newComment = await parseGraphQLComment(comment, false, false, this.githubRepository);

if (isSingleComment) {
newComment.isDraft = false;
Expand Down Expand Up @@ -1023,7 +1023,7 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
throw new Error('Editing review comment failed.');
}

const newComment = parseGraphQLComment(
const newComment = await parseGraphQLComment(
data.updatePullRequestReviewComment.pullRequestReviewComment,
!!comment.isResolved,
!!comment.isOutdated,
Expand Down Expand Up @@ -1341,7 +1341,7 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
return [];
}

const reviewers: (IAccount | ITeam)[] = parseGraphQLReviewers(data, githubRepository);
const reviewers: (IAccount | ITeam)[] = await parseGraphQLReviewers(data, githubRepository);
if (this.reviewers?.length !== reviewers.length || (this.reviewers.some(r => !reviewers.some(rr => rr.id === r.id)))) {
this.reviewers = reviewers;
this._onDidChange.fire({ reviewers: true });
Expand Down Expand Up @@ -1452,8 +1452,8 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
});
}

private setReviewThreadCacheFromRaw(raw: ReviewThread[]): IReviewThread[] {
const reviewThreads: IReviewThread[] = raw.map(thread => parseGraphQLReviewThread(thread, this.githubRepository));
private async setReviewThreadCacheFromRaw(raw: ReviewThread[]): Promise<IReviewThread[]> {
const reviewThreads: IReviewThread[] = await Promise.all(raw.map(thread => parseGraphQLReviewThread(thread, this.githubRepository)));
const oldReviewThreads = this._reviewThreadsCache ?? [];
this._reviewThreadsCache = reviewThreads;
this.diffThreads(oldReviewThreads, reviewThreads);
Expand Down Expand Up @@ -1556,7 +1556,7 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
per_page: 100
});
const workStartedInitiator = (timeline.data.find(event => event.event === 'copilot_work_started') as { actor: RestAccount } | undefined)?.actor;
return workStartedInitiator ? [parseAccount(workStartedInitiator, this.githubRepository)] : [];
return workStartedInitiator ? [await parseAccount(workStartedInitiator, this.githubRepository)] : [];
}

protected override getUpdatesQuery(schema: any): any {
Expand Down Expand Up @@ -2105,7 +2105,7 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe

const index = this._reviewThreadsCache?.findIndex(thread => thread.id === threadId) ?? -1;
if (index > -1) {
const thread = parseGraphQLReviewThread(data.resolveReviewThread.thread, this.githubRepository);
const thread = await parseGraphQLReviewThread(data.resolveReviewThread.thread, this.githubRepository);
this._reviewThreadsCache?.splice(index, 1, thread);
this._onDidChangeReviewThreads.fire({ added: [], changed: [thread], removed: [] });
}
Expand Down Expand Up @@ -2148,7 +2148,7 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe

const index = this._reviewThreadsCache?.findIndex(thread => thread.id === threadId) ?? -1;
if (index > -1) {
const thread = parseGraphQLReviewThread(data.unresolveReviewThread.thread, this.githubRepository);
const thread = await parseGraphQLReviewThread(data.unresolveReviewThread.thread, this.githubRepository);
this._reviewThreadsCache?.splice(index, 1, thread);
this._onDidChangeReviewThreads.fire({ added: [], changed: [thread], removed: [] });
}
Expand Down
Loading
Loading