提交 3acc0026 编写于 作者: J Johannes Rieken

debt - less TPromise construction

上级 e99942cc
......@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import * as readline from 'readline';
import { TPromise } from 'vs/base/common/winjs.base';
import { IDialogService, IConfirmation, IConfirmationResult } from 'vs/platform/dialogs/common/dialogs';
import Severity from 'vs/base/common/severity';
import { localize } from 'vs/nls';
......@@ -14,8 +13,8 @@ export class CommandLineDialogService implements IDialogService {
_serviceBrand: any;
show(severity: Severity, message: string, options: string[]): TPromise<number> {
const promise = new TPromise<number>((c, e) => {
show(severity: Severity, message: string, options: string[]): Promise<number> {
const promise = new Promise<number>((c, e) => {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
......@@ -58,7 +57,7 @@ export class CommandLineDialogService implements IDialogService {
return -1;
}
confirm(confirmation: IConfirmation): TPromise<IConfirmationResult> {
confirm(confirmation: IConfirmation): Promise<IConfirmationResult> {
return this.show(Severity.Info, confirmation.message, [confirmation.primaryButton || localize('ok', "Ok"), confirmation.secondaryButton || localize('cancel', "Cancel")]).then(index => {
return {
confirmed: index === 0
......
......@@ -293,7 +293,7 @@ export class ExtensionHostMain {
// Execute the runner if it follows our spec
if (testRunner && typeof testRunner.run === 'function') {
return new TPromise<void>((c, e) => {
return new Promise<void>((c, e) => {
testRunner.run(this._environment.extensionTestsPath, (error, failures) => {
if (error) {
e(error.toString());
......
......@@ -4,13 +4,12 @@
*--------------------------------------------------------------------------------------------*/
import { onUnexpectedError } from 'vs/base/common/errors';
import { ErrorCallback, TPromise, ValueCallback } from 'vs/base/common/winjs.base';
export class LazyPromise implements Thenable<any> {
private _actual: TPromise<any> | null;
private _actualOk: ValueCallback | null;
private _actualErr: ErrorCallback | null;
private _actual: Promise<any> | null;
private _actualOk: (value?: any) => any | null;
private _actualErr: (err?: any) => any | null;
private _hasValue: boolean;
private _value: any;
......@@ -28,9 +27,9 @@ export class LazyPromise implements Thenable<any> {
this._err = null;
}
private _ensureActual(): TPromise<any> {
private _ensureActual(): Promise<any> {
if (!this._actual) {
this._actual = new TPromise<any>((c, e) => {
this._actual = new Promise<any>((c, e) => {
this._actualOk = c;
this._actualErr = e;
......
......@@ -110,7 +110,7 @@ suite('KeybindingsEditing', () => {
}
teardown(() => {
return new TPromise<void>((c, e) => {
return new Promise<void>((c, e) => {
if (testDir) {
extfs.del(testDir, os.tmpdir(), () => c(null), () => c(null));
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册