Default ignoreFocusOut to true
This commit is contained in:
Родитель
7fe28b5a79
Коммит
3d42f2ab35
|
@ -9,7 +9,7 @@ export interface IUserInterface {
|
|||
showQuickPick<T>(items: PickWithData<T>[] | Thenable<PickWithData<T>[]>, placeHolder: string, ignoreFocusOut?: boolean): Promise<PickWithData<T>>;
|
||||
showQuickPick(items: Pick[] | Thenable<Pick[]>, placeHolder: string, ignoreFocusOut?: boolean): Promise<Pick>;
|
||||
|
||||
showInputBox(placeHolder: string, prompt: string, ignoreFocusOut?: boolean, validateInput?: (s: string) => string | undefined | null, value?: string): Promise<string>;
|
||||
showInputBox(placeHolder: string, prompt: string, validateInput?: (s: string) => string | undefined | null, value?: string, ignoreFocusOut?: boolean): Promise<string>;
|
||||
|
||||
showFolderDialog(): Promise<string>;
|
||||
}
|
||||
|
|
|
@ -79,11 +79,11 @@ export class LocalAppSettings {
|
|||
} else {
|
||||
const keyPlaceHolder: string = localize('azFunc.AppSettingKeyPlaceholder', '\'{0}\' App Setting Key', resourceTypeLabel);
|
||||
const keyPrompt: string = localize('azFunc.AppSettingKeyPrompt', 'Enter a key for your \'{0}\' connection string', resourceTypeLabel);
|
||||
appSettingKey = await this._ui.showInputBox(keyPlaceHolder, keyPrompt, true /* ignoreFocusOut */, undefined /* validateInput */, `example${appSettingSuffix}`);
|
||||
appSettingKey = await this._ui.showInputBox(keyPlaceHolder, keyPrompt, undefined /* validateInput */, `example${appSettingSuffix}`);
|
||||
|
||||
const valuePlaceHolder: string = localize('azFunc.AppSettingValuePlaceholder', '\'{0}\' App Setting Value', resourceTypeLabel);
|
||||
const valuePrompt: string = localize('azFunc.AppSettingValuePrompt', 'Enter the connection string for your \'{0}\'', resourceTypeLabel);
|
||||
connectionString = await this._ui.showInputBox(valuePlaceHolder, valuePrompt, true /* ignoreFocusOut */);
|
||||
connectionString = await this._ui.showInputBox(valuePlaceHolder, valuePrompt);
|
||||
}
|
||||
|
||||
await this.setAppSetting(settings, appSettingKey, connectionString);
|
||||
|
@ -112,7 +112,7 @@ export class LocalAppSettings {
|
|||
if (error instanceof NoSubscriptionError) {
|
||||
const placeHolder: string = localize('azFunc.StoragePlaceholder', '\'{0}\' Connection String', this._azureWebJobsStorageKey);
|
||||
const prompt: string = localize('azFunc.StoragePrompt', 'Enter the connection string for your \'{0}\'', this._azureWebJobsStorageKey);
|
||||
connectionString = await this._ui.showInputBox(placeHolder, prompt, true /* ignoreFocusOut */);
|
||||
connectionString = await this._ui.showInputBox(placeHolder, prompt);
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import { localize } from './localize';
|
|||
export class VSCodeUI implements IUserInterface {
|
||||
public async showQuickPick<T>(items: PickWithData<T>[] | Thenable<PickWithData<T>[]>, placeHolder: string, ignoreFocusOut?: boolean): Promise<PickWithData<T>>;
|
||||
public async showQuickPick(items: Pick[] | Thenable<Pick[]>, placeHolder: string, ignoreFocusOut?: boolean): Promise<Pick>;
|
||||
public async showQuickPick(items: vscode.QuickPickItem[] | Thenable<vscode.QuickPickItem[]>, placeHolder: string, ignoreFocusOut: boolean = false): Promise<vscode.QuickPickItem> {
|
||||
public async showQuickPick(items: vscode.QuickPickItem[] | Thenable<vscode.QuickPickItem[]>, placeHolder: string, ignoreFocusOut: boolean = true): Promise<vscode.QuickPickItem> {
|
||||
const options: vscode.QuickPickOptions = {
|
||||
placeHolder: placeHolder,
|
||||
ignoreFocusOut: ignoreFocusOut
|
||||
|
@ -25,7 +25,7 @@ export class VSCodeUI implements IUserInterface {
|
|||
}
|
||||
}
|
||||
|
||||
public async showInputBox(placeHolder: string, prompt: string, ignoreFocusOut: boolean = false, validateInput?: (s: string) => string | undefined | null, defaultValue?: string): Promise<string> {
|
||||
public async showInputBox(placeHolder: string, prompt: string, validateInput?: (s: string) => string | undefined | null, defaultValue?: string, ignoreFocusOut: boolean = true): Promise<string> {
|
||||
const options: vscode.InputBoxOptions = {
|
||||
placeHolder: placeHolder,
|
||||
prompt: prompt,
|
||||
|
|
|
@ -29,7 +29,7 @@ export class CSharpFunctionCreator extends FunctionCreatorBase {
|
|||
const defaultFunctionName: string | undefined = await fsUtil.getUniqueFsPath(this._functionAppPath, removeLanguageFromId(this._template.id), '.cs');
|
||||
const placeHolder: string = localize('azFunc.funcNamePlaceholder', 'Function name');
|
||||
const prompt: string = localize('azFunc.funcNamePrompt', 'Provide a function name');
|
||||
this._functionName = await ui.showInputBox(placeHolder, prompt, false, (s: string) => this.validateTemplateName(s), defaultFunctionName || this._template.defaultFunctionName);
|
||||
this._functionName = await ui.showInputBox(placeHolder, prompt, (s: string) => this.validateTemplateName(s), defaultFunctionName || this._template.defaultFunctionName);
|
||||
} else {
|
||||
this._functionName = functionName;
|
||||
}
|
||||
|
|
|
@ -33,13 +33,13 @@ export class JavaFunctionCreator extends FunctionCreatorBase {
|
|||
public async promptForSettings(ui: IUserInterface, functionName: string | undefined): Promise<void> {
|
||||
const packagePlaceHolder: string = localize('azFunc.java.packagePlaceHolder', 'Package');
|
||||
const packagePrompt: string = localize('azFunc.java.packagePrompt', 'Provide a package name');
|
||||
this._packageName = await ui.showInputBox(packagePlaceHolder, packagePrompt, false, validatePackageName, 'com.function');
|
||||
this._packageName = await ui.showInputBox(packagePlaceHolder, packagePrompt, validatePackageName, 'com.function');
|
||||
|
||||
if (!functionName) {
|
||||
const defaultFunctionName: string | undefined = await fsUtil.getUniqueJavaFsPath(this._functionAppPath, this._packageName, `${removeLanguageFromId(this._template.id)}Java`);
|
||||
const placeHolder: string = localize('azFunc.funcNamePlaceholder', 'Function name');
|
||||
const prompt: string = localize('azFunc.funcNamePrompt', 'Provide a function name');
|
||||
this._functionName = await ui.showInputBox(placeHolder, prompt, false, (s: string) => this.validateTemplateName(s), defaultFunctionName || this._template.defaultFunctionName);
|
||||
this._functionName = await ui.showInputBox(placeHolder, prompt, (s: string) => this.validateTemplateName(s), defaultFunctionName || this._template.defaultFunctionName);
|
||||
} else {
|
||||
this._functionName = functionName;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ export class ScriptFunctionCreator extends FunctionCreatorBase {
|
|||
const defaultFunctionName: string | undefined = await fsUtil.getUniqueFsPath(this._functionAppPath, this._template.defaultFunctionName);
|
||||
const prompt: string = localize('azFunc.funcNamePrompt', 'Provide a function name');
|
||||
const placeHolder: string = localize('azFunc.funcNamePlaceholder', 'Function name');
|
||||
this._functionName = await ui.showInputBox(placeHolder, prompt, false, (s: string) => this.validateTemplateName(s), defaultFunctionName || this._template.defaultFunctionName);
|
||||
this._functionName = await ui.showInputBox(placeHolder, prompt, (s: string) => this.validateTemplateName(s), defaultFunctionName || this._template.defaultFunctionName);
|
||||
} else {
|
||||
this._functionName = functionName;
|
||||
}
|
||||
|
|
|
@ -62,20 +62,20 @@ async function promptForSetting(ui: IUserInterface, localAppSettings: LocalAppSe
|
|||
async function promptForEnumSetting(ui: IUserInterface, setting: ConfigSetting): Promise<string> {
|
||||
const picks: PickWithData<string>[] = setting.enums.map((ev: EnumValue) => new PickWithData<string>(ev.value, ev.displayName));
|
||||
|
||||
return (await ui.showQuickPick(picks, setting.label, false)).data;
|
||||
return (await ui.showQuickPick(picks, setting.label)).data;
|
||||
}
|
||||
|
||||
async function promptForBooleanSetting(ui: IUserInterface, setting: ConfigSetting): Promise<string> {
|
||||
const picks: Pick[] = [new Pick('true'), new Pick('false')];
|
||||
|
||||
return (await ui.showQuickPick(picks, setting.label, false)).label;
|
||||
return (await ui.showQuickPick(picks, setting.label)).label;
|
||||
}
|
||||
|
||||
async function promptForStringSetting(ui: IUserInterface, setting: ConfigSetting, defaultValue?: string): Promise<string> {
|
||||
const prompt: string = localize('azFunc.stringSettingPrompt', 'Provide a \'{0}\'', setting.label);
|
||||
defaultValue = defaultValue ? defaultValue : setting.defaultValue;
|
||||
|
||||
return await ui.showInputBox(setting.label, prompt, false, (s: string) => setting.validateSetting(s), defaultValue);
|
||||
return await ui.showInputBox(setting.label, prompt, (s: string) => setting.validateSetting(s), defaultValue);
|
||||
}
|
||||
|
||||
export async function createFunction(
|
||||
|
|
|
@ -30,23 +30,23 @@ export class JavaProjectCreator implements IProjectCreator {
|
|||
|
||||
const groupIdPlaceHolder: string = localize('azFunc.java.groupIdPlaceholder', 'Group ID');
|
||||
const groupIdPrompt: string = localize('azFunc.java.groupIdPrompt', 'Provide value for groupId');
|
||||
const groupId: string = await this._ui.showInputBox(groupIdPlaceHolder, groupIdPrompt, false, validateMavenIdentifier, 'com.function');
|
||||
const groupId: string = await this._ui.showInputBox(groupIdPlaceHolder, groupIdPrompt, validateMavenIdentifier, 'com.function');
|
||||
|
||||
const artifactIdPlaceHolder: string = localize('azFunc.java.artifactIdPlaceholder', 'Artifact ID');
|
||||
const artifactIdprompt: string = localize('azFunc.java.artifactIdPrompt', 'Provide value for artifactId');
|
||||
const artifactId: string = await this._ui.showInputBox(artifactIdPlaceHolder, artifactIdprompt, false, validateMavenIdentifier, path.basename(functionAppPath));
|
||||
const artifactId: string = await this._ui.showInputBox(artifactIdPlaceHolder, artifactIdprompt, validateMavenIdentifier, path.basename(functionAppPath));
|
||||
|
||||
const versionPlaceHolder: string = localize('azFunc.java.versionPlaceHolder', 'Version');
|
||||
const versionPrompt: string = localize('azFunc.java.versionPrompt', 'Provide value for version');
|
||||
const version: string = await this._ui.showInputBox(versionPlaceHolder, versionPrompt, false, undefined, '1.0-SNAPSHOT');
|
||||
const version: string = await this._ui.showInputBox(versionPlaceHolder, versionPrompt, undefined, '1.0-SNAPSHOT');
|
||||
|
||||
const packagePlaceHolder: string = localize('azFunc.java.packagePlaceHolder', 'Package');
|
||||
const packagePrompt: string = localize('azFunc.java.packagePrompt', 'Provide value for package');
|
||||
const packageName: string = await this._ui.showInputBox(packagePlaceHolder, packagePrompt, false, validatePackageName, groupId);
|
||||
const packageName: string = await this._ui.showInputBox(packagePlaceHolder, packagePrompt, validatePackageName, groupId);
|
||||
|
||||
const appNamePlaceHolder: string = localize('azFunc.java.appNamePlaceHolder', 'App Name');
|
||||
const appNamePrompt: string = localize('azFunc.java.appNamePrompt', 'Provide value for appName');
|
||||
const appName: string = await this._ui.showInputBox(appNamePlaceHolder, appNamePrompt, false, undefined, `${artifactId}-${Date.now()}`);
|
||||
const appName: string = await this._ui.showInputBox(appNamePlaceHolder, appNamePrompt, undefined, `${artifactId}-${Date.now()}`);
|
||||
|
||||
const tempFolder: string = path.join(os.tmpdir(), fsUtil.getRandomHexString());
|
||||
await fse.ensureDir(tempFolder);
|
||||
|
|
|
@ -7,15 +7,15 @@ import * as vscode from 'vscode';
|
|||
import { IUserInterface, Pick, PickWithData } from '../src/IUserInterface';
|
||||
|
||||
export class TestUI implements IUserInterface {
|
||||
private _inputs: (string | undefined)[];
|
||||
private _inputs: (string | undefined) [];
|
||||
|
||||
constructor(inputs: (string | undefined)[]) {
|
||||
constructor(inputs: (string | undefined) []) {
|
||||
this._inputs = inputs;
|
||||
}
|
||||
|
||||
public async showQuickPick<T>(items: PickWithData<T>[] | Thenable<PickWithData<T>[]>, placeHolder: string, ignoreFocusOut?: boolean): Promise<PickWithData<T>>;
|
||||
public async showQuickPick(items: Pick[] | Thenable<Pick[]>, placeHolder: string, ignoreFocusOut?: boolean): Promise<Pick>;
|
||||
public async showQuickPick(items: vscode.QuickPickItem[] | Thenable<vscode.QuickPickItem[]>, placeHolder: string, _ignoreFocusOut: boolean = false): Promise<vscode.QuickPickItem> {
|
||||
public async showQuickPick(items: vscode.QuickPickItem[] | Thenable<vscode.QuickPickItem[]>, placeHolder: string, _ignoreFocusOut: boolean = true): Promise<vscode.QuickPickItem> {
|
||||
if (this._inputs.length > 0) {
|
||||
const input: string | undefined = this._inputs.shift();
|
||||
const resolvedItems: vscode.QuickPickItem[] = await Promise.resolve(items);
|
||||
|
@ -38,7 +38,7 @@ export class TestUI implements IUserInterface {
|
|||
throw new Error(`Unexpected call to showQuickPick. Placeholder: '${placeHolder}'`);
|
||||
}
|
||||
|
||||
public async showInputBox(placeHolder: string, prompt: string, _ignoreFocusOut: boolean = false, validateInput?: (s: string) => string | undefined | null, value?: string): Promise<string> {
|
||||
public async showInputBox(placeHolder: string, prompt: string, validateInput?: (s: string) => string | undefined | null, value?: string, _ignoreFocusOut: boolean = true): Promise<string> {
|
||||
if (this._inputs.length > 0) {
|
||||
let result: string | undefined = this._inputs.shift();
|
||||
if (!result) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче