@@ -94,6 +94,25 @@ const ASK_FOR_PUBLIC_CODE_MATCHES = false; // TODO@bpasero revisit this
9494const TRIGGER_SETUP_COMMAND_ID = 'workbench.action.chat.triggerSetup' ;
9595const TRIGGER_SETUP_COMMAND_LABEL = localize2 ( 'triggerChatSetup' , "Use AI Features with Copilot for Free..." ) ;
9696
97+ export const SetupWelcomeViewKeys = new Set ( [ ChatContextKeys . Setup . triggered . key , ChatContextKeys . Setup . installed . key , ChatContextKeys . Setup . signedOut . key , ChatContextKeys . Setup . canSignUp . key ] ) ;
98+ export const SetupWelcomeViewCondition = ContextKeyExpr . and (
99+ ContextKeyExpr . has ( 'config.chat.experimental.offerSetup' ) ,
100+ ContextKeyExpr . or (
101+ ContextKeyExpr . and (
102+ ChatContextKeys . Setup . triggered ,
103+ ChatContextKeys . Setup . installed . negate ( )
104+ ) ,
105+ ContextKeyExpr . and (
106+ ChatContextKeys . Setup . canSignUp ,
107+ ChatContextKeys . Setup . installed
108+ ) ,
109+ ContextKeyExpr . and (
110+ ChatContextKeys . Setup . signedOut ,
111+ ChatContextKeys . Setup . installed
112+ )
113+ )
114+ ) ! ;
115+
97116export class ChatSetupContribution extends Disposable implements IWorkbenchContribution {
98117
99118 static readonly ID = 'workbench.chat.setup' ;
@@ -119,23 +138,7 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
119138 private registerChatWelcome ( ) : void {
120139 Registry . as < IChatViewsWelcomeContributionRegistry > ( ChatViewsWelcomeExtensions . ChatViewsWelcomeRegistry ) . register ( {
121140 title : localize ( 'welcomeChat' , "Welcome to Copilot" ) ,
122- when : ContextKeyExpr . and (
123- ContextKeyExpr . has ( 'config.chat.experimental.offerSetup' ) ,
124- ContextKeyExpr . or (
125- ContextKeyExpr . and (
126- ChatContextKeys . Setup . triggered ,
127- ChatContextKeys . Setup . installed . negate ( )
128- ) ,
129- ContextKeyExpr . and (
130- ChatContextKeys . Setup . canSignUp ,
131- ChatContextKeys . Setup . installed
132- ) ,
133- ContextKeyExpr . and (
134- ChatContextKeys . Setup . signedOut ,
135- ChatContextKeys . Setup . installed
136- )
137- )
138- ) ! ,
141+ when : SetupWelcomeViewCondition ,
139142 icon : Codicon . copilotLarge ,
140143 content : disposables => disposables . add ( this . instantiationService . createInstance ( ChatSetupWelcomeContent , this . controller . value , this . context ) ) . element ,
141144 } ) ;
0 commit comments