in src/extension.ts [24:103]
export async function activate(ctx: vscode.ExtensionContext) {
await checkTerraformInstalled();
await TelemetryWrapper.initializeFromJsonFile(ctx.asAbsolutePath("./package.json"));
initFileWatcher(ctx);
ctx.subscriptions.push(TelemetryWrapper.instrumentOperationAsVsCodeCommand("azureTerraform.init", () => {
terraformShellManager.getShell().runTerraformCmd(TerraformCommand.Init);
}));
ctx.subscriptions.push(TelemetryWrapper.instrumentOperationAsVsCodeCommand("azureTerraform.plan", () => {
terraformShellManager.getShell().runTerraformCmd(TerraformCommand.Plan);
}));
ctx.subscriptions.push(TelemetryWrapper.instrumentOperationAsVsCodeCommand("azureTerraform.apply", () => {
terraformShellManager.getShell().runTerraformCmd(TerraformCommand.Apply);
}));
ctx.subscriptions.push(TelemetryWrapper.instrumentOperationAsVsCodeCommand("azureTerraform.destroy", () => {
terraformShellManager.getShell().runTerraformCmd(TerraformCommand.Destroy);
}));
ctx.subscriptions.push(TelemetryWrapper.instrumentOperationAsVsCodeCommand("azureTerraform.refresh", () => {
terraformShellManager.getShell().runTerraformCmd(TerraformCommand.Refresh);
}));
ctx.subscriptions.push(TelemetryWrapper.instrumentOperationAsVsCodeCommand("azureTerraform.validate", () => {
terraformShellManager.getShell().runTerraformCmd(TerraformCommand.Validate);
}));
ctx.subscriptions.push(TelemetryWrapper.instrumentOperationAsVsCodeCommand("azureTerraform.visualize", async () => {
if (isTerminalSetToCloudShell()) {
const choice: vscode.MessageItem = await vscode.window.showInformationMessage(
"Visualization only works locally. Would you like to run it in the integrated terminal?",
DialogOption.ok,
DialogOption.cancel,
);
if (choice === DialogOption.cancel) {
return;
}
}
await terraformShellManager.getIntegratedShell().visualize();
}));
ctx.subscriptions.push(vscode.commands.registerCommand("azureTerraform.exectest", async () => {
const pick: string = await vscode.window.showQuickPick(
[TestOption.lint, TestOption.e2e, TestOption.custom],
{placeHolder: "Select the type of test that you want to run"},
);
if (!pick) {
return;
}
const workingDirectory: string = await selectWorkspaceFolder();
if (!workingDirectory) {
return;
}
await terraformShellManager.getShell().runTerraformTests(pick, workingDirectory);
}));
ctx.subscriptions.push(TelemetryWrapper.instrumentOperationAsVsCodeCommand("azureTerraform.push", async () => {
if (!isTerminalSetToCloudShell()) {
vscode.window.showErrorMessage("Push function only available when using cloudshell. Which is not currently supported.");
return;
}
if (_.isEmpty(vscode.workspace.workspaceFolders)) {
vscode.window.showInformationMessage("Please open a workspace in VS Code first.");
return;
}
await terraformShellManager.getCloudShell().pushFiles(await vscode.workspace.findFiles(getSyncFileBlobPattern()));
}));
ctx.subscriptions.push(TelemetryWrapper.instrumentOperationAsVsCodeCommand("azureTerraform.showSurvey", async () => {
await ShowSurvey();
}));
lspClient = setupLanguageClient(ctx);
if (await ShouldShowSurvey()) {
await ShowSurvey();
}
}