Skip to content

Commit dafd758

Browse files
authored
Don't register view container if we know it will be hidden (microsoft#232309)
just skip the registration if we have state to hide keep keybinding
1 parent ffe7f57 commit dafd758

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/vs/workbench/contrib/chat/browser/chatMovedView.contribution.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,18 @@ export class MoveChatViewContribution implements IWorkbenchContribution {
6161
}
6262

6363
private async initialize(): Promise<void> {
64+
const hidden = this.storageService.getBoolean(MoveChatViewContribution.hideMovedChatWelcomeViewStorageKey, StorageScope.APPLICATION, false);
65+
66+
// If the view is already hidden, then we just want to register keybindings.
67+
if (hidden) {
68+
this.registerKeybindings();
69+
return;
70+
}
71+
6472
await this.hideViewIfCopilotIsNotInstalled();
6573
this.updateContextKey();
6674
this.registerListeners();
75+
this.registerKeybindings();
6776
this.registerCommands();
6877
this.registerMovedChatWelcomeView();
6978
this.hideViewIfOldViewIsMovedFromDefaultLocation();
@@ -116,15 +125,17 @@ export class MoveChatViewContribution implements IWorkbenchContribution {
116125
this.storageService.onDidChangeValue(StorageScope.APPLICATION, MoveChatViewContribution.hideMovedChatWelcomeViewStorageKey, new DisposableStore())(() => this.updateContextKey());
117126
}
118127

119-
private registerCommands(): void {
128+
private registerKeybindings(): void {
120129
KeybindingsRegistry.registerCommandAndKeybindingRule({
121130
id: CHAT_SIDEBAR_OLD_VIEW_PANEL_ID,
122131
weight: KeybindingWeight.WorkbenchContrib,
123132
when: CONTEXT_CHAT_PANEL_PARTICIPANT_REGISTERED,
124133
primary: 0,
125134
handler: accessor => showChatView(accessor.get(IViewsService))
126135
});
136+
}
127137

138+
private registerCommands(): void {
128139
CommandsRegistry.registerCommand({
129140
id: '_chatMovedViewWelcomeView.ok',
130141
handler: async (accessor: ServicesAccessor) => {

0 commit comments

Comments
 (0)