@@ -10,6 +10,7 @@ import {
1010 ListFeatureEvaluationsResponse ,
1111} from '../codewhisperer/client/codewhispereruserclient'
1212import * as vscode from 'vscode'
13+ import * as nls from 'vscode-nls'
1314import { codeWhispererClient as client } from '../codewhisperer/client/codewhisperer'
1415import { AuthUtil } from '../codewhisperer/util/authUtil'
1516import { getLogger } from './logger'
@@ -19,7 +20,9 @@ import globals from './extensionGlobals'
1920import { getClientId , getOperatingSystem } from './telemetry/util'
2021import { extensionVersion } from './vscode/env'
2122import { telemetry } from './telemetry'
22- import { Auth } from '../auth'
23+ import { Commands } from './vscode/commands2'
24+
25+ const localize = nls . loadMessageBundle ( )
2326
2427export class FeatureContext {
2528 constructor (
@@ -35,6 +38,7 @@ export const Features = {
3538 customizationArnOverride : 'customizationArnOverride' ,
3639 dataCollectionFeature : 'IDEProjectContextDataCollection' ,
3740 projectContextFeature : 'ProjectContextV2' ,
41+ workspaceContextFeature : 'WorkspaceContext' ,
3842 test : 'testFeature' ,
3943} as const
4044
@@ -83,6 +87,21 @@ export class FeatureConfigProvider {
8387 }
8488 }
8589
90+ getWorkspaceContextGroup ( ) : 'control' | 'treatment' {
91+ const variation = this . featureConfigs . get ( Features . projectContextFeature ) ?. variation
92+
93+ switch ( variation ) {
94+ case 'CONTROL' :
95+ return 'control'
96+
97+ case 'TREATMENT' :
98+ return 'treatment'
99+
100+ default :
101+ return 'control'
102+ }
103+ }
104+
86105 public async listFeatureEvaluations ( ) : Promise < ListFeatureEvaluationsResponse > {
87106 const request : ListFeatureEvaluationsRequest = {
88107 userContext : {
@@ -154,12 +173,26 @@ export class FeatureConfigProvider {
154173 await vscode . commands . executeCommand ( 'aws.amazonq.refreshStatusBar' )
155174 }
156175 }
157- if ( Auth . instance . isInternalAmazonUser ( ) ) {
176+ if ( this . getWorkspaceContextGroup ( ) === 'treatment' ) {
158177 // Enable local workspace index by default only once, for Amzn users.
159178 const isSet = globals . globalState . get < boolean > ( 'aws.amazonq.workspaceIndexToggleOn' ) || false
160179 if ( ! isSet ) {
161180 await CodeWhispererSettings . instance . enableLocalIndex ( )
162181 globals . globalState . tryUpdate ( 'aws.amazonq.workspaceIndexToggleOn' , true )
182+
183+ await vscode . window
184+ . showInformationMessage (
185+ localize (
186+ 'AWS.amazonq.chat.workspacecontext.enable.message' ,
187+ 'Amazon Q: Workspace index is now enabled. You can disable it from Amazon Q settings.'
188+ ) ,
189+ localize ( 'AWS.amazonq.opensettings' , 'Open settings' )
190+ )
191+ . then ( ( r ) => {
192+ if ( r === 'Open settings' ) {
193+ void Commands . tryExecute ( 'aws.amazonq.configure' ) . then ( )
194+ }
195+ } )
163196 }
164197 }
165198 } catch ( e ) {
0 commit comments