@@ -7,29 +7,22 @@ import * as vscode from 'vscode'
77import { activateAmazonQCommon , amazonQContextPrefix , deactivateCommon } from './extension'
88import { DefaultAmazonQAppInitContext } from 'aws-core-vscode/amazonq'
99import { activate as activateQGumby } from 'aws-core-vscode/amazonqGumby'
10- import {
11- ExtContext ,
12- globals ,
13- CrashMonitoring ,
14- getLogger ,
15- isNetworkError ,
16- isSageMaker ,
17- Experiments ,
18- } from 'aws-core-vscode/shared'
10+ import { ExtContext , globals , CrashMonitoring /* getLogger, isSageMaker,*/ , Experiments } from 'aws-core-vscode/shared'
1911import { filetypes , SchemaService } from 'aws-core-vscode/sharedNode'
2012import { updateDevMode } from 'aws-core-vscode/dev'
2113import { CommonAuthViewProvider } from 'aws-core-vscode/login'
2214import { isExtensionActive , VSCODE_EXTENSION_ID } from 'aws-core-vscode/utils'
2315import { registerSubmitFeedback } from 'aws-core-vscode/feedback'
2416import { DevOptions } from 'aws-core-vscode/dev'
25- import { Auth , AuthUtils , getTelemetryMetadataForConn , isAnySsoConnection } from 'aws-core-vscode/auth'
17+ import { Auth /* , AuthUtils, getTelemetryMetadataForConn, isAnySsoConnection*/ } from 'aws-core-vscode/auth'
2618import api from './api'
2719import { activate as activateCWChat } from './app/chat/activation'
2820import { activate as activateInlineChat } from './inlineChat/activation'
2921import { beta } from 'aws-core-vscode/dev'
30- import { activate as activateNotifications , NotificationsController } from 'aws-core-vscode/notifications'
31- import { AuthState , AuthUtil } from 'aws-core-vscode/codewhisperer'
32- import { telemetry , AuthUserState } from 'aws-core-vscode/telemetry'
22+ import * as amazonq from 'aws-core-vscode/amazonq'
23+ import { /* activate as activateNotifications,*/ NotificationsController } from 'aws-core-vscode/notifications'
24+ // import { AuthState, AuthUtil } from 'aws-core-vscode/codewhisperer'
25+ // import { telemetry, AuthUserState } from 'aws-core-vscode/telemetry'
3326
3427export async function activate ( context : vscode . ExtensionContext ) {
3528 // IMPORTANT: No other code should be added to this function. Place it in one of the following 2 functions where appropriate.
@@ -58,6 +51,8 @@ async function activateAmazonQNode(context: vscode.ExtensionContext) {
5851 }
5952 activateInlineChat ( context )
6053
54+ context . subscriptions . push ( amazonq . focusAmazonQPanel . register ( ) , amazonq . focusAmazonQPanelKeybinding . register ( ) )
55+
6156 const authProvider = new CommonAuthViewProvider (
6257 context ,
6358 amazonQContextPrefix ,
@@ -78,49 +73,34 @@ async function activateAmazonQNode(context: vscode.ExtensionContext) {
7873 await setupDevMode ( context )
7974 await beta . activate ( context )
8075
81- // TODO: Should probably emit for web as well.
76+ // TODO: @opieter Fix telemetry
8277 // Will the web metric look the same?
83- telemetry . auth_userState . emit ( {
84- passive : true ,
85- result : 'Succeeded' ,
86- source : AuthUtils . ExtensionUse . instance . sourceForTelemetry ( ) ,
87- ...( await getAuthState ( ) ) ,
88- } )
89-
90- void activateNotifications ( context , getAuthState )
78+ // telemetry.auth_userState.emit({
79+ // passive: true,
80+ // result: 'Succeeded',
81+ // source: AuthUtils.ExtensionUse.instance.sourceForTelemetry(),
82+ // ...(await getAuthState()),
83+ // })
84+
85+ // void activateNotifications(context, getAuthState)
9186}
9287
93- async function getAuthState ( ) : Promise < Omit < AuthUserState , 'source' > > {
94- let authState : AuthState = 'disconnected'
95- try {
96- // May call connection validate functions that try to refresh the token.
97- // This could result in network errors.
98- authState = ( await AuthUtil . instance . _getChatAuthState ( false ) ) . codewhispererChat
99- } catch ( err ) {
100- if (
101- isNetworkError ( err ) &&
102- AuthUtil . instance . conn &&
103- AuthUtil . instance . auth . getConnectionState ( AuthUtil . instance . conn ) === 'valid'
104- ) {
105- authState = 'connectedWithNetworkError'
106- } else {
107- throw err
108- }
109- }
110- const currConn = AuthUtil . instance . conn
111- if ( currConn !== undefined && ! ( isAnySsoConnection ( currConn ) || isSageMaker ( ) ) ) {
112- getLogger ( ) . error ( `Current Amazon Q connection is not SSO, type is: %s` , currConn ?. type )
113- }
114-
115- return {
116- authStatus :
117- authState === 'connected' || authState === 'expired' || authState === 'connectedWithNetworkError'
118- ? authState
119- : 'notConnected' ,
120- authEnabledConnections : AuthUtils . getAuthFormIdsFromConnection ( currConn ) . join ( ',' ) ,
121- ...( await getTelemetryMetadataForConn ( currConn ) ) ,
122- }
123- }
88+ // async function getAuthState(): Promise<Omit<auth2.AuthState, 'source'>> {
89+ // let authState: AuthState = 'disconnected'
90+ // authState = AuthUtil.instance.getAuthState()
91+
92+ // if (AuthUtil.instance.isConnected() && !(AuthUtil.instance.isSsoSession() || isSageMaker())) {
93+ // getLogger().error('Current Amazon Q connection is not SSO')
94+ // }
95+
96+ // return {
97+ // authStatus:
98+ // authState === 'connected' || authState === 'expired'
99+ // ? authState
100+ // : 'notConnected',
101+ // ...(await getTelemetryMetadataForConn(currConn)),
102+ // }
103+ // }
124104
125105/**
126106 * Some parts of this do not work in Web mode so we need to set Dev Mode up here.
0 commit comments