/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; import { IConnectionInfo, ITreeNodeInfo } from 'vscode-mssql'; import { IExtension, BindingType, GetAzureFunctionsResult, ResultStatus, IConnectionStringInfo, ObjectType } from 'sql-bindings'; import { addSqlBinding, createAzureFunction, getAzureFunctions } from './services/azureFunctionsService'; import { launchAddSqlBindingQuickpick } from './dialogs/addSqlBindingQuickpick'; import { promptForBindingType, promptAndUpdateConnectionStringSetting, promptForObjectName, addSqlNugetReferenceToProjectFile } from './common/azureFunctionsUtils'; import { TelemetryReporter } from './common/telemetry'; export async function activate(context: vscode.ExtensionContext): Promise { // register the add sql binding command context.subscriptions.push(vscode.commands.registerCommand('sqlBindings.addSqlBinding', async (uri: vscode.Uri | undefined) => { return launchAddSqlBindingQuickpick(uri); })); // Generate Azure Function command context.subscriptions.push(vscode.commands.registerCommand('sqlBindings.createAzureFunction', async (node?: ITreeNodeInfo) => { return await createAzureFunction(node); })); context.subscriptions.push(TelemetryReporter); return { addSqlBinding: async (bindingType: BindingType, filePath: string, functionName: string, objectName: string, connectionStringSetting: string): Promise => { return addSqlBinding(bindingType, filePath, functionName, objectName, connectionStringSetting); }, createAzureFunction: async (): Promise => { return createAzureFunction(); }, promptForBindingType: async (objectType?: ObjectType, funcName?: string): Promise => { return promptForBindingType(objectType, funcName); }, promptForObjectName: async (bindingType: BindingType, connectionInfo?: IConnectionInfo, objectType?: ObjectType): Promise => { return promptForObjectName(bindingType, connectionInfo, objectType); }, promptAndUpdateConnectionStringSetting: async (projectUri: vscode.Uri | undefined, connectionInfo?: IConnectionInfo): Promise => { return promptAndUpdateConnectionStringSetting(projectUri, connectionInfo); }, getAzureFunctions: async (filePath: string): Promise => { return getAzureFunctions(filePath); }, addSqlNugetReferenceToProjectFile: async (projectFile: string): Promise => { return addSqlNugetReferenceToProjectFile(projectFile); } }; } export function deactivate(): void { }