(extensionIds: string[], vscodeCli: string, vscodeArgs: string[])
| 69 | } |
| 70 | |
| 71 | async 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 | |
| 96 | async function installExtension(extensionId: string, vscodeCli: string, vscodeArgs: string[]): Promise<void> { |
| 97 | const argsWithExtension = [...vscodeArgs, '--install-extension', extensionId]; |
no test coverage detected