@@ -29,7 +29,7 @@ import { WORKSPACE_TRUST_BANNER, WORKSPACE_TRUST_EMPTY_WINDOW, WORKSPACE_TRUST_E
2929import { IEditorSerializer , IEditorFactoryRegistry , EditorExtensions } from 'vs/workbench/common/editor' ;
3030import { EditorInput } from 'vs/workbench/common/editor/editorInput' ;
3131import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
32- import { IWorkspaceContextService , WorkbenchState } from 'vs/platform/workspace/common/workspace' ;
32+ import { IWorkspaceContextService , IWorkspaceFoldersWillChangeEvent , WorkbenchState } from 'vs/platform/workspace/common/workspace' ;
3333import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions' ;
3434import { isWeb } from 'vs/base/common/platform' ;
3535import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys' ;
@@ -279,10 +279,10 @@ export class WorkspaceTrustUXHandler extends Disposable implements IWorkbenchCon
279279 if ( ! this . workspaceTrustEnablementService . isWorkspaceTrustEnabled ( ) ) {
280280 return ;
281281 }
282- const trusted = this . workspaceTrustManagementService . isWorkspaceTrusted ( ) ;
283282
284- // eslint-disable-next-line no-async-promise-executor
285- return e . join ( new Promise ( async resolve => {
283+ const addWorkspaceFolder = async ( e : IWorkspaceFoldersWillChangeEvent ) : Promise < void > => {
284+ const trusted = this . workspaceTrustManagementService . isWorkspaceTrusted ( ) ;
285+
286286 // Workspace is trusted and there are added/changed folders
287287 if ( trusted && ( e . changes . added . length || e . changes . changed . length ) ) {
288288 const addedFoldersTrustInfo = await Promise . all ( e . changes . added . map ( folder => this . workspaceTrustManagementService . getUriTrustInfo ( folder . uri ) ) ) ;
@@ -305,13 +305,11 @@ export class WorkspaceTrustUXHandler extends Disposable implements IWorkbenchCon
305305
306306 // Mark added/changed folders as trusted
307307 await this . workspaceTrustManagementService . setUrisTrust ( addedFoldersTrustInfo . map ( i => i . uri ) , result . choice === 0 ) ;
308-
309- resolve ( ) ;
310308 }
311309 }
310+ } ;
312311
313- resolve ( ) ;
314- } ) ) ;
312+ return e . join ( addWorkspaceFolder ( e ) ) ;
315313 } ) ) ;
316314
317315 this . _register ( this . workspaceTrustManagementService . onDidChangeTrust ( trusted => {
0 commit comments