Skip to content

Commit

Permalink
fix plugins are not loaded when staring theia without internet access
Browse files Browse the repository at this point in the history
fix eclipse-theia#6055
If all the vscode entensions dependencies(listed in the extensionDependencies field of vscode extension)
are already downloaded to local directory before staring theia, then there is no need to download them
from the remote(vscode marketplace) during the theia starting process.

Signed-off-by: tom-shan <swt0008411@163.com>
  • Loading branch information
tom-shan committed Aug 28, 2019
1 parent 85b7576 commit 4748d14
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/plugin-ext-vscode/src/node/scanner-vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class VsCodePluginScanner extends TheiaPluginScanner implements PluginSca
const result: PluginModel = {
// see id definition: https://github.com/microsoft/vscode/blob/15916055fe0cb9411a5f36119b3b012458fe0a1d/src/vs/platform/extensions/common/extensions.ts#L167-L169
id: `${plugin.publisher.toLowerCase()}.${plugin.name.toLowerCase()}`,
uniqueId: `${this.VSCODE_PREFIX}${plugin.publisher.toLowerCase()}.${plugin.name.toLowerCase()}`,
name: plugin.name,
publisher: plugin.publisher,
version: plugin.version,
Expand Down Expand Up @@ -63,6 +64,6 @@ export class VsCodePluginScanner extends TheiaPluginScanner implements PluginSca
* to an array of deployable extension dependencies
*/
private getDeployableDependencies(dependencies: string[]): string[] {
return dependencies.map(dep => this.VSCODE_PREFIX + dep);
return dependencies.map(dep => this.VSCODE_PREFIX + dep.toLowerCase());
}
}
1 change: 1 addition & 0 deletions packages/plugin-ext/src/common/plugin-api-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export const emptyPlugin: Plugin = {
},
model: {
id: 'emptyPlugin',
uniqueId: 'emptyPlugin',
name: 'emptyPlugin',
publisher: 'Theia',
version: 'empty',
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 @@ -363,6 +363,7 @@ export interface PluginDeployerDirectoryHandlerContext {
*/
export interface PluginModel {
id: string;
uniqueId: string;
name: string;
publisher: string;
version: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class TheiaPluginScanner implements PluginScanner {
const result: PluginModel = {
// see id definition: https://github.com/microsoft/vscode/blob/15916055fe0cb9411a5f36119b3b012458fe0a1d/src/vs/platform/extensions/common/extensions.ts#L167-L169
id: `${plugin.publisher.toLowerCase()}.${plugin.name.toLowerCase()}`,
uniqueId: `${plugin.publisher.toLowerCase()}.${plugin.name.toLowerCase()}`,
name: plugin.name,
publisher: plugin.publisher,
version: plugin.version,
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin-ext/src/main/node/plugin-deployer-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class PluginDeployerImpl implements PluginDeployer {
const queue = [...pluginEntries];
while (queue.length) {
const current = queue.shift()!;
if (visited.has(current)) {
if (visited.has(current) || pluginsToDeploy.has(current)) {
continue;
}
visited.add(current);
Expand All @@ -131,8 +131,8 @@ export class PluginDeployerImpl implements PluginDeployer {

for (const deployerEntry of pluginDeployerEntries) {
const metadata = await this.pluginDeployerHandler.getPluginMetadata(deployerEntry);
if (metadata && !pluginsToDeploy.has(metadata.model.id)) {
pluginsToDeploy.set(metadata.model.id, deployerEntry);
if (metadata && !pluginsToDeploy.has(metadata.model.uniqueId)) {
pluginsToDeploy.set(metadata.model.uniqueId, deployerEntry);
if (metadata.model.extensionDependencies) {
queue.push(...metadata.model.extensionDependencies);
}
Expand Down

0 comments on commit 4748d14

Please sign in to comment.