Skip to content

Commit

Permalink
Allow installation of VS Code extension packs
Browse files Browse the repository at this point in the history
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 <vincent.fugnitto@ericsson.com>
  • Loading branch information
vince-fugnitto committed Dec 5, 2019
1 parent eb74d4a commit b6daa53
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
19 changes: 12 additions & 7 deletions packages/plugin-ext-vscode/src/node/scanner-vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,20 @@ export class VsCodePluginScanner extends TheiaPluginScanner implements PluginSca
* Maps extension dependencies to deployable extension dependencies.
*/
getDependencies(plugin: PluginPackage): Map<string, string> | undefined {
if (!plugin.extensionDependencies || !plugin.extensionDependencies.length) {
return undefined;
}
// Store the list of dependencies.
const dependencies = new Map<string, string>();
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 {
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-ext/src/common/plugin-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b6daa53

Please sign in to comment.