Skip to content

Commit a97d624

Browse files
committed
this.fileService not available inside array.map
1 parent 4c78feb commit a97d624

1 file changed

Lines changed: 22 additions & 18 deletions

File tree

src/vs/workbench/parts/stats/node/workspaceStats.ts

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -314,29 +314,33 @@ export class WorkspaceStats implements IWorkbenchContribution {
314314
}
315315

316316
if (nameSet.has('package.json')) {
317-
await TPromise.join(folders.map(async workspaceUri => {
317+
const promises = [];
318+
for (let i = 0; i < folders.length; i++) {
319+
const workspaceUri = folders[i];
318320
const uri = workspaceUri.with({ path: `${workspaceUri.path !== '/' ? workspaceUri.path : ''}/package.json` });
319-
try {
320-
const content = await this.fileService.resolveContent(uri, { acceptTextOnly: true });
321-
const packageJsonContents = JSON.parse(content.value);
322-
if (packageJsonContents['dependencies']) {
323-
for (let module of ModulesToLookFor) {
324-
if ('react-native' === module) {
325-
if (packageJsonContents['dependencies'][module]) {
326-
tags['workspace.reactNative'] = true;
327-
}
328-
} else {
329-
if (packageJsonContents['dependencies'][module]) {
330-
tags['workspace.npm.' + module] = true;
321+
promises.push(this.fileService.resolveContent(uri, { acceptTextOnly: true }).then(content => {
322+
try {
323+
const packageJsonContents = JSON.parse(content.value);
324+
if (packageJsonContents['dependencies']) {
325+
for (let module of ModulesToLookFor) {
326+
if ('react-native' === module) {
327+
if (packageJsonContents['dependencies'][module]) {
328+
tags['workspace.reactNative'] = true;
329+
}
330+
} else {
331+
if (packageJsonContents['dependencies'][module]) {
332+
tags['workspace.npm.' + module] = true;
333+
}
331334
}
332335
}
333336
}
334337
}
335-
}
336-
catch (e) {
337-
// Ignore errors when resolving file or parsing file contents
338-
}
339-
}));
338+
catch (e) {
339+
// Ignore errors when resolving file or parsing file contents
340+
}
341+
}));
342+
}
343+
await TPromise.join(promises);
340344
}
341345
}
342346
return TPromise.as(tags);

0 commit comments

Comments
 (0)