in src/extension.ts [83:286]
await initializeComputeRegion()
const activationStartedOn = Date.now()
localize = nls.loadMessageBundle()
initialize(context, extWindow.Window.vscode())
initializeIconPaths(context)
initializeManifestPaths(context)
const toolkitOutputChannel = vscode.window.createOutputChannel(
localize('AWS.channel.aws.toolkit', '{0} Toolkit', getIdeProperties().company)
)
await activateLogger(context, toolkitOutputChannel)
const remoteInvokeOutputChannel = vscode.window.createOutputChannel(
localize('AWS.channel.aws.remoteInvoke', '{0} Remote Invocations', getIdeProperties().company)
)
globals.outputChannel = toolkitOutputChannel
try {
initializeCredentialsProviderManager()
const toolkitSettings = new DefaultSettingsConfiguration(extensionSettingsPrefix)
const endpointsProvider = makeEndpointsProvider()
const awsContext = new DefaultAwsContext(context)
globals.awsContext = awsContext
const awsContextTrees = new AwsContextTreeCollection()
const regionProvider = new DefaultRegionProvider(endpointsProvider)
const credentialsStore = new CredentialsStore()
const loginManager = new LoginManager(awsContext, credentialsStore)
const toolkitEnvDetails = getToolkitEnvironmentDetails()
// Splits environment details by new line, filter removes the empty string
toolkitEnvDetails
.split(/\r?\n/)
.filter(x => x)
.forEach(line => getLogger().info(line))
await initializeAwsCredentialsStatusBarItem(awsContext, context)
globals.regionProvider = regionProvider
globals.awsContextCommands = new DefaultAWSContextCommands(
awsContext,
awsContextTrees,
regionProvider,
loginManager
)
globals.sdkClientBuilder = new DefaultAWSClientBuilder(awsContext)
globals.toolkitClientBuilder = new DefaultToolkitClientBuilder(regionProvider)
globals.schemaService = new SchemaService(context)
globals.resourceManager = new AwsResourceManager(context)
await initializeCredentials({
extensionContext: context,
awsContext: awsContext,
settingsConfiguration: toolkitSettings,
})
await activateTelemetry({
extensionContext: context,
awsContext: awsContext,
toolkitSettings: toolkitSettings,
})
await globals.telemetry.start()
await globals.schemaService.start()
const extContext: ExtContext = {
extensionContext: context,
awsContext: awsContext,
samCliContext: getSamCliContext,
regionProvider: regionProvider,
settings: toolkitSettings,
outputChannel: toolkitOutputChannel,
telemetryService: globals.telemetry,
credentialsStore,
}
// Used as a command for decoration-only codelenses.
context.subscriptions.push(vscode.commands.registerCommand('aws.doNothingCommand', () => {}))
context.subscriptions.push(
vscode.commands.registerCommand('aws.login', async () => await globals.awsContextCommands.onCommandLogin())
)
context.subscriptions.push(
vscode.commands.registerCommand(
'aws.logout',
async () => await globals.awsContextCommands.onCommandLogout()
)
)
context.subscriptions.push(
vscode.commands.registerCommand('aws.credential.profile.create', async () => {
try {
await globals.awsContextCommands.onCommandCreateCredentialsProfile()
} finally {
recordAwsCreateCredentials()
}
})
)
// register URLs in extension menu
context.subscriptions.push(
vscode.commands.registerCommand('aws.help', async () => {
vscode.env.openExternal(vscode.Uri.parse(documentationUrl))
recordAwsHelp()
})
)
context.subscriptions.push(
vscode.commands.registerCommand('aws.github', async () => {
vscode.env.openExternal(vscode.Uri.parse(githubUrl))
recordAwsShowExtensionSource()
})
)
context.subscriptions.push(
vscode.commands.registerCommand('aws.createIssueOnGitHub', async () => {
vscode.env.openExternal(vscode.Uri.parse(githubCreateIssueUrl))
recordAwsReportPluginIssue()
})
)
context.subscriptions.push(
vscode.commands.registerCommand('aws.quickStart', async () => {
try {
await showQuickStartWebview(context)
} finally {
recordAwsHelpQuickstart({ result: 'Succeeded' })
}
})
)
context.subscriptions.push(
vscode.commands.registerCommand('aws.aboutToolkit', async () => {
await aboutToolkit()
})
)
await activateCloudFormationTemplateRegistry(context)
await activateCdk({
extensionContext: extContext.extensionContext,
})
await activateAwsExplorer({
awsContext,
awsContextTrees,
regionProvider,
toolkitOutputChannel,
remoteInvokeOutputChannel,
})
await activateAppRunner(extContext)
await activateApiGateway({
extContext: extContext,
outputChannel: remoteInvokeOutputChannel,
})
await activateLambda(extContext)
await activateSsmDocument(context, awsContext, regionProvider, toolkitOutputChannel)
await activateSam(extContext)
await activateS3(extContext)
await activateEcr(context)
await activateCloudWatchLogs(context, toolkitSettings)
await activateDynamicResources(context)
await activateIot(extContext)
await activateEcs(extContext)
// Features which aren't currently functional in Cloud9
if (!isCloud9()) {
await activateSchemas({
context: extContext.extensionContext,
outputChannel: toolkitOutputChannel,
})
}
await activateStepFunctions(context, awsContext, toolkitOutputChannel)
showWelcomeMessage(context)
recordToolkitInitialization(activationStartedOn, getLogger())
globals.telemetry.assertPassiveTelemetry(globals.didReload)
} catch (error) {
const stacktrace = (error as Error).stack?.split('\n')
// truncate if the stacktrace is unusually long
if (stacktrace !== undefined && stacktrace.length > 40) {
stacktrace.length = 40
}
getLogger('channel').error(
localize(
'AWS.channel.aws.toolkit.activation.error',
'Error Activating {0} Toolkit: {1} \n{2}',
getIdeProperties().company,
(error as Error).message,
stacktrace?.join('\n')
)
)
throw error
}