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

Add onStartupFinished plugin activation event #8525

Merged
merged 1 commit into from
Sep 29, 2020
Merged

Add onStartupFinished plugin activation event #8525

merged 1 commit into from
Sep 29, 2020

Conversation

vinokurig
Copy link
Contributor

What it does

Add onStartupFinished plugin activation event

fixes #8488

How to test

  1. Clone any Theia plugin e.g https://github.com/eclipse/che-theia-samples/tree/master/samples/hello-world-backend-plugin
  2. Change the activation event in its package.json from * to onStartupFinished
  3. Start the plugin.

Review checklist

Reminder for reviewers

@vinokurig vinokurig added plug-in system issues related to the plug-in system vscode issues related to VSCode compatibility labels Sep 18, 2020
@@ -217,6 +217,7 @@ export class HostedPluginSupport {
};
}
});
this.activateByEvent('onStartupFinished');
Copy link
Contributor

Choose a reason for hiding this comment

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

I was wondering why the event should be sent at this location and not another. What parts of the system need to be ready in order for startup to be finished? Not saying it's the wrong place, I just want to understand your thinking.

Copy link
Member

@azatsarynnyy azatsarynnyy left a comment

Choose a reason for hiding this comment

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

I've verified it according to "How to test" steps. Works well, but I have some concerns about the activation order.

Why not emit it after a star(*) activation

await this.$activateByEvent('*');

as it's in VSCode
https://github.com/microsoft/vscode/blob/0e297b112830bd5be9cf51a848d9314c3887ec42/src/vs/workbench/api/common/extHostExtensionService.ts#L475

Isn't it too early emitting onStartupFinished during hosted-plugin initialization?
Won't it happen eager than a star(*) activation?

Copy link
Member

@azatsarynnyy azatsarynnyy left a comment

Choose a reason for hiding this comment

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

Or another variant. As HostedPluginSupport is FrontendApplicationContribution, wouldn't it better to emit the event on some of the FrontendApplicationContribution's callbacks, e.g. onStart or onDidInitializeLayout?

@vinokurig
Copy link
Contributor Author

@tsmaeder @azatsarynnyy I think I've found a better place for this event :). Now it is called on application's ready state which suites the event's documentation.

Copy link
Member

@azatsarynnyy azatsarynnyy left a comment

Choose a reason for hiding this comment

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

I believe emitting on appState.reachedState('ready') looks late enough as for onStartupFinished.

@akosyakov
Copy link
Member

Did you check VS Code source code to learn the real semantic of this event and align it?

@vinokurig
Copy link
Contributor Author

@akosyakov
vscode handles this event after the * events and the workspaceContains events: https://github.com/microsoft/vscode/blob/7e0c1aa76e4ce162679409828af17535d50a4424/src/vs/workbench/api/common/extHostExtensionService.ts#L472-L476
Do you think it is better to handle this event after the workspaceContains events here?

this.activateByWorkspaceContains(manager, plugin);
}
} catch (e) {
console.error(`Failed to start plugins for '${host}' host`, e);
}
})());
}
await Promise.all(thenable);

@akosyakov
Copy link
Member

yes, i think it should mean the same

Signed-off-by: Igor Vinokur <ivinokur@redhat.com>
@vinokurig
Copy link
Contributor Author

@akosyakov Done

@vinokurig vinokurig merged commit 7e7d0cd into master Sep 29, 2020
@vinokurig vinokurig deleted the theia-8488 branch September 29, 2020 08:32
@jeluard
Copy link

jeluard commented Mar 11, 2021

@vinokurig I can see the following error message with latest master:

root ERROR [hosted-plugin: 93564] Unsupported activation events: onStartupFinished, please open an issue: https://github.com/eclipse-theia/theia/issues/new

Is there something specific to do to avoid that?

@vinokurig
Copy link
Contributor Author

@jeluard Thank you for reporting the issue, the PR above fixes this problem.

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 vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support 'onStartupFinished' plugin activation event
5 participants