mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-04 10:22:17 +01:00
Handle badly formatted launch config files when calculating workspace stats
This commit is contained in:
+15
-10
@@ -38,21 +38,26 @@ export function collectLaunchConfigs(folder: string): Promise<WorkspaceStatItem[
|
||||
return resolve([]);
|
||||
}
|
||||
|
||||
const json = JSON.parse(contents.toString());
|
||||
if (json['configurations']) {
|
||||
for (const each of json['configurations']) {
|
||||
const type = each['type'];
|
||||
if (type) {
|
||||
if (launchConfigs.has(type)) {
|
||||
launchConfigs.set(type, launchConfigs.get(type) + 1);
|
||||
}
|
||||
else {
|
||||
launchConfigs.set(type, 1);
|
||||
try {
|
||||
const json = JSON.parse(contents.toString());
|
||||
if (json['configurations']) {
|
||||
for (const each of json['configurations']) {
|
||||
const type = each['type'];
|
||||
if (type) {
|
||||
if (launchConfigs.has(type)) {
|
||||
launchConfigs.set(type, launchConfigs.get(type) + 1);
|
||||
}
|
||||
else {
|
||||
launchConfigs.set(type, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(`Unable to parse ${launchConfig}`);
|
||||
}
|
||||
|
||||
|
||||
return resolve(asSortedItems(launchConfigs));
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user