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

Incorrect "Unsupported activation event" error in stdout #12953 #13095

Merged
merged 2 commits into from
Dec 18, 2023

Conversation

jfaltermeier
Copy link
Contributor

@jfaltermeier jfaltermeier commented Nov 23, 2023

What it does

In this PR we are adding a mechanism to add additional known activation events to avoid "Unsupported activation event" messages in the log.

In my initial implementation the information is taken from an environment variable.
For the browser application use case the environment may be set when building the container image for the app.
For the electron application use case a custom main script may be used, that sets the desired environment variable value and then hands over to the generated electron-main.js.
Also the user/application may influence the environment variable further if required.

Any additional plugin installed by the user may bring in new warnings, so I was not sure if a more programmatic approach, where the activation events have to be specified at compile/build time, is working for all use cases.
A user preference might work, but it seems a bit weird to me to have this in the settings.
So this is my reasoning for the initial environment variable approach.

If you would prefer a different approach to specify the events, let me know and I will adjust the PR.

Fixes #12953

How to test

Run Electron Example with downloaded plugins

yarn && yarn download:plugins && yarn electron build && clear && yarn electron start

With the default plugins you should get the following warnings:

Unsupported activation events: onProfile, onProfile:github, please open an issue: https://github.com/eclipse-theia/theia/issues/new
Unsupported activation events: onOpenExternalUri:http, onOpenExternalUri:https, please open an issue: https://github.com/eclipse-theia/theia/issues/new
Unsupported activation events: onWalkthrough:nodejsWelcome, please open an issue: https://github.com/eclipse-theia/theia/issues/new

Now run the same same application with the ADDITIONAL_ACTIVATION_EVENTS env variable.

export ADDITIONAL_ACTIVATION_EVENTS=onProfile,onOpenExternalUri,onWalkthrough && clear && yarn electron start

This will remove the warnings/errors.

Follow-ups

Review checklist

Reminder for reviewers

* add env variable which allows adding additional activation events
@jfaltermeier jfaltermeier force-pushed the jf/12953_activation_event_warning branch from 838f6d1 to 4bc9392 Compare November 23, 2023 14:15
@jfaltermeier jfaltermeier marked this pull request as ready for review November 23, 2023 14:58
Copy link
Contributor

@martin-fleck-at martin-fleck-at left a comment

Choose a reason for hiding this comment

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

Thank you very much Johannes! Change looks good to me in general, I'm just wondering whether we should be so focused on the environment variable approach (see inline comment),

@@ -219,6 +221,12 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {

this.webview.init(params.webview);
this.jsonValidation = params.jsonValidation;

this.supportedActivationEvents = new Set(PluginManagerExtImpl.BUILTIN_ACTIVATION_EVENTS);
const additionalActivationEvents = await this.envExt.getEnvVariable(PluginManagerExtImpl.ADDITIONAL_ACTIVATION_EVENTS_ENV);
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder whether the additional activation events shouldn't be part of the PluginManagerInitializeParams used in the $init call to initialize the plugin manager. It already contains the some other setup data and is also called before the $start method with the PluginManagerStartParams where we get the first set of activation events. I think that would also give us a more fine-grained option to handle how those events are obtained and maybe even provide different events for different plugin managers. For now I'm fine if they are still coming from environment variables, just gathered in the hosted-plugin.ts during initialization of the manager and added as a dedicated, optional parameter.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, please have another look at the changes.
I've moved the known events + reading the env var to hosted-plugin.ts and extended the PluginManagerInitializeParams to include the supported events.

Copy link
Contributor

@martin-fleck-at martin-fleck-at left a comment

Choose a reason for hiding this comment

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

Great, changes look good to me, thank you Johannes!

@jfaltermeier jfaltermeier merged commit c38af66 into master Dec 18, 2023
14 checks passed
@jfaltermeier jfaltermeier deleted the jf/12953_activation_event_warning branch December 18, 2023 07:41
@github-actions github-actions bot added this to the 1.45.0 milestone Dec 18, 2023
@jcortell68
Copy link
Contributor

Thanks, guys. @martin-fleck-at I wonder if the new-and-improved custom plugin API markdown file shouldn't mention this environment variable. Otherwise, app developers will have to debug the error message to find out about the env variable.

@martin-fleck-at
Copy link
Contributor

martin-fleck-at commented Dec 19, 2023

@jcortell68 That is a very good point! I'll open another PR to add some information on that.

It is here: #13190

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Theia can incorrectly generate "Unsupported activation event" error in stdout
3 participants