Add output channel for SQL Bindings extension (#20336)

* add output channel for SQL Bindings extension

* add output channel to open once added
This commit is contained in:
Vasu Bhog
2022-08-15 12:12:26 -07:00
committed by GitHub
parent ebdb1783cc
commit e57acae79a
2 changed files with 9 additions and 1 deletions

View File

@@ -25,6 +25,8 @@ export interface ILocalSettingsJson {
ConnectionStrings?: { [key: string]: string };
}
export const outputChannel = vscode.window.createOutputChannel(constants.serviceName);
/**
* copied and modified from vscode-azurefunctions extension
* https://github.com/microsoft/vscode-azurefunctions/blob/main/src/funcConfig/local.settings.ts
@@ -198,7 +200,11 @@ export async function getSettingsFile(projectFolder: string): Promise<string | u
* @param selectedProjectFile is the users selected project file path
*/
export async function addSqlNugetReferenceToProjectFile(selectedProjectFile: string): Promise<void> {
await utils.executeCommand(`dotnet add "${selectedProjectFile}" package ${constants.sqlExtensionPackageName} --prerelease`);
// clear the output channel prior to adding the nuget reference
outputChannel.clear();
let addNugetCommmand = await utils.executeCommand(`dotnet add "${selectedProjectFile}" package ${constants.sqlExtensionPackageName} --prerelease`);
outputChannel.appendLine(constants.dotnetResult(addNugetCommmand));
outputChannel.show(true);
TelemetryReporter.sendActionEvent(TelemetryViews.CreateAzureFunctionWithSqlBinding, TelemetryActions.addSQLNugetPackage);
}

View File

@@ -22,6 +22,7 @@ export const sqlBindingsHelpLink = 'https://github.com/Azure/azure-functions-sql
export const passwordPlaceholder = '******';
export const azureFunctionLocalSettingsFileName = 'local.settings.json';
export const vscodeOpenCommand = 'vscode.open';
export const serviceName = 'SQL Bindings';
// localized constants
export const functionNameTitle = localize('functionNameTitle', 'Function Name');
@@ -90,6 +91,7 @@ export function failedToParse(filename: string, error: any): string { return loc
export function addSqlBinding(functionName: string): string { return localize('addSqlBinding', 'Adding SQL Binding to function "{0}"...'), functionName; }
export function errorNewAzureFunction(error: any): string { return localize('errorNewAzureFunction', 'Error creating new Azure Function: {0}', utils.getErrorMessage(error)); }
export function manuallyEnterObjectName(userObjectName: string): string { return `$(pencil) ${userObjectName}`; }
export function dotnetResult(output: string): string { return localize('dotnetResult', 'Adding SQL nuget package:\n{0}', output); }
// Known Azure settings reference for Azure Functions
// https://docs.microsoft.com/en-us/azure/azure-functions/functions-app-settings