Skip to content

Commit afad311

Browse files
authored
Always show chat welcome view when signed out (microsoft#235428)
1 parent 055f83c commit afad311

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/vs/workbench/contrib/chat/browser/chatViewPane.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { SIDE_BAR_FOREGROUND } from '../../../common/theme.js';
2626
import { IViewDescriptorService } from '../../../common/views.js';
2727
import { IChatViewTitleActionContext } from '../common/chatActions.js';
2828
import { ChatAgentLocation, IChatAgentService } from '../common/chatAgents.js';
29+
import { ChatContextKeys } from '../common/chatContextKeys.js';
2930
import { ChatModelInitState, IChatModel } from '../common/chatModel.js';
3031
import { CHAT_PROVIDER_ID } from '../common/chatParticipantContribTypes.js';
3132
import { IChatService } from '../common/chatService.js';
@@ -99,6 +100,13 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
99100

100101
this._onDidChangeViewWelcomeState.fire();
101102
}));
103+
104+
const keysToWatch = new Set(ChatContextKeys.Setup.signedOut.key);
105+
this._register(this.contextKeyService.onDidChangeContext(e => {
106+
if (e.affectsSome(keysToWatch)) {
107+
this._onDidChangeViewWelcomeState.fire();
108+
}
109+
}));
102110
}
103111

104112
override getActionsContext(): IChatViewTitleActionContext | undefined {
@@ -130,10 +138,11 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
130138
}
131139

132140
override shouldShowWelcome(): boolean {
141+
const signedOut = this.contextKeyService.getContextKeyValue<boolean>(ChatContextKeys.Setup.signedOut.key);
133142
const noPersistedSessions = !this.chatService.hasSessions();
134-
const shouldShow = this.didUnregisterProvider || !this._widget?.viewModel && noPersistedSessions || this.defaultParticipantRegistrationFailed;
135-
this.logService.trace(`ChatViewPane#shouldShowWelcome(${this.chatOptions.location}) = ${shouldShow}: didUnregister=${this.didUnregisterProvider} || noViewModel:${!this._widget?.viewModel} && noPersistedSessions=${noPersistedSessions} || defaultParticipantRegistrationFailed=${this.defaultParticipantRegistrationFailed}`);
136-
return shouldShow;
143+
const shouldShow = this.didUnregisterProvider || !this._widget?.viewModel && noPersistedSessions || this.defaultParticipantRegistrationFailed || signedOut;
144+
this.logService.trace(`ChatViewPane#shouldShowWelcome(${this.chatOptions.location}) = ${shouldShow}: didUnregister=${this.didUnregisterProvider} || noViewModel:${!this._widget?.viewModel} && noPersistedSessions=${noPersistedSessions} || defaultParticipantRegistrationFailed=${this.defaultParticipantRegistrationFailed} || signedOut=${signedOut}`);
145+
return !!shouldShow;
137146
}
138147

139148
private getSessionId() {

0 commit comments

Comments
 (0)