diff --git a/packages/core/package.nls.json b/packages/core/package.nls.json index bdccd0c9b6..da151459e3 100644 --- a/packages/core/package.nls.json +++ b/packages/core/package.nls.json @@ -295,6 +295,7 @@ "AWS.codewhisperer.customization.notification.new_customizations.learn_more": "Learn More", "AWS.amazonq.title": "Amazon Q", "AWS.amazonq.chat": "Chat", + "AWS.amazonq.chat.workspacecontext.enable.message": "Amazon Q: Workspace index is now enabled. You can disable it in the Amazon Q settings.", "AWS.amazonq.security": "Code Issues", "AWS.amazonq.login": "Login", "AWS.amazonq.learnMore": "Learn More About Amazon Q", @@ -404,6 +405,7 @@ "AWS.amazonq.doc.pillText.reject": "Reject", "AWS.amazonq.doc.pillText.makeChanges": "Make changes", "AWS.amazonq.inline.invokeChat": "Inline chat", + "AWS.amazonq.opensettings:": "Open settings", "AWS.toolkit.lambda.walkthrough.quickpickTitle": "Application Builder Walkthrough", "AWS.toolkit.lambda.walkthrough.title": "Get started building your application", "AWS.toolkit.lambda.walkthrough.description": "Your quick guide to build an application visually, iterate locally, and deploy to the cloud!", diff --git a/packages/core/src/shared/featureConfig.ts b/packages/core/src/shared/featureConfig.ts index 73eea42bbf..d61ca9abf5 100644 --- a/packages/core/src/shared/featureConfig.ts +++ b/packages/core/src/shared/featureConfig.ts @@ -10,6 +10,7 @@ import { ListFeatureEvaluationsResponse, } from '../codewhisperer/client/codewhispereruserclient' import * as vscode from 'vscode' +import * as nls from 'vscode-nls' import { codeWhispererClient as client } from '../codewhisperer/client/codewhisperer' import { AuthUtil } from '../codewhisperer/util/authUtil' import { getLogger } from './logger' @@ -19,7 +20,9 @@ import globals from './extensionGlobals' import { getClientId, getOperatingSystem } from './telemetry/util' import { extensionVersion } from './vscode/env' import { telemetry } from './telemetry' -import { Auth } from '../auth' +import { Commands } from './vscode/commands2' + +const localize = nls.loadMessageBundle() export class FeatureContext { constructor( @@ -35,6 +38,7 @@ export const Features = { customizationArnOverride: 'customizationArnOverride', dataCollectionFeature: 'IDEProjectContextDataCollection', projectContextFeature: 'ProjectContextV2', + workspaceContextFeature: 'WorkspaceContext', test: 'testFeature', } as const @@ -83,6 +87,21 @@ export class FeatureConfigProvider { } } + getWorkspaceContextGroup(): 'control' | 'treatment' { + const variation = this.featureConfigs.get(Features.projectContextFeature)?.variation + + switch (variation) { + case 'CONTROL': + return 'control' + + case 'TREATMENT': + return 'treatment' + + default: + return 'control' + } + } + public async listFeatureEvaluations(): Promise { const request: ListFeatureEvaluationsRequest = { userContext: { @@ -154,12 +173,27 @@ export class FeatureConfigProvider { await vscode.commands.executeCommand('aws.amazonq.refreshStatusBar') } } - if (Auth.instance.isInternalAmazonUser()) { + if (this.getWorkspaceContextGroup() === 'treatment') { // Enable local workspace index by default only once, for Amzn users. const isSet = globals.globalState.get('aws.amazonq.workspaceIndexToggleOn') || false if (!isSet) { await CodeWhispererSettings.instance.enableLocalIndex() globals.globalState.tryUpdate('aws.amazonq.workspaceIndexToggleOn', true) + + // todo: finalize string + await vscode.window + .showInformationMessage( + localize( + 'AWS.amazonq.chat.workspacecontext.enable.message', + 'Amazon Q: Workspace index is now enabled. You can disable it in the Amazon Q settings.' + ), + localize('AWS.amazonq.opensettings', 'Open settings') + ) + .then((r) => { + if (r === 'Open settings') { + Commands.tryExecute('aws.amazonq.configure') + } + }) } } } catch (e) {