MCPcopy
hub / github.com/dotnet/vscode-csharp / installExtensions

Function installExtensions

test/vscodeLauncher.ts:71–94  ·  view source on GitHub ↗
(extensionIds: string[], vscodeCli: string, vscodeArgs: string[])

Source from the content-addressed store, hash-verified

69}
70
71async function installExtensions(extensionIds: string[], vscodeCli: string, vscodeArgs: string[]): Promise<void> {
72 for (const extensionId of extensionIds) {
73 // Workaround for https://github.com/microsoft/vscode/issues/256031 to retry installing the extension with a delay.
74 let installError: any | undefined = undefined;
75 let installSucceeded = false;
76 for (let attempts = 0; attempts < 5; attempts++) {
77 try {
78 await installExtension(extensionId, vscodeCli, vscodeArgs);
79 installSucceeded = true;
80 break;
81 } catch (error) {
82 console.warn(`Failed to install extension ${extensionId}; retrying: ${error}`);
83 installError = error;
84 await new Promise((resolve) => setTimeout(resolve, 2000));
85 }
86 }
87
88 if (!installSucceeded) {
89 throw installError;
90 }
91 }
92
93 console.log();
94}
95
96async function installExtension(extensionId: string, vscodeCli: string, vscodeArgs: string[]): Promise<void> {
97 const argsWithExtension = [...vscodeArgs, '--install-extension', extensionId];

Callers 1

Calls 3

installExtensionFunction · 0.85
warnMethod · 0.80
logMethod · 0.80

Tested by

no test coverage detected