From b6daa53a74bdb261a6c17f49500e8437f0306bf5 Mon Sep 17 00:00:00 2001 From: Vincent Fugnitto Date: Tue, 3 Dec 2019 08:50:21 -0500 Subject: [PATCH] Allow installation of VS Code extension packs Fixes #6611 - added `extensionPack` property to `PluginPackage` interface. - when getting dependencies, ensure that `extensionPack` dependencies are also loaded. Extensions packs can now be unloaded and their bundled extensions installed. Signed-off-by: Vincent Fugnitto --- .../src/node/scanner-vscode.ts | 19 ++++++++++++------- .../plugin-ext/src/common/plugin-protocol.ts | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/plugin-ext-vscode/src/node/scanner-vscode.ts b/packages/plugin-ext-vscode/src/node/scanner-vscode.ts index ad47e1eabb6bc..a71ffafe33a65 100644 --- a/packages/plugin-ext-vscode/src/node/scanner-vscode.ts +++ b/packages/plugin-ext-vscode/src/node/scanner-vscode.ts @@ -52,15 +52,20 @@ export class VsCodePluginScanner extends TheiaPluginScanner implements PluginSca * Maps extension dependencies to deployable extension dependencies. */ getDependencies(plugin: PluginPackage): Map | undefined { - if (!plugin.extensionDependencies || !plugin.extensionDependencies.length) { - return undefined; - } + // Store the list of dependencies. const dependencies = new Map(); - for (const dependency of plugin.extensionDependencies) { - const dependencyId = dependency.toLowerCase(); - dependencies.set(dependencyId, this.VSCODE_PREFIX + dependencyId); + // Iterate through the list of dependencies from `extensionDependencies` and `extensionPack`. + for (const dependency of [plugin.extensionDependencies, plugin.extensionPack]) { + if (dependency !== undefined) { + // Iterate over the list of dependencies present, and add them to the collection. + dependency.forEach((dep: string) => { + const dependencyId = dep.toLowerCase(); + dependencies.set(dependencyId, this.VSCODE_PREFIX + dependencyId); + }); + } } - return dependencies; + // Return the map of dependencies if present, else `undefined`. + return dependencies.size > 0 ? dependencies : undefined ; } getLifecycle(plugin: PluginPackage): PluginLifecycle { diff --git a/packages/plugin-ext/src/common/plugin-protocol.ts b/packages/plugin-ext/src/common/plugin-protocol.ts index 73a3b65c1a6b4..c2acff87e9300 100644 --- a/packages/plugin-ext/src/common/plugin-protocol.ts +++ b/packages/plugin-ext/src/common/plugin-protocol.ts @@ -53,6 +53,7 @@ export interface PluginPackage { packagePath: string; activationEvents?: string[]; extensionDependencies?: string[]; + extensionPack?: string[]; } export namespace PluginPackage { export function toPluginUrl(pck: PluginPackage, relativePath: string): string {