From 0f965d5bd988ed34de478165a247b70c6f3160a7 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 2 Jul 2018 17:18:00 +0200 Subject: [PATCH] #53442 Avoid async and winjs promise --- .../preferences/browser/preferencesEditor.ts | 8 ++++---- .../parts/search/browser/searchActions.ts | 15 ++++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/vs/workbench/parts/preferences/browser/preferencesEditor.ts b/src/vs/workbench/parts/preferences/browser/preferencesEditor.ts index afaa9962fea..9b12f126db0 100644 --- a/src/vs/workbench/parts/preferences/browser/preferencesEditor.ts +++ b/src/vs/workbench/parts/preferences/browser/preferencesEditor.ts @@ -434,7 +434,7 @@ class PreferencesRenderersController extends Disposable { } } - private async _onEditableContentDidChange(): TPromise { + private async _onEditableContentDidChange(): Promise { await this.localFilterPreferences(this._lastQuery, true); await this.remoteSearchPreferences(this._lastQuery, true); } @@ -511,11 +511,11 @@ class PreferencesRenderersController extends Disposable { return TPromise.join(searchPs).then(() => { }); } - private searchSettingsTarget(query: string, provider: ISearchProvider, target: SettingsTarget, groupId: string, groupLabel: string, groupOrder: number): TPromise { + private searchSettingsTarget(query: string, provider: ISearchProvider, target: SettingsTarget, groupId: string, groupLabel: string, groupOrder: number): Promise { if (!query) { // Don't open the other settings targets when query is empty this._onDidFilterResultsCountChange.fire({ target, count: 0 }); - return TPromise.wrap(null); + return Promise.resolve(null); } return this.getPreferencesEditorModel(target).then(model => { @@ -532,7 +532,7 @@ class PreferencesRenderersController extends Disposable { }); } - private async getPreferencesEditorModel(target: SettingsTarget): TPromise { + private async getPreferencesEditorModel(target: SettingsTarget): Promise { const resource = target === ConfigurationTarget.USER ? this.preferencesService.userSettingsResource : target === ConfigurationTarget.WORKSPACE ? this.preferencesService.workspaceSettingsResource : target; diff --git a/src/vs/workbench/parts/search/browser/searchActions.ts b/src/vs/workbench/parts/search/browser/searchActions.ts index 0fb3e737976..bd2aa0463a9 100644 --- a/src/vs/workbench/parts/search/browser/searchActions.ts +++ b/src/vs/workbench/parts/search/browser/searchActions.ts @@ -492,14 +492,15 @@ export class ReplaceAllInFolderAction extends AbstractSearchAndReplaceAction { super(Constants.ReplaceAllInFolderActionId, appendKeyBindingLabel(ReplaceAllInFolderAction.LABEL, keyBindingService.lookupKeybinding(Constants.ReplaceAllInFolderActionId), keyBindingService), 'action-replace-all'); } - public async run(): TPromise { + public run(): TPromise { let nextFocusElement = this.getElementToFocusAfterRemoved(this.viewer, this.folderMatch); - await this.folderMatch.replaceAll(); - - if (nextFocusElement) { - this.viewer.setFocus(nextFocusElement); - } - this.viewer.domFocus(); + return this.folderMatch.replaceAll() + .then(() => { + if (nextFocusElement) { + this.viewer.setFocus(nextFocusElement); + } + this.viewer.domFocus(); + }); } } -- GitLab