@@ -105,8 +105,6 @@ export async function activate(context: ExtContext): Promise<void> {
105105 // Import old CodeWhisperer settings into Amazon Q
106106 await CodeWhispererSettings . instance . importSettings ( )
107107
108- const auth = AuthUtil . instance
109-
110108 // TODO: is this indirection useful?
111109 registerDeclaredCommands (
112110 context . extensionContext . subscriptions ,
@@ -157,7 +155,7 @@ export async function activate(context: ExtContext): Promise<void> {
157155
158156 if ( configurationChangeEvent . affectsConfiguration ( 'amazonQ.showCodeWithReferences' ) ) {
159157 ReferenceLogViewProvider . instance . update ( )
160- if ( auth . isIdcConnection ( ) ) {
158+ if ( AuthUtil . instance . isIdcConnection ( ) ) {
161159 await vscode . window
162160 . showInformationMessage (
163161 CodeWhispererConstants . ssoConfigAlertMessage ,
@@ -172,7 +170,7 @@ export async function activate(context: ExtContext): Promise<void> {
172170 }
173171
174172 if ( configurationChangeEvent . affectsConfiguration ( 'amazonQ.shareContentWithAWS' ) ) {
175- if ( auth . isIdcConnection ( ) ) {
173+ if ( AuthUtil . instance . isIdcConnection ( ) ) {
176174 await vscode . window
177175 . showInformationMessage (
178176 CodeWhispererConstants . ssoConfigAlertMessageShareData ,
@@ -342,7 +340,7 @@ export async function activate(context: ExtContext): Promise<void> {
342340 SecurityIssueCodeActionProvider . instance
343341 ) ,
344342 vscode . commands . registerCommand ( 'aws.amazonq.openEditorAtRange' , openEditorAtRange ) ,
345- auth . regionProfileManager . onDidChangeRegionProfile ( ( ) => {
343+ AuthUtil . instance . regionProfileManager . onDidChangeRegionProfile ( ( ) => {
346344 // Validate user still has access to the selected customization.
347345 const selectedCustomization = getSelectedCustomization ( )
348346 // No need to validate base customization which has empty arn.
@@ -367,27 +365,27 @@ export async function activate(context: ExtContext): Promise<void> {
367365 // run the auth startup code with context for telemetry
368366 await telemetry . function_call . run (
369367 async ( ) => {
370- if ( auth . isConnectionExpired ( ) ) {
371- auth . showReauthenticatePrompt ( ) . catch ( ( e ) => {
368+ if ( AuthUtil . instance . isConnectionExpired ( ) ) {
369+ AuthUtil . instance . showReauthenticatePrompt ( ) . catch ( ( e ) => {
372370 const defaulMsg = localize ( 'AWS.generic.message.error' , 'Failed to reauth:' )
373371 void logAndShowError ( localize , e , 'showReauthenticatePrompt' , defaulMsg )
374372 } )
375- if ( auth . isIdcConnection ( ) ) {
376- await auth . notifySessionConfiguration ( )
373+ if ( AuthUtil . instance . isIdcConnection ( ) ) {
374+ await AuthUtil . instance . notifySessionConfiguration ( )
377375 }
378376 }
379377
380- if ( auth . requireProfileSelection ( ) ) {
378+ if ( AuthUtil . instance . regionProfileManager . requireProfileSelection ( ) ) {
381379 await notifySelectDeveloperProfile ( )
382380 }
383381 } ,
384382 { emit : false , functionId : { name : 'activateCwCore' } }
385383 )
386384
387- if ( auth . isIdcConnection ( ) && auth . isConnected ( ) ) {
385+ if ( AuthUtil . instance . isIdcConnection ( ) && AuthUtil . instance . isConnected ( ) ) {
388386 await notifyNewCustomizations ( )
389387 }
390- if ( auth . isBuilderIdConnection ( ) ) {
388+ if ( AuthUtil . instance . isBuilderIdConnection ( ) ) {
391389 await CodeScansState . instance . setScansEnabled ( false )
392390 }
393391
@@ -402,8 +400,8 @@ export async function activate(context: ExtContext): Promise<void> {
402400 return (
403401 ( isScansEnabled ?? CodeScansState . instance . isScansEnabled ( ) ) &&
404402 ! CodeScansState . instance . isMonthlyQuotaExceeded ( ) &&
405- auth . isConnected ( ) &&
406- ! auth . isBuilderIdConnection ( ) &&
403+ AuthUtil . instance . isConnected ( ) &&
404+ ! AuthUtil . instance . isBuilderIdConnection ( ) &&
407405 editor &&
408406 editor . document . uri . scheme === 'file' &&
409407 securityScanLanguageContext . isLanguageSupported ( editor . document . languageId )
0 commit comments