Skip to content

Commit cee47d0

Browse files
author
Benjamin Pasero
committed
adopt Promise.finally (for microsoft#67027)
1 parent 1cbdd82 commit cee47d0

3 files changed

Lines changed: 3 additions & 6 deletions

File tree

src/vs/platform/lifecycle/electron-main/lifecycleMain.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { ICodeWindow } from 'vs/platform/windows/electron-main/windows';
1212
import { handleVetos } from 'vs/platform/lifecycle/common/lifecycle';
1313
import { isMacintosh, isWindows } from 'vs/base/common/platform';
1414
import { Disposable } from 'vs/base/common/lifecycle';
15-
import { always } from 'vs/base/common/async';
1615

1716
export const ILifecycleService = createDecorator<ILifecycleService>('lifecycleService');
1817

@@ -202,7 +201,7 @@ export class LifecycleService extends Disposable implements ILifecycleService {
202201
const shutdownPromise = this.beginOnWillShutdown();
203202

204203
// Wait until shutdown is signaled to be complete
205-
always(shutdownPromise, () => {
204+
shutdownPromise.finally(() => {
206205

207206
// Resolve pending quit promise now without veto
208207
this.resolvePendingQuitPromise(false /* no veto */);

src/vs/workbench/browser/parts/editor/editorPart.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { IDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle';
2323
import { assign } from 'vs/base/common/objects';
2424
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
2525
import { ISerializedEditorGroup, isSerializedEditorGroup } from 'vs/workbench/common/editor/editorGroup';
26-
import { always } from 'vs/base/common/async';
2726
import { EditorDropTarget } from 'vs/workbench/browser/parts/editor/editorDropTarget';
2827
import { localize } from 'vs/nls';
2928
import { Color } from 'vs/base/common/color';
@@ -829,7 +828,7 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
829828
}
830829

831830
// Signal restored
832-
always(Promise.all(this.groups.map(group => group.whenRestored)), () => this.whenRestoredResolve());
831+
Promise.all(this.groups.map(group => group.whenRestored)).finally(() => this.whenRestoredResolve());
833832

834833
// Update container
835834
this.updateContainer();

src/vs/workbench/services/history/electron-browser/history.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import { EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor';
3030
import { IPartService } from 'vs/workbench/services/part/common/partService';
3131
import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
3232
import { coalesce } from 'vs/base/common/arrays';
33-
import { always } from 'vs/base/common/async';
3433

3534
/**
3635
* Stores the selection & view state of an editor and allows to compare it to other selection states.
@@ -408,7 +407,7 @@ export class HistoryService extends Disposable implements IHistoryService {
408407
private navigate(acrossEditors?: boolean): void {
409408
this.navigatingInStack = true;
410409

411-
always(this.doNavigate(this.stack[this.index], !acrossEditors), () => this.navigatingInStack = false);
410+
this.doNavigate(this.stack[this.index], !acrossEditors).finally(() => this.navigatingInStack = false);
412411
}
413412

414413
private doNavigate(location: IStackEntry, withSelection: boolean): Promise<IBaseEditor> {

0 commit comments

Comments
 (0)