Skip to content

Commit

Permalink
Resolve promise when workspace state changes (#128344) (#128632)
Browse files Browse the repository at this point in the history
  • Loading branch information
lszomoru authored Jul 14, 2021
1 parent 7763597 commit d9e4111
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/vs/workbench/services/workspaces/common/workspaceTrust.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { Emitter } from 'vs/base/common/event';
import { Emitter, Event } from 'vs/base/common/event';
import { splitName } from 'vs/base/common/labels';
import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { LinkedList } from 'vs/base/common/linkedList';
Expand Down Expand Up @@ -756,9 +756,11 @@ export class WorkspaceTrustRequestService extends Disposable implements IWorkspa
return;
}

// Update storage, transition workspace, and resolve the promise
// Register one-time event handler to resolve the promise when workspace trust changed
Event.once(this.workspaceTrustManagementService.onDidChangeTrust)(trusted => this.resolveWorkspaceTrustRequest(trusted));

// Update storage, transition workspace state
await this.workspaceTrustManagementService.setWorkspaceTrust(trusted);
this.resolveWorkspaceTrustRequest(trusted);
}

async requestWorkspaceTrust(options?: WorkspaceTrustRequestOptions): Promise<boolean | undefined> {
Expand Down

0 comments on commit d9e4111

Please sign in to comment.