Skip to content

Commit d9e4111

Browse files
authored
Resolve promise when workspace state changes (microsoft#128344) (microsoft#128632)
1 parent 7763597 commit d9e4111

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/vs/workbench/services/workspaces/common/workspaceTrust.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { Emitter } from 'vs/base/common/event';
6+
import { Emitter, Event } from 'vs/base/common/event';
77
import { splitName } from 'vs/base/common/labels';
88
import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
99
import { LinkedList } from 'vs/base/common/linkedList';
@@ -756,9 +756,11 @@ export class WorkspaceTrustRequestService extends Disposable implements IWorkspa
756756
return;
757757
}
758758

759-
// Update storage, transition workspace, and resolve the promise
759+
// Register one-time event handler to resolve the promise when workspace trust changed
760+
Event.once(this.workspaceTrustManagementService.onDidChangeTrust)(trusted => this.resolveWorkspaceTrustRequest(trusted));
761+
762+
// Update storage, transition workspace state
760763
await this.workspaceTrustManagementService.setWorkspaceTrust(trusted);
761-
this.resolveWorkspaceTrustRequest(trusted);
762764
}
763765

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

0 commit comments

Comments
 (0)