@@ -9,35 +9,27 @@ import * as nls from 'vscode-nls'
9
9
import * as codecatalyst from './codecatalyst/activation'
10
10
import { activate as activateAwsExplorer } from './awsexplorer/activation'
11
11
import { activate as activateCloudWatchLogs } from './cloudWatchLogs/activation'
12
- import { initialize as initializeCredentials } from './auth/activation'
13
- import { initializeAwsCredentialsStatusBarItem } from './auth/ui/statusBarItem'
14
- import { LoginManager } from './auth/deprecated/loginManager'
15
12
import { CredentialsProviderManager } from './auth/providers/credentialsProviderManager'
16
13
import { SharedCredentialsProviderFactory } from './auth/providers/sharedCredentialsProviderFactory'
17
14
import { activate as activateSchemas } from './eventSchemas/activation'
18
15
import { activate as activateLambda } from './lambda/activation'
19
- import { DefaultAWSClientBuilder } from './shared/awsClientBuilder'
20
16
import { activate as activateCloudFormationTemplateRegistry } from './shared/cloudformation/activation'
21
17
import { endpointsFileUrl } from './shared/constants'
22
- import { DefaultAwsContext } from './shared/awsContext'
23
18
import { AwsContextCommands } from './shared/awsContextCommands'
24
19
import {
25
20
getIdeProperties ,
26
21
getToolkitEnvironmentDetails ,
27
- initializeComputeRegion ,
28
22
isCloud9 ,
29
23
isSageMaker ,
30
24
showWelcomeMessage ,
31
25
} from './shared/extensionUtilities'
32
26
import { getLogger , Logger } from './shared/logger/logger'
33
- import { activate as activateLogger } from './shared/logger/activation'
34
27
import { getEndpointsFromFetcher , RegionProvider } from './shared/regions/regionProvider'
35
28
import { FileResourceFetcher } from './shared/resourcefetcher/fileResourceFetcher'
36
29
import { HttpResourceFetcher } from './shared/resourcefetcher/httpResourceFetcher'
37
30
import { activate as activateEcr } from './ecr/activation'
38
31
import { activate as activateEc2 } from './ec2/activation'
39
32
import { activate as activateSam } from './shared/sam/activation'
40
- import { activate as activateTelemetry } from './shared/telemetry/activation'
41
33
import { activate as activateS3 } from './s3/activation'
42
34
import * as awsFiletypes from './shared/awsFiletypes'
43
35
import { activate as activateCodeWhisperer , shutdown as codewhispererShutdown } from './codewhisperer/activation'
@@ -52,7 +44,6 @@ import { activate as activateIot } from './iot/activation'
52
44
import { activate as activateDev } from './dev/activation'
53
45
import { activate as activateApplicationComposer } from './applicationcomposer/activation'
54
46
import { activate as activateRedshift } from './redshift/activation'
55
- import { CredentialsStore } from './auth/credentials/store'
56
47
import { activate as activateCWChat } from './amazonq/activation'
57
48
import { activate as activateQGumby } from './amazonqGumby/activation'
58
49
import { getSamCliContext } from './shared/sam/cli/samCliContext'
@@ -61,7 +52,7 @@ import { EnvVarsCredentialsProvider } from './auth/providers/envVarsCredentialsP
61
52
import { EcsCredentialsProvider } from './auth/providers/ecsCredentialsProvider'
62
53
import { SchemaService } from './shared/schemas'
63
54
import { AwsResourceManager } from './dynamicResources/awsResourceManager'
64
- import globals , { initialize } from './shared/extensionGlobals'
55
+ import globals from './shared/extensionGlobals'
65
56
import { Experiments , Settings } from './shared/settings'
66
57
import { isReleaseVersion } from './shared/vscode/env'
67
58
import { Commands , registerErrorHandler as registerCommandErrorHandler } from './shared/vscode/commands2'
@@ -72,34 +63,24 @@ import { isUserCancelledError, resolveErrorMessageToDisplay, ToolkitError } from
72
63
import { Logging } from './shared/logger/commands'
73
64
import { showMessageWithUrl , showViewLogsMessage } from './shared/utilities/messages'
74
65
import { registerWebviewErrorHandler } from './webviews/server'
75
- import { registerCommands , initializeManifestPaths } from './extensionShared'
76
66
import { ChildProcess } from './shared/utilities/childProcess'
77
67
import { initializeNetworkAgent } from './codewhisperer/client/agent'
78
68
import { Timeout } from './shared/utilities/timeoutUtils'
79
69
import { submitFeedback } from './feedback/vue/submitFeedback'
80
70
import { showQuickStartWebview } from './shared/extensionStartup'
71
+ import { activateShared } from './extensionShared'
81
72
82
73
let localize : nls . LocalizeFunc
83
74
84
75
export async function activate ( context : vscode . ExtensionContext ) {
85
- initializeNetworkAgent ( )
86
- await initializeComputeRegion ( )
87
76
const activationStartedOn = Date . now ( )
88
77
localize = nls . loadMessageBundle ( )
89
78
90
- initialize ( context )
91
79
globals . machineId = await getMachineId ( )
92
- initializeManifestPaths ( context )
93
80
94
- const toolkitOutputChannel = vscode . window . createOutputChannel (
95
- localize ( 'AWS.channel.aws.toolkit' , '{0} Toolkit' , getIdeProperties ( ) . company ) ,
96
- { log : true }
97
- )
98
- await activateLogger ( context , toolkitOutputChannel )
99
81
const remoteInvokeOutputChannel = vscode . window . createOutputChannel (
100
82
localize ( 'AWS.channel.aws.remoteInvoke' , '{0} Remote Invocations' , getIdeProperties ( ) . company )
101
83
)
102
- globals . outputChannel = toolkitOutputChannel
103
84
104
85
registerCommandErrorHandler ( ( info , error ) => {
105
86
const defaultMessage = localize ( 'AWS.generic.message.error' , 'Failed to run command: {0}' , info . id )
@@ -124,15 +105,11 @@ export async function activate(context: vscode.ExtensionContext) {
124
105
}
125
106
126
107
try {
127
- initializeCredentialsProviderManager ( )
128
-
129
- const endpointsProvider = makeEndpointsProvider ( )
108
+ // IMPORTANT: If you are doing setup that should also work in browser, it should be done in the function below
109
+ await activateShared ( context , ( ) => RegionProvider . fromEndpointsProvider ( makeEndpointsProvider ( ) ) )
130
110
131
- const awsContext = new DefaultAwsContext ( )
132
- globals . awsContext = awsContext
133
- const regionProvider = RegionProvider . fromEndpointsProvider ( endpointsProvider )
134
- const credentialsStore = new CredentialsStore ( )
135
- const loginManager = new LoginManager ( globals . awsContext , credentialsStore )
111
+ initializeNetworkAgent ( )
112
+ initializeCredentialsProviderManager ( )
136
113
137
114
const toolkitEnvDetails = getToolkitEnvironmentDetails ( )
138
115
// Splits environment details by new line, filter removes the empty string
@@ -141,11 +118,7 @@ export async function activate(context: vscode.ExtensionContext) {
141
118
. filter ( Boolean )
142
119
. forEach ( line => getLogger ( ) . info ( line ) )
143
120
144
- await initializeAwsCredentialsStatusBarItem ( awsContext , context )
145
- globals . regionProvider = regionProvider
146
- globals . loginManager = loginManager
147
- globals . awsContextCommands = new AwsContextCommands ( regionProvider , Auth . instance )
148
- globals . sdkClientBuilder = new DefaultAWSClientBuilder ( awsContext )
121
+ globals . awsContextCommands = new AwsContextCommands ( globals . regionProvider , Auth . instance )
149
122
globals . schemaService = new SchemaService ( )
150
123
globals . resourceManager = new AwsResourceManager ( context )
151
124
// Create this now, but don't call vscode.window.registerUriHandler() until after all
@@ -155,9 +128,6 @@ export async function activate(context: vscode.ExtensionContext) {
155
128
const settings = Settings . instance
156
129
const experiments = Experiments . instance
157
130
158
- await activateTelemetry ( context , awsContext , settings )
159
- await initializeCredentials ( context , awsContext , loginManager )
160
-
161
131
experiments . onDidChange ( ( { key } ) => {
162
132
telemetry . aws_experimentActivation . run ( span => {
163
133
// Record the key prior to reading the setting as `get` may throw
@@ -173,12 +143,12 @@ export async function activate(context: vscode.ExtensionContext) {
173
143
extensionContext : context ,
174
144
awsContext : globals . awsContext ,
175
145
samCliContext : getSamCliContext ,
176
- regionProvider : regionProvider ,
177
- outputChannel : toolkitOutputChannel ,
146
+ regionProvider : globals . regionProvider ,
147
+ outputChannel : globals . outputChannel ,
178
148
invokeOutputChannel : remoteInvokeOutputChannel ,
179
149
telemetryService : globals . telemetry ,
180
150
uriHandler : globals . uriHandler ,
181
- credentialsStore,
151
+ credentialsStore : globals . loginManager . store ,
182
152
}
183
153
184
154
try {
@@ -187,7 +157,6 @@ export async function activate(context: vscode.ExtensionContext) {
187
157
getLogger ( ) . debug ( `Developer Tools (internal): failed to activate: ${ ( error as Error ) . message } ` )
188
158
}
189
159
190
- registerCommands ( context )
191
160
context . subscriptions . push ( submitFeedback . register ( context ) )
192
161
193
162
// do not enable codecatalyst for sagemaker
@@ -203,8 +172,8 @@ export async function activate(context: vscode.ExtensionContext) {
203
172
204
173
await activateAwsExplorer ( {
205
174
context : extContext ,
206
- regionProvider,
207
- toolkitOutputChannel,
175
+ regionProvider : globals . regionProvider ,
176
+ toolkitOutputChannel : globals . outputChannel ,
208
177
remoteInvokeOutputChannel,
209
178
} )
210
179
@@ -219,7 +188,7 @@ export async function activate(context: vscode.ExtensionContext) {
219
188
220
189
await activateLambda ( extContext )
221
190
222
- await activateSsmDocument ( context , globals . awsContext , regionProvider , toolkitOutputChannel )
191
+ await activateSsmDocument ( context , globals . awsContext , globals . regionProvider , globals . outputChannel )
223
192
224
193
await activateSam ( extContext )
225
194
@@ -247,7 +216,7 @@ export async function activate(context: vscode.ExtensionContext) {
247
216
await activateApplicationComposer ( context )
248
217
}
249
218
250
- await activateStepFunctions ( context , awsContext , toolkitOutputChannel )
219
+ await activateStepFunctions ( context , globals . awsContext , globals . outputChannel )
251
220
252
221
await activateRedshift ( extContext )
253
222
0 commit comments