Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
auxves authored and shanalikhan committed Jun 24, 2019
1 parent ce08a98 commit 5120fce
Showing 1 changed file with 25 additions and 31 deletions.
56 changes: 25 additions & 31 deletions src/service/pluginService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,7 @@ export class PluginService {
return selectedExtension;
} catch (err) {
throw new Error(
`Sync : Unable to delete extension ${selectedExtension.name} ${
selectedExtension.version
}: ${err}`
`Sync : Unable to delete extension ${selectedExtension.name} ${selectedExtension.version}: ${err}`
);
}
})
Expand Down Expand Up @@ -213,37 +211,33 @@ export class PluginService {
missingExtensions: ExtensionInformation[],
notificationCallBack: (...data: any[]) => void
): Promise<ExtensionInformation[]> {
let remainingExtensions: ExtensionInformation[] = [...missingExtensions];
const addedExtensions: ExtensionInformation[] = [];
const missingExtensionsCount = missingExtensions.length;
notificationCallBack("TOTAL EXTENSIONS : " + missingExtensionsCount);
notificationCallBack("");
notificationCallBack("");
return Promise.all(
await missingExtensions.map(async ext => {
const name = ext.publisher + "." + ext.name;
try {
notificationCallBack("");
notificationCallBack(`[x] - EXTENSION: ${ext.name} - INSTALLING`);
await vscode.commands.executeCommand(
"workbench.extensions.installExtension",
name
);
remainingExtensions = remainingExtensions.filter(
remExt => remExt.name !== ext.name
);

notificationCallBack(` - EXTENSION: ${ext.name} - INSTALLED.`);
notificationCallBack(
` ${missingExtensions.length -
remainingExtensions.length} OF ${missingExtensionsCount} INSTALLED`,
true
);
notificationCallBack("");
return ext;
} catch (err) {
throw new Error(err);
}
})
);
for (const ext of missingExtensions) {
const name = ext.publisher + "." + ext.name;
try {
notificationCallBack("");
notificationCallBack(`[x] - EXTENSION: ${ext.name} - INSTALLING`);
await vscode.commands.executeCommand(
"workbench.extensions.installExtension",
name
);
notificationCallBack("");
notificationCallBack(`[x] - EXTENSION: ${ext.name} INSTALLED.`);
notificationCallBack(
` ${missingExtensions.indexOf(ext) +
1} OF ${missingExtensionsCount} INSTALLED`,
true
);
notificationCallBack("");
addedExtensions.push(ext);
} catch (err) {
throw new Error(err);
}
}
return addedExtensions;
}
}

0 comments on commit 5120fce

Please sign in to comment.