Skip to content

Commit c453eae

Browse files
Copilotalexr00
andcommitted
Use TabInputTextMultiDiff API instead of workaround
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 793ea80 commit c453eae

3 files changed

Lines changed: 8 additions & 21 deletions

File tree

src/@types/vscode.proposed.chatParticipantAdditions.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ declare module 'vscode' {
105105
isComplete?: boolean;
106106
toolSpecificData?: ChatTerminalToolInvocationData;
107107
fromSubAgent?: boolean;
108+
presentation?: 'hidden' | 'hiddenAfterComplete' | undefined;
108109

109110
constructor(toolName: string, toolCallId: string, isError?: boolean);
110111
}

src/@types/vscode.proposed.chatSessionsProvider.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ declare module 'vscode' {
9595
*/
9696
description?: string | MarkdownString;
9797

98+
/**
99+
* An optional badge that provides additional context about the chat session.
100+
*/
101+
badge?: string | MarkdownString;
102+
98103
/**
99104
* An optional status indicating the current state of the session.
100105
*/

src/view/reviewManager.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -675,34 +675,15 @@ export class ReviewManager extends Disposable {
675675
}
676676
}
677677

678-
private isKnownTabInputType(tabInput: unknown): boolean {
679-
// Note: This list includes all known TabInput types as of VS Code 1.107.0
680-
// If new TabInput types are added to the VS Code API, this list will need to be updated
681-
return (
682-
tabInput instanceof vscode.TabInputText ||
683-
tabInput instanceof vscode.TabInputTextDiff ||
684-
tabInput instanceof vscode.TabInputCustom ||
685-
tabInput instanceof vscode.TabInputWebview ||
686-
tabInput instanceof vscode.TabInputNotebook ||
687-
tabInput instanceof vscode.TabInputNotebookDiff ||
688-
tabInput instanceof vscode.TabInputTerminal
689-
);
690-
}
691-
692678
private async _closeOutdatedMultiDiffEditors(pullRequest: PullRequestModel): Promise<void> {
693679
// Close any multidiff editors for this PR that may be outdated
694-
// Since TabInputMultiDiff is not yet available in the VS Code API (https://github.com/microsoft/vscode/issues/206411),
695-
// we identify multidiff editors by their label pattern
696-
// Note: This label matching is dependent on the exact localized string format from PullRequestModel.openChanges()
697-
// If that format changes, this matching logic will need to be updated as well
698680
const multiDiffLabel = vscode.l10n.t('Changes in Pull Request #{0}', pullRequest.number);
699681

700682
const closePromises: Promise<boolean>[] = [];
701683
for (const tabGroup of vscode.window.tabGroups.all) {
702684
for (const tab of tabGroup.tabs) {
703-
// Multidiff editors have a specific label pattern and the input type is unknown
704-
// since TabInputMultiDiff doesn't exist yet
705-
if (tab.label === multiDiffLabel && !this.isKnownTabInputType(tab.input)) {
685+
// Check if this is a TabInputTextMultiDiff with matching label
686+
if (tab.input instanceof vscode.TabInputTextMultiDiff && tab.label === multiDiffLabel) {
706687
Logger.appendLine(`Closing outdated multidiff editor for PR #${pullRequest.number}`, this.id);
707688
closePromises.push(Promise.resolve(vscode.window.tabGroups.close(tab)));
708689
}

0 commit comments

Comments
 (0)