Skip to content

Commit 001bf72

Browse files
Copilotalexr00
andauthored
Add notification when branch is auto-deleted after merge (#8377)
* Initial plan * Initial plan: Add notification for branch auto-deletion after merge Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> * Add notification when branch is auto-deleted after merge Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> * Improve notification to handle both local and remote branch deletion Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> * Fix notification to only mention branch switch when branch was active Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> * Remove localized fallback for branch name in notification Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> * Simplify notification logic by removing isBranchActive check Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> * Copilot PR feedback --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 7390c8f commit 001bf72

2 files changed

Lines changed: 33 additions & 21 deletions

File tree

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

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,6 @@ declare module 'vscode' {
4949
*/
5050
readonly onDidCommitChatSessionItem: Event<{ original: ChatSessionItem /** untitled */; modified: ChatSessionItem /** newly created */ }>;
5151

52-
/**
53-
* DEPRECATED: Will be removed!
54-
* Creates a new chat session.
55-
*
56-
* @param options Options for the new session including an optional initial prompt and history
57-
* @param token A cancellation token
58-
* @returns Metadata for the chat session
59-
*/
60-
provideNewChatSessionItem?(options: {
61-
/**
62-
* The chat request that initiated the session creation
63-
*/
64-
readonly request: ChatRequest;
65-
66-
/**
67-
* Additional metadata to use for session creation
68-
*/
69-
metadata?: any;
70-
}, token: CancellationToken): ProviderResult<ChatSessionItem>;
71-
7252
// #endregion
7353
}
7454

@@ -241,6 +221,14 @@ declare module 'vscode' {
241221
*/
242222
readonly onDidChangeChatSessionOptions?: Event<ChatSessionOptionChangeEvent>;
243223

224+
/**
225+
* Event that the provider can fire to signal that the available provider options have changed.
226+
*
227+
* When fired, the editor will re-query {@link ChatSessionContentProvider.provideChatSessionProviderOptions}
228+
* and update the UI to reflect the new option groups.
229+
*/
230+
readonly onDidChangeChatSessionProviderOptions?: Event<void>;
231+
244232
/**
245233
* Provides the chat session content for a given uri.
246234
*

src/github/pullRequestReviewCommon.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,30 @@ export namespace PullRequestReviewCommon {
462462
}
463463

464464
// Execute all deletions in parallel
465-
await performBranchDeletion(folderRepositoryManager, item, defaultBranch, branchInfo!, selectedActions);
465+
const deletedBranchTypes = await performBranchDeletion(folderRepositoryManager, item, defaultBranch, branchInfo!, selectedActions);
466+
467+
// Show notification to the user about what was deleted
468+
if (deletedBranchTypes.length > 0) {
469+
const wasLocalDeleted = deletedBranchTypes.includes('local');
470+
const wasRemoteDeleted = deletedBranchTypes.includes('remoteHead') || deletedBranchTypes.includes('remote');
471+
const branchName = branchInfo?.branch || item.head?.ref;
472+
473+
// Only show notification if we have a branch name
474+
if (branchName) {
475+
if (wasLocalDeleted && wasRemoteDeleted) {
476+
vscode.window.showInformationMessage(
477+
vscode.l10n.t('Deleted local and remote branches for {0}.', branchName)
478+
);
479+
} else if (wasLocalDeleted) {
480+
vscode.window.showInformationMessage(
481+
vscode.l10n.t('Deleted local branch {0}.', branchName)
482+
);
483+
} else {
484+
vscode.window.showInformationMessage(
485+
vscode.l10n.t('Deleted remote branch {0}.', branchName)
486+
);
487+
}
488+
}
489+
}
466490
}
467491
}

0 commit comments

Comments
 (0)