File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ import software.aws.toolkits.core.utils.warn
1717import software.aws.toolkits.jetbrains.core.credentials.AwsBearerTokenConnection
1818import software.aws.toolkits.jetbrains.core.credentials.ToolkitConnectionManager
1919import software.aws.toolkits.jetbrains.core.credentials.pinning.QConnection
20- import software.aws.toolkits.jetbrains.core.credentials.sono.isInternalUser
2120import software.aws.toolkits.jetbrains.core.gettingstarted.emitUserState
21+ import software.aws.toolkits.jetbrains.services.amazonq.CodeWhispererFeatureConfigService
2222import software.aws.toolkits.jetbrains.services.amazonq.project.ProjectContextController
2323import software.aws.toolkits.jetbrains.services.amazonq.toolwindow.AmazonQToolWindow
2424import software.aws.toolkits.jetbrains.services.amazonq.toolwindow.AmazonQToolWindowFactory
@@ -35,9 +35,15 @@ class AmazonQStartupActivity : ProjectActivity {
3535 override suspend fun execute (project : Project ) {
3636 if (ApplicationManager .getApplication().isUnitTestMode) return
3737
38+ // Turn on project context if a user is in treatment group and prompt UI to notify them
3839 ToolkitConnectionManager .getInstance(project).activeConnectionForFeature(QConnection .getInstance())?.let {
39- if (it is AwsBearerTokenConnection && isInternalUser(it.startUrl)) {
40+ if (it is AwsBearerTokenConnection &&
41+ CodeWhispererFeatureConfigService .getInstance().getWorkspaceContext() &&
42+ ! CodeWhispererSettings .getInstance().isProjectContextEnabled()
43+ ) {
4044 CodeWhispererSettings .getInstance().toggleProjectContextEnabled(value = true , passive = true )
45+
46+ // TODO: toast notification UI
4147 }
4248 }
4349
Original file line number Diff line number Diff line change @@ -115,6 +115,8 @@ class CodeWhispererFeatureConfigService {
115115
116116 fun getInlineCompletion (): Boolean = getFeatureValueForKey(INLINE_COMPLETION ).stringValue() == " TREATMENT"
117117
118+ fun getWorkspaceContext (): Boolean = getFeatureValueForKey(WORKSPACE_CONTEXT_FEATURE ).stringValue() == " TREATMENT"
119+
118120 // Get the feature value for the given key.
119121 // In case of a misconfiguration, it will return a default feature value of Boolean false.
120122 private fun getFeatureValueForKey (name : String ): FeatureValue =
@@ -133,6 +135,7 @@ class CodeWhispererFeatureConfigService {
133135 private const val INLINE_COMPLETION = " ProjectContextV2"
134136 const val CUSTOMIZATION_ARN_OVERRIDE_NAME = " customizationArnOverride"
135137 private const val NEW_AUTO_TRIGGER_UX = " newAutoTriggerUX"
138+ private const val WORKSPACE_CONTEXT_FEATURE = " WorkspaceContext"
136139 private val LOG = getLogger<CodeWhispererFeatureConfigService >()
137140
138141 // TODO: add real feature later
@@ -158,6 +161,11 @@ class CodeWhispererFeatureConfigService {
158161 INLINE_COMPLETION ,
159162 " CONTROL" ,
160163 FeatureValue .builder().stringValue(" CONTROL" ).build()
164+ ),
165+ WORKSPACE_CONTEXT_FEATURE to FeatureContext (
166+ WORKSPACE_CONTEXT_FEATURE ,
167+ " CONTROL" ,
168+ FeatureValue .builder().stringValue(" CONTROL" ).build()
161169 )
162170 )
163171 }
You can’t perform that action at this time.
0 commit comments