提交 fcbf17e4 编写于 作者: R Rachel Macfarlane

Handle badly formatted launch config files when calculating workspace stats

上级 beb8133c
......@@ -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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册