diff --git a/package.json b/package.json index 121adffe67..8ee59c8d9c 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "quickDiffProvider", "remoteCodingAgents", "shareProvider", + "tabInputMultiDiff", "tokenInformation", "treeItemMarkdownLabel", "treeViewMarkdownMessage" 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/@types/vscode.proposed.chatSessionsProvider.d.ts b/src/@types/vscode.proposed.chatSessionsProvider.d.ts index bd4e624430..772fc387b9 100644 --- a/src/@types/vscode.proposed.chatSessionsProvider.d.ts +++ b/src/@types/vscode.proposed.chatSessionsProvider.d.ts @@ -95,6 +95,11 @@ declare module 'vscode' { */ description?: string | MarkdownString; + /** + * An optional badge that provides additional context about the chat session. + */ + badge?: string | MarkdownString; + /** * An optional status indicating the current state of the session. */ diff --git a/src/@types/vscode.proposed.tabInputMultiDiff.d.ts b/src/@types/vscode.proposed.tabInputMultiDiff.d.ts new file mode 100644 index 0000000000..242ebf4ada --- /dev/null +++ b/src/@types/vscode.proposed.tabInputMultiDiff.d.ts @@ -0,0 +1,22 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// https://github.com/microsoft/vscode/issues/206411 + +declare module 'vscode' { + + export class TabInputTextMultiDiff { + + readonly textDiffs: TabInputTextDiff[]; + + constructor(textDiffs: TabInputTextDiff[]); + } + + export interface Tab { + + readonly input: TabInputText | TabInputTextDiff | TabInputTextMultiDiff | TabInputCustom | TabInputWebview | TabInputNotebook | TabInputNotebookDiff | TabInputTerminal | unknown; + + } +} diff --git a/src/view/reviewManager.ts b/src/view/reviewManager.ts index b9c31fac14..c5fff04131 100644 --- a/src/view/reviewManager.ts +++ b/src/view/reviewManager.ts @@ -675,7 +675,27 @@ export class ReviewManager extends Disposable { } } + private async _closeOutdatedMultiDiffEditors(pullRequest: PullRequestModel): Promise { + // Close any multidiff editors for this PR that may be outdated + const multiDiffLabel = vscode.l10n.t('Changes in Pull Request #{0}', pullRequest.number); + + const closePromises: Promise[] = []; + for (const tabGroup of vscode.window.tabGroups.all) { + for (const tab of tabGroup.tabs) { + // Check if this is a TabInputTextMultiDiff with matching label + if (tab.input instanceof vscode.TabInputTextMultiDiff && tab.label.startsWith(multiDiffLabel)) { + Logger.appendLine(`Closing outdated multidiff editor for PR #${pullRequest.number}`, this.id); + closePromises.push(Promise.resolve(vscode.window.tabGroups.close(tab))); + } + } + } + await Promise.all(closePromises); + } + public async _upgradePullRequestEditors(pullRequest: PullRequestModel) { + // Close any outdated multidiff editors first + await this._closeOutdatedMultiDiffEditors(pullRequest); + // Go through all open editors and find pr scheme editors that belong to the active pull request. // Close the editors, and reopen them from the pull request. const reopenFilenames: Set<[PRUriParams, PRUriParams]> = new Set();