Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix plugins are not loaded when staring theia without internet access #6056

Closed

Conversation

tom-shan
Copy link
Contributor

What it does

fix #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.

How to test

1 download two vscode plugins from vscode marketplac

2 copy these two plugins to plugins directory
3 then start theia(cd examples/browser; yarn start), and check if all of the vscode extensins can be loaded successfully

Review checklist

Reminder for reviewers

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>
@tom-shan tom-shan requested a review from a team as a code owner August 28, 2019 08:14
@@ -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)) {
Copy link
Member

@akosyakov akosyakov Aug 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

metadata.model.id is already unique, the check is already in place

Why it is not enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But at the end the extension dependency will be resolved to publisher.name and should be filtered out by pluginsToDeploy.has(metadata.model.id), since there is already an extension with such publisher and name installed from local vsix.

metadata.model.id has to be unique identifier among all extensions, there should not be another

Copy link
Contributor Author

@tom-shan tom-shan Aug 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I misunderstood your question.

metadata.model.id is already unique.

That's right.

The reason I use metadata.model.uniqueId is that:
if using pluginsToDeploy.set(metadata.model.id, deployerEntry), considering queue.push(...metadata.model.extensionDependencies),
then queue will have some extensionDependencies elements which have the 'vscode:extension/' suffix,
and if (visited.has(current) || pluginsToDeploy.has(current)) { will not be true.

Because the keys of pluginsToDeploy and the elements of queue will never be equal even for the extensionDependencies.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is expected.

Copy link
Contributor Author

@tom-shan tom-shan Aug 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we should not continue to resolve the extensionDependencies when pluginsToDeploy contains them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not?

Copy link
Contributor Author

@tom-shan tom-shan Aug 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it will resolve twice for the same plugin.

@akosyakov akosyakov requested review from JPinkney and a team August 28, 2019 08:27
@akosyakov akosyakov added the plug-in system issues related to the plug-in system label Aug 28, 2019
@akosyakov
Copy link
Member

I thought the fix should be to wrap a loop body into try catch block, so failure to download one extension does not break the deployment flow.

@@ -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)) {
Copy link
Member

@akosyakov akosyakov Aug 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

current is deployment entry, it is not a plugin id

One can only check by a plugin id after resolution without it we don't know anything what is behind current.

@akosyakov
Copy link
Member

@tom-shan I've opened #6057 instead, could you try. It prevent resolution based on a plugin id as well.

@tom-shan
Copy link
Contributor Author

Sorry I'm out now. I will try about an hour later.

@tom-shan tom-shan closed this Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plug-in system issues related to the plug-in system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

plugins are not loaded when theia is started without internet access
2 participants