mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 02:58:56 +01:00
add cancellation support for showInput and showQuickPick, #9377
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
'use strict';
|
||||
|
||||
import {TPromise} from 'vs/base/common/winjs.base';
|
||||
import {asWinJsPromise} from 'vs/base/common/async';
|
||||
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
|
||||
import {IQuickOpenService, IPickOptions, IInputOptions} from 'vs/workbench/services/quickopen/common/quickOpenService';
|
||||
import {InputBoxOptions} from 'vscode';
|
||||
@@ -46,7 +47,7 @@ export class MainThreadQuickOpen extends MainThreadQuickOpenShape {
|
||||
};
|
||||
});
|
||||
|
||||
return this._quickOpenService.pick(this._contents, options).then(item => {
|
||||
return asWinJsPromise(token => this._quickOpenService.pick(this._contents, options, token)).then(item => {
|
||||
if (item) {
|
||||
return item.handle;
|
||||
}
|
||||
@@ -73,7 +74,7 @@ export class MainThreadQuickOpen extends MainThreadQuickOpenShape {
|
||||
|
||||
// ---- input
|
||||
|
||||
$input(options: InputBoxOptions, validateInput: boolean): Thenable<string> {
|
||||
$input(options: InputBoxOptions, validateInput: boolean): TPromise<string> {
|
||||
|
||||
const inputOptions: IInputOptions = Object.create(null);
|
||||
|
||||
@@ -90,6 +91,6 @@ export class MainThreadQuickOpen extends MainThreadQuickOpenShape {
|
||||
};
|
||||
}
|
||||
|
||||
return this._quickOpenService.input(inputOptions);
|
||||
return asWinJsPromise(token => this._quickOpenService.input(inputOptions, token));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user