Skip to content

Commit 1f975f0

Browse files
committed
allow InputBoxOptions#validateInput to return a thenable, #34532
1 parent d7ac6d6 commit 1f975f0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/vs/vscode.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1661,7 +1661,7 @@ declare module 'vscode' {
16611661
* @return A human readable string which is presented as diagnostic message.
16621662
* Return `undefined`, `null`, or the empty string when 'value' is valid.
16631663
*/
1664-
validateInput?(value: string): string | undefined | null;
1664+
validateInput?(value: string): string | undefined | null | Thenable<string | undefined | null>;
16651665
}
16661666

16671667
/**

src/vs/workbench/api/node/extHostQuickOpen.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
'use strict';
66

77
import { TPromise } from 'vs/base/common/winjs.base';
8-
import { wireCancellationToken } from 'vs/base/common/async';
8+
import { wireCancellationToken, asWinJsPromise } from 'vs/base/common/async';
99
import { CancellationToken } from 'vs/base/common/cancellation';
1010
import { QuickPickOptions, QuickPickItem, InputBoxOptions, WorkspaceFolderPickOptions, WorkspaceFolder } from 'vscode';
1111
import { MainContext, MainThreadQuickOpenShape, ExtHostQuickOpenShape, MyQuickPickItems, IMainContext } from './extHost.protocol';
@@ -21,7 +21,7 @@ export class ExtHostQuickOpen implements ExtHostQuickOpenShape {
2121
private _commands: ExtHostCommands;
2222

2323
private _onDidSelectItem: (handle: number) => void;
24-
private _validateInput: (input: string) => string;
24+
private _validateInput: (input: string) => string | Thenable<string>;
2525

2626
constructor(mainContext: IMainContext, workspace: ExtHostWorkspace, commands: ExtHostCommands) {
2727
this._proxy = mainContext.get(MainContext.MainThreadQuickOpen);
@@ -120,7 +120,7 @@ export class ExtHostQuickOpen implements ExtHostQuickOpenShape {
120120

121121
$validateInput(input: string): TPromise<string> {
122122
if (this._validateInput) {
123-
return TPromise.as(this._validateInput(input));
123+
return asWinJsPromise(_ => this._validateInput(input));
124124
}
125125
return undefined;
126126
}

0 commit comments

Comments
 (0)