add cancellation support for showInput and showQuickPick, #9377

This commit is contained in:
Johannes Rieken
2016-08-08 15:50:57 +02:00
parent b0c702dd2f
commit ff061902a7
11 changed files with 106 additions and 49 deletions

View File

@@ -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));
}
}