@@ -42,33 +42,33 @@ export class DiagnosticsMainService implements IDiagnosticsMainService {
4242
4343 async getRemoteDiagnostics ( options : IRemoteDiagnosticOptions ) : Promise < ( IRemoteDiagnosticInfo | IRemoteDiagnosticError ) [ ] > {
4444 const windows = this . windowsMainService . getWindows ( ) ;
45- const diagnostics : Array < IDiagnosticInfo | IRemoteDiagnosticError | undefined > = await Promise . all ( windows . map ( window => {
46- return new Promise < IDiagnosticInfo | IRemoteDiagnosticError | undefined > ( ( resolve ) => {
47- const remoteAuthority = window . remoteAuthority ;
48- if ( remoteAuthority ) {
49- const replyChannel = `vscode:getDiagnosticInfoResponse ${ window . id } ` ;
50- const args : IDiagnosticInfoOptions = {
51- includeProcesses : options . includeProcesses ,
52- folders : options . includeWorkspaceMetadata ? this . getFolderURIs ( window ) : undefined
53- } ;
54-
55- window . sendWhenReady ( 'vscode:getDiagnosticInfo' , CancellationToken . None , { replyChannel , args } ) ;
56-
57- validatedIpcMain . once ( replyChannel , ( _ : IpcEvent , data : IRemoteDiagnosticInfo ) => {
58- // No data is returned if getting the connection fails.
59- if ( ! data ) {
60- resolve ( { hostName : remoteAuthority , errorMessage : `Unable to resolve connection to ' ${ remoteAuthority } '.` } ) ;
61- }
62-
63- resolve ( data ) ;
64- } ) ;
65-
66- setTimeout ( ( ) => {
67- resolve ( { hostName : remoteAuthority , errorMessage : `Connection to ' ${ remoteAuthority } ' could not be established` } ) ;
68- } , 5000 ) ;
69- } else {
70- resolve ( undefined ) ;
71- }
45+ const diagnostics : Array < IDiagnosticInfo | IRemoteDiagnosticError | undefined > = await Promise . all ( windows . map ( async window => {
46+ const remoteAuthority = window . remoteAuthority ;
47+ if ( ! remoteAuthority ) {
48+ return undefined ;
49+ }
50+
51+ const replyChannel = `vscode:getDiagnosticInfoResponse ${ window . id } ` ;
52+ const args : IDiagnosticInfoOptions = {
53+ includeProcesses : options . includeProcesses ,
54+ folders : options . includeWorkspaceMetadata ? await this . getFolderURIs ( window ) : undefined
55+ } ;
56+
57+ return new Promise < IDiagnosticInfo | IRemoteDiagnosticError > ( resolve => {
58+ window . sendWhenReady ( 'vscode:getDiagnosticInfo' , CancellationToken . None , { replyChannel , args } ) ;
59+
60+ validatedIpcMain . once ( replyChannel , ( _ : IpcEvent , data : IRemoteDiagnosticInfo ) => {
61+ // No data is returned if getting the connection fails.
62+ if ( ! data ) {
63+ resolve ( { hostName : remoteAuthority , errorMessage : `Unable to resolve connection to ' ${ remoteAuthority } '.` } ) ;
64+ }
65+
66+ resolve ( data ) ;
67+ } ) ;
68+
69+ setTimeout ( ( ) => {
70+ resolve ( { hostName : remoteAuthority , errorMessage : `Connection to ' ${ remoteAuthority } ' could not be established` } ) ;
71+ } , 5000 ) ;
7272 } ) ;
7373 } ) ) ;
7474
@@ -82,7 +82,7 @@ export class DiagnosticsMainService implements IDiagnosticsMainService {
8282 for ( const window of BrowserWindow . getAllWindows ( ) ) {
8383 const codeWindow = this . windowsMainService . getWindowById ( window . id ) ;
8484 if ( codeWindow ) {
85- windows . push ( this . codeWindowToInfo ( codeWindow ) ) ;
85+ windows . push ( await this . codeWindowToInfo ( codeWindow ) ) ;
8686 } else {
8787 windows . push ( this . browserWindowToInfo ( window ) ) ;
8888 }
@@ -97,8 +97,8 @@ export class DiagnosticsMainService implements IDiagnosticsMainService {
9797 } ;
9898 }
9999
100- private codeWindowToInfo ( window : ICodeWindow ) : IWindowDiagnostics {
101- const folderURIs = this . getFolderURIs ( window ) ;
100+ private async codeWindowToInfo ( window : ICodeWindow ) : Promise < IWindowDiagnostics > {
101+ const folderURIs = await this . getFolderURIs ( window ) ;
102102 const win = assertIsDefined ( window . win ) ;
103103
104104 return this . browserWindowToInfo ( win , folderURIs , window . remoteAuthority ) ;
@@ -113,14 +113,14 @@ export class DiagnosticsMainService implements IDiagnosticsMainService {
113113 } ;
114114 }
115115
116- private getFolderURIs ( window : ICodeWindow ) : URI [ ] {
116+ private async getFolderURIs ( window : ICodeWindow ) : Promise < URI [ ] > {
117117 const folderURIs : URI [ ] = [ ] ;
118118
119119 const workspace = window . openedWorkspace ;
120120 if ( isSingleFolderWorkspaceIdentifier ( workspace ) ) {
121121 folderURIs . push ( workspace . uri ) ;
122122 } else if ( isWorkspaceIdentifier ( workspace ) ) {
123- const resolvedWorkspace = this . workspacesManagementMainService . resolveLocalWorkspaceSync ( workspace . configPath ) ; // workspace folders can only be shown for local (resolved) workspaces
123+ const resolvedWorkspace = await this . workspacesManagementMainService . resolveLocalWorkspace ( workspace . configPath ) ; // workspace folders can only be shown for local (resolved) workspaces
124124 if ( resolvedWorkspace ) {
125125 const rootFolders = resolvedWorkspace . folders ;
126126 rootFolders . forEach ( root => {
0 commit comments