@@ -42,33 +42,33 @@ export class DiagnosticsMainService implements IDiagnosticsMainService {
42
42
43
43
async getRemoteDiagnostics ( options : IRemoteDiagnosticOptions ) : Promise < ( IRemoteDiagnosticInfo | IRemoteDiagnosticError ) [ ] > {
44
44
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 ) ;
72
72
} ) ;
73
73
} ) ) ;
74
74
@@ -82,7 +82,7 @@ export class DiagnosticsMainService implements IDiagnosticsMainService {
82
82
for ( const window of BrowserWindow . getAllWindows ( ) ) {
83
83
const codeWindow = this . windowsMainService . getWindowById ( window . id ) ;
84
84
if ( codeWindow ) {
85
- windows . push ( this . codeWindowToInfo ( codeWindow ) ) ;
85
+ windows . push ( await this . codeWindowToInfo ( codeWindow ) ) ;
86
86
} else {
87
87
windows . push ( this . browserWindowToInfo ( window ) ) ;
88
88
}
@@ -97,8 +97,8 @@ export class DiagnosticsMainService implements IDiagnosticsMainService {
97
97
} ;
98
98
}
99
99
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 ) ;
102
102
const win = assertIsDefined ( window . win ) ;
103
103
104
104
return this . browserWindowToInfo ( win , folderURIs , window . remoteAuthority ) ;
@@ -113,14 +113,14 @@ export class DiagnosticsMainService implements IDiagnosticsMainService {
113
113
} ;
114
114
}
115
115
116
- private getFolderURIs ( window : ICodeWindow ) : URI [ ] {
116
+ private async getFolderURIs ( window : ICodeWindow ) : Promise < URI [ ] > {
117
117
const folderURIs : URI [ ] = [ ] ;
118
118
119
119
const workspace = window . openedWorkspace ;
120
120
if ( isSingleFolderWorkspaceIdentifier ( workspace ) ) {
121
121
folderURIs . push ( workspace . uri ) ;
122
122
} 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
124
124
if ( resolvedWorkspace ) {
125
125
const rootFolders = resolvedWorkspace . folders ;
126
126
rootFolders . forEach ( root => {
0 commit comments