Show function name when prompting user for sql binding type (#19336)

This commit is contained in:
Barbara Valdez
2022-05-11 13:51:15 -07:00
committed by GitHub
parent e10b1eb5a9
commit e69bd2c01f
4 changed files with 8 additions and 6 deletions

View File

@@ -285,8 +285,9 @@ export async function isFunctionProject(folderPath: string): Promise<boolean> {
/**
* Prompts the user to select type of binding and returns result
* @param funcName (Optional) Name of the function to which we are adding the SQL Binding
*/
export async function promptForBindingType(): Promise<BindingType | undefined> {
export async function promptForBindingType(funcName?: string): Promise<BindingType | undefined> {
const inputOutputItems: (vscode.QuickPickItem & { type: BindingType })[] = [
{
label: constants.input,
@@ -300,7 +301,7 @@ export async function promptForBindingType(): Promise<BindingType | undefined> {
const selectedBinding = (await vscode.window.showQuickPick(inputOutputItems, {
canPickMany: false,
title: constants.selectBindingType,
title: constants.selectBindingType(funcName),
ignoreFocusOut: true
}));

View File

@@ -52,7 +52,7 @@ export const yesString = localize('yesString', "Yes");
export const noString = localize('noString', "No");
export const input = localize('input', "Input");
export const output = localize('output', "Output");
export const selectBindingType = localize('selectBindingType', "Select type of binding");
export function selectBindingType(funcName?: string): string { return funcName ? localize('selectBindingTypeToSpecifiedFunction', "Select type of binding for the function '{0}'", funcName) : localize('selectBindingType', "Select type of binding"); }
export const selectAzureFunction = localize('selectAzureFunction', "Select an Azure function in the current file to add SQL binding to");
export const sqlTableOrViewToQuery = localize('sqlTableOrViewToQuery', "SQL table or view to query");
export const sqlTableToUpsert = localize('sqlTableToUpsert', "SQL table to upsert into");

View File

@@ -20,8 +20,8 @@ export async function activate(context: vscode.ExtensionContext): Promise<IExten
addSqlBinding: async (bindingType: BindingType, filePath: string, functionName: string, objectName: string, connectionStringSetting: string): Promise<ResultStatus> => {
return addSqlBinding(bindingType, filePath, functionName, objectName, connectionStringSetting);
},
promptForBindingType: async (): Promise<BindingType | undefined> => {
return promptForBindingType();
promptForBindingType: async (funcName?: string): Promise<BindingType | undefined> => {
return promptForBindingType(funcName);
},
promptForObjectName: async (bindingType: BindingType): Promise<string | undefined> => {
return promptForObjectName(bindingType);

View File

@@ -29,8 +29,9 @@ declare module 'sql-bindings' {
/**
* Prompts the user to select type of binding and returns result or undefined if the user cancelled out of the prompt
* @param funcName (Optional) Name of the function we are adding the SQL Binding to
*/
promptForBindingType(): Promise<BindingType | undefined>;
promptForBindingType(funcName?: string): Promise<BindingType | undefined>;
/**
* Prompts the user to enter object name for the SQL query