提交 d8a39866 编写于 作者: J Johannes Rieken

avoid async and winjs.promise, #53442

上级 51afe35d
......@@ -537,14 +537,15 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
return TPromise.as(true);
}
return TPromise.as(false);
return TPromise.wrap(false);
}
private openFileForURI(uri: URI): void {
private openFileForURI(uri: URI): TPromise<boolean> {
const cli = assign(Object.create(null), this.environmentService.args, { goto: true });
const pathsToOpen = [uri.fsPath];
this.windowsMainService.open({ context: OpenContext.API, cli, pathsToOpen });
return TPromise.wrap(true);
}
dispose(): void {
......
......@@ -573,7 +573,11 @@ class SaveExtensionHostProfileAction extends Action {
});
}
async run(): TPromise<any> {
run(): TPromise<any> {
return TPromise.wrap(this._asyncRun());
}
private async _asyncRun(): Promise<any> {
let picked = await this._windowService.showSaveDialog({
title: 'Save Extension Host Profile',
buttonLabel: 'Save',
......
......@@ -65,7 +65,7 @@ export class TerminalInstance implements ITerminalInstance {
private _rows: number;
private _dimensionsOverride: ITerminalDimensions;
private _windowsShellHelper: WindowsShellHelper;
private _xtermReadyPromise: TPromise<void>;
private _xtermReadyPromise: Promise<void>;
private _disposables: lifecycle.IDisposable[];
private _messageTitleDisposable: lifecycle.IDisposable;
......@@ -255,7 +255,7 @@ export class TerminalInstance implements ITerminalInstance {
/**
* Create xterm.js instance and attach data listeners.
*/
protected async _createXterm(): TPromise<void> {
protected async _createXterm(): Promise<void> {
if (!Terminal) {
Terminal = (await import('vscode-xterm')).Terminal;
// Enable xterm.js addons
......
......@@ -649,7 +649,7 @@ export class ExtensionService extends Disposable implements IExtensionService {
}
}
private static async _validateExtensionsCache(windowService: IWindowService, notificationService: INotificationService, environmentService: IEnvironmentService, cacheKey: string, input: ExtensionScannerInput): TPromise<void> {
private static async _validateExtensionsCache(windowService: IWindowService, notificationService: INotificationService, environmentService: IEnvironmentService, cacheKey: string, input: ExtensionScannerInput): Promise<void> {
const cacheFolder = path.join(environmentService.userDataPath, MANIFEST_CACHE_FOLDER);
const cacheFile = path.join(cacheFolder, cacheKey);
......@@ -684,7 +684,7 @@ export class ExtensionService extends Disposable implements IExtensionService {
);
}
private static async _readExtensionCache(environmentService: IEnvironmentService, cacheKey: string): TPromise<IExtensionCacheData> {
private static async _readExtensionCache(environmentService: IEnvironmentService, cacheKey: string): Promise<IExtensionCacheData> {
const cacheFolder = path.join(environmentService.userDataPath, MANIFEST_CACHE_FOLDER);
const cacheFile = path.join(cacheFolder, cacheKey);
......@@ -698,7 +698,7 @@ export class ExtensionService extends Disposable implements IExtensionService {
return null;
}
private static async _writeExtensionCache(environmentService: IEnvironmentService, cacheKey: string, cacheContents: IExtensionCacheData): TPromise<void> {
private static async _writeExtensionCache(environmentService: IEnvironmentService, cacheKey: string, cacheContents: IExtensionCacheData): Promise<void> {
const cacheFolder = path.join(environmentService.userDataPath, MANIFEST_CACHE_FOLDER);
const cacheFile = path.join(cacheFolder, cacheKey);
......@@ -715,7 +715,7 @@ export class ExtensionService extends Disposable implements IExtensionService {
}
}
private static async _scanExtensionsWithCache(windowService: IWindowService, notificationService: INotificationService, environmentService: IEnvironmentService, cacheKey: string, input: ExtensionScannerInput, log: ILog): TPromise<IExtensionDescription[]> {
private static async _scanExtensionsWithCache(windowService: IWindowService, notificationService: INotificationService, environmentService: IEnvironmentService, cacheKey: string, input: ExtensionScannerInput, log: ILog): Promise<IExtensionDescription[]> {
if (input.devMode) {
// Do not cache when running out of sources...
return ExtensionScanner.scanExtensions(input, log);
......@@ -788,7 +788,7 @@ export class ExtensionService extends Disposable implements IExtensionService {
log
);
let finalBuiltinExtensions: TPromise<IExtensionDescription[]> = builtinExtensions;
let finalBuiltinExtensions: TPromise<IExtensionDescription[]> = TPromise.wrap(builtinExtensions);
if (devMode) {
const builtInExtensionsFilePath = path.normalize(path.join(URI.parse(require.toUrl('')).fsPath, '..', 'build', 'builtInExtensions.json'));
......
......@@ -524,7 +524,7 @@ export class ExtensionScanner {
/**
* Scan a list of extensions defined in `absoluteFolderPath`
*/
public static async scanExtensions(input: ExtensionScannerInput, log: ILog, resolver: IExtensionResolver = null): TPromise<IExtensionDescription[]> {
public static async scanExtensions(input: ExtensionScannerInput, log: ILog, resolver: IExtensionResolver = null): Promise<IExtensionDescription[]> {
const absoluteFolderPath = input.absoluteFolderPath;
const isBuiltin = input.isBuiltin;
const isUnderDevelopment = input.isUnderDevelopment;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册