From 1578d2d32c7de3e4d0aa7e1bf4cffc458bb93664 Mon Sep 17 00:00:00 2001 From: Olaf Lessenich Date: Wed, 24 Apr 2024 10:57:48 +0200 Subject: [PATCH] plugin-ext-vscode: apply file handlers only for user plugins (#13435) This patch fixes an unexpected behavior where Theia would also pick up and deploy .vsix files from the local-plugins directory into the deployedPlugins directory, where they will be treated as user-installed extensions on the next start of theia. Instead, we now only apply the file handlers for .vsix files if they are user extensions. For system plugins, we print a warning message indicating that the plugin has to be unpacked manually. Fixes #13222 Contributed on behalf of STMicroelectronics Signed-off-by: Olaf Lessenich --- .../src/main/node/plugin-deployer-impl.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/plugin-ext/src/main/node/plugin-deployer-impl.ts b/packages/plugin-ext/src/main/node/plugin-deployer-impl.ts index 8c60671b78b88..e7a900e4290f8 100644 --- a/packages/plugin-ext/src/main/node/plugin-deployer-impl.ts +++ b/packages/plugin-ext/src/main/node/plugin-deployer-impl.ts @@ -225,8 +225,20 @@ export class PluginDeployerImpl implements PluginDeployer { } protected async resolveAndHandle(id: string, type: PluginType, options?: PluginDeployOptions): Promise { - const entries = await this.resolvePlugin(id, type, options); - await this.applyFileHandlers(entries); + let entries = await this.resolvePlugin(id, type, options); + if (type === PluginType.User) { + await this.applyFileHandlers(entries); + } else { + const filteredEntries: PluginDeployerEntry[] = []; + for (const entry of entries) { + if (await entry.isFile()) { + this.logger.warn(`Only user plugins will be handled by file handlers, please unpack the plugin '${entry.id()}' manually.`); + } else { + filteredEntries.push(entry); + } + } + entries = filteredEntries; + } await this.applyDirectoryFileHandlers(entries); return entries; }