Skip to content

Commit 372134d

Browse files
authored
Hide welcome view if chat view was moved independent of view container (microsoft#232173)
* don't show the welcome view if the chat view has not been moved * reorder for clarity
1 parent 72bc3f9 commit 372134d

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { IViewContainersRegistry, IViewDescriptor, IViewDescriptorService, IView
2626
import { IPaneCompositePartService } from '../../../services/panecomposite/browser/panecomposite.js';
2727
import { IViewsService } from '../../../services/views/common/viewsService.js';
2828
import { CONTEXT_CHAT_EXTENSION_INVALID, CONTEXT_CHAT_PANEL_PARTICIPANT_REGISTERED, CONTEXT_CHAT_SHOULD_SHOW_MOVED_VIEW_WELCOME } from '../common/chatContextKeys.js';
29-
import { showChatView } from './chat.js';
29+
import { CHAT_VIEW_ID, showChatView } from './chat.js';
3030
import { CHAT_SIDEBAR_OLD_VIEW_PANEL_ID, CHAT_SIDEBAR_PANEL_ID } from './chatViewPane.js';
3131

3232
// TODO@bpasero TODO@sbatten remove after a few months
@@ -64,7 +64,7 @@ export class MoveChatViewContribution implements IWorkbenchContribution {
6464
this.registerListeners();
6565
this.registerCommands();
6666
this.registerMovedChatWelcomeView();
67-
this.hideViewIfOldViewIsInSecondarySidebar();
67+
this.hideViewIfOldViewIsMovedFromDefaultLocation();
6868
}
6969

7070
private markViewToHide(): void {
@@ -80,7 +80,20 @@ export class MoveChatViewContribution implements IWorkbenchContribution {
8080
}
8181
}
8282

83-
private hideViewIfOldViewIsInSecondarySidebar(): void {
83+
private hideViewIfOldViewIsMovedFromDefaultLocation(): void {
84+
// If the chat view is not actually moved to the new view container, then we should hide the welcome view.
85+
const newViewContainer = this.viewDescriptorService.getViewContainerById(CHAT_SIDEBAR_PANEL_ID);
86+
if (!newViewContainer) {
87+
return;
88+
}
89+
90+
const currentChatViewContainer = this.viewDescriptorService.getViewContainerByViewId(CHAT_VIEW_ID);
91+
if (currentChatViewContainer !== newViewContainer) {
92+
this.markViewToHide();
93+
return;
94+
}
95+
96+
// If the chat view is in the new location, but the old view container was in the auxiliary bar anyway, then we should hide the welcome view.
8497
const oldViewContainer = this.viewDescriptorService.getViewContainerById(CHAT_SIDEBAR_OLD_VIEW_PANEL_ID);
8598
if (!oldViewContainer) {
8699
return;

0 commit comments

Comments
 (0)