Skip to content

Commit 0a35317

Browse files
committed
Add chat setup view for all users out of the box to secondary sidebar (fix microsoft/vscode-copilot#11195)
1 parent 37249cb commit 0a35317

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ export class ChatExtensionPointHandler implements IWorkbenchContribution {
312312
},
313313
ctorDescriptor: new SyncDescriptor(ChatViewPane, [{ location: ChatAgentLocation.Panel }]),
314314
when: ContextKeyExpr.or(
315-
ChatContextKeys.Setup.triggered,
315+
ChatContextKeys.Setup.hidden.negate(),
316316
ChatContextKeys.Setup.installed,
317317
ChatContextKeys.panelParticipantRegistered,
318318
ChatContextKeys.extensionInvalid

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
169169
const configurationService = accessor.get(IConfigurationService);
170170
const layoutService = accessor.get(IWorkbenchLayoutService);
171171

172-
await that.context.update({ triggered: true });
172+
await that.context.update({ hidden: false });
173173

174174
showCopilotView(viewsService, layoutService);
175175
ensureSideBarChatViewSize(400, viewDescriptorService, layoutService);
@@ -282,7 +282,7 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
282282
async function hideSetupView(viewsDescriptorService: IViewDescriptorService, layoutService: IWorkbenchLayoutService): Promise<void> {
283283
const location = viewsDescriptorService.getViewLocationById(ChatViewId);
284284

285-
await that.context.update({ triggered: false });
285+
await that.context.update({ hidden: true });
286286

287287
if (location === ViewContainerLocation.AuxiliaryBar) {
288288
const activeContainers = viewsDescriptorService.getViewContainersByLocation(location).filter(container => viewsDescriptorService.getViewContainerModel(container).activeViewDescriptors.length > 0);
@@ -1020,7 +1020,7 @@ class ChatSetupWelcomeContent extends Disposable {
10201020

10211021
interface IChatSetupContextState {
10221022
entitlement: ChatEntitlement;
1023-
triggered?: boolean;
1023+
hidden?: boolean;
10241024
installed?: boolean;
10251025
registered?: boolean;
10261026
}
@@ -1033,7 +1033,7 @@ class ChatSetupContext extends Disposable {
10331033
private readonly signedOutContextKey = ChatContextKeys.Setup.signedOut.bindTo(this.contextKeyService);
10341034
private readonly limitedContextKey = ChatContextKeys.Setup.limited.bindTo(this.contextKeyService);
10351035
private readonly proContextKey = ChatContextKeys.Setup.pro.bindTo(this.contextKeyService);
1036-
private readonly triggeredContext = ChatContextKeys.Setup.triggered.bindTo(this.contextKeyService);
1036+
private readonly hiddenContext = ChatContextKeys.Setup.hidden.bindTo(this.contextKeyService);
10371037
private readonly installedContext = ChatContextKeys.Setup.installed.bindTo(this.contextKeyService);
10381038

10391039
private _state: IChatSetupContextState = this.storageService.getObject<IChatSetupContextState>(ChatSetupContext.CHAT_SETUP_CONTEXT_STORAGE_KEY, StorageScope.PROFILE) ?? { entitlement: ChatEntitlement.Unknown };
@@ -1078,21 +1078,21 @@ class ChatSetupContext extends Disposable {
10781078
}
10791079

10801080
update(context: { installed: boolean }): Promise<void>;
1081-
update(context: { triggered: boolean }): Promise<void>;
1081+
update(context: { hidden: boolean }): Promise<void>;
10821082
update(context: { entitlement: ChatEntitlement }): Promise<void>;
1083-
update(context: { installed?: boolean; triggered?: boolean; entitlement?: ChatEntitlement }): Promise<void> {
1083+
update(context: { installed?: boolean; hidden?: boolean; entitlement?: ChatEntitlement }): Promise<void> {
10841084
this.logService.trace(`[chat setup] update(): ${JSON.stringify(context)}`);
10851085

10861086
if (typeof context.installed === 'boolean') {
10871087
this._state.installed = context.installed;
10881088

10891089
if (context.installed) {
1090-
context.triggered = true; // allows to fallback to setup view if the extension is uninstalled
1090+
context.hidden = false; // allows to fallback to setup view if the extension is uninstalled
10911091
}
10921092
}
10931093

1094-
if (typeof context.triggered === 'boolean') {
1095-
this._state.triggered = context.triggered;
1094+
if (typeof context.hidden === 'boolean') {
1095+
this._state.hidden = context.hidden;
10961096
}
10971097

10981098
if (typeof context.entitlement === 'number') {
@@ -1119,7 +1119,7 @@ class ChatSetupContext extends Disposable {
11191119
private updateContextSync(): void {
11201120
this.logService.trace(`[chat setup] updateContext(): ${JSON.stringify(this._state)}`);
11211121

1122-
if (this._state.triggered && !this._state.installed) {
1122+
if (!this._state.hidden && !this._state.installed) {
11231123
// this is ugly but fixes flicker from a previous chat install
11241124
this.storageService.remove('chat.welcomeMessageContent.panel', StorageScope.APPLICATION);
11251125
this.storageService.remove('interactive.sessions', this.workspaceContextService.getWorkspace().folders.length ? StorageScope.WORKSPACE : StorageScope.APPLICATION);
@@ -1129,7 +1129,7 @@ class ChatSetupContext extends Disposable {
11291129
this.canSignUpContextKey.set(this._state.entitlement === ChatEntitlement.Available);
11301130
this.limitedContextKey.set(this._state.entitlement === ChatEntitlement.Limited);
11311131
this.proContextKey.set(this._state.entitlement === ChatEntitlement.Pro);
1132-
this.triggeredContext.set(!!this._state.triggered);
1132+
this.hiddenContext.set(!!this._state.hidden);
11331133
this.installedContext.set(!!this._state.installed);
11341134

11351135
this._onDidChange.fire();

src/vs/workbench/contrib/chat/common/chatContextKeys.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export namespace ChatContextKeys {
5151

5252
// State
5353
signedOut: new RawContextKey<boolean>('chatSetupSignedOut', false, true), // True when user is signed out.
54-
triggered: new RawContextKey<boolean>('chatSetupTriggered', false, true), // True when chat setup is triggered.
54+
hidden: new RawContextKey<boolean>('chatSetupHidden', false, true), // True when chat setup is explicitly hidden.
5555
installed: new RawContextKey<boolean>('chatSetupInstalled', false, true), // True when the chat extension is installed.
5656

5757
// Plans
@@ -60,10 +60,10 @@ export namespace ChatContextKeys {
6060
pro: new RawContextKey<boolean>('chatPlanPro', false, true) // True when user is a chat pro user.
6161
};
6262

63-
export const SetupViewKeys = new Set([ChatContextKeys.Setup.triggered.key, ChatContextKeys.Setup.installed.key, ChatContextKeys.Setup.signedOut.key, ChatContextKeys.Setup.canSignUp.key]);
63+
export const SetupViewKeys = new Set([ChatContextKeys.Setup.hidden.key, ChatContextKeys.Setup.installed.key, ChatContextKeys.Setup.signedOut.key, ChatContextKeys.Setup.canSignUp.key]);
6464
export const SetupViewCondition = ContextKeyExpr.or(
6565
ContextKeyExpr.and(
66-
ChatContextKeys.Setup.triggered,
66+
ChatContextKeys.Setup.hidden.negate(),
6767
ChatContextKeys.Setup.installed.negate()
6868
),
6969
ContextKeyExpr.and(

0 commit comments

Comments
 (0)