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

6601 load plugin manifest #8485

Merged
merged 1 commit into from
Sep 28, 2020

Conversation

tsmaeder
Copy link
Contributor

@tsmaeder tsmaeder commented Sep 9, 2020

What it does

Fixes "Frontend plugins are broken" #6601 by loading the package.json upon initializing the plugin.

Note: I haven't been able to make the electron case work, since I don't know how to compute the proper URI to load package.json. However, since I'm going to be on vacation, I wanted to propose this PR anyway...maybe someone can fix it.

How to test

Build a front end plugin (for example https://github.com/eclipse/che-theia-samples/tree/master/samples/hello-world-frontend-plugin) and add the resulting plugin to the theia plugins folder.
Start Theia and ensure that the "Hello World" command has been added via F1.

Review checklist

Reminder for reviewers

Copy link
Member

@paul-marechal paul-marechal left a comment

Choose a reason for hiding this comment

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

I get an error when running the vscode ext you suggested:

root ERROR Could not transfer 'package.nls.json' file from 'che__eclipse_che_hello_world_frontend_plugin' Error: ENOENT: no such file or directory, stat 'c:\Users\me\AppData\Local\Temp\theia-unpacked\eclipse_che_hello_world_frontend_plugin.theia\package.nls.json'

The ext is indeed missing a package.nls.json file. Is it a mandatory file?

readPluginJson(pluginModel, 'package.json'),
loadTranslations(pluginModel)
]);
// translate vscode builtins, as they are published with a prefix. See https://github.com/theia-ide/vscode-builtin-extensions/blob/master/src/republish.js#L50
Copy link
Member

Choose a reason for hiding this comment

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

The link is dead.

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 paste from the other "plugin-manifest-loader.ts". No Idea where that is coming from.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@akosyakov any idea what the correct link might be here?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we can't seem to find the proper uri I've removed the link.

Copy link
Contributor

Choose a reason for hiding this comment

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


function readContents(uri: string): Promise<string> {
return new Promise((resolve, reject) => {
const request = new XMLHttpRequest();
Copy link
Member

Choose a reason for hiding this comment

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

Any reason why using XHR instead of the newer fetch API?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If all you know is a hammer ;-) No, there's no reason.

Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer using fetch, but I'll leave it up to you since ultimately it works.

@benoitf
Copy link
Contributor

benoitf commented Sep 10, 2020

I think it's not handling the case where a file could be optional as package.nls.json may be missing

@tsmaeder
Copy link
Contributor Author

I get an error when running the vscode ext you suggested:

root ERROR Could not transfer 'package.nls.json' file from 'che__eclipse_che_hello_world_frontend_plugin' Error: ENOENT: no such file or directory, stat 'c:\Users\me\AppData\Local\Temp\theia-unpacked\eclipse_che_hello_world_frontend_plugin.theia\package.nls.json'

The ext is indeed missing a package.nls.json file. Is it a mandatory file?

No, the error should be handled up the call chain, though.

@tsmaeder
Copy link
Contributor Author

@marechal-p are you using electron? The description states that I have no idea how to compute the URI in this case:

Note: I haven't been able to make the electron case work, since I don't know how to compute the proper URI to load package.json.

If you have any suggestions, I'm all ears. Otherwise, since front-end plugins don't work at all, I think we should still merge the PR, it makes front-end plugins at least work in the browser case.

Copy link
Member

@paul-marechal paul-marechal left a comment

Choose a reason for hiding this comment

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

@tsmaeder I was convinced I had tried on the browser version, but you might be right. Tested again using browser and it works well. Electron does not.

LGTM.

@akosyakov akosyakov added plug-in system issues related to the plug-in system electron issues related to the electron target labels Sep 23, 2020
Signed-off-by: Thomas Mäder <tmader@redhat.com>
@vince-fugnitto
Copy link
Member

@tsmaeder you can restart the build if you like, sometimes we clear the Travis cache and it helps.

@tsmaeder
Copy link
Contributor Author

I tried restarting the build, but it had no effect. Where do I click?

@vince-fugnitto
Copy link
Member

vince-fugnitto commented Sep 25, 2020

I tried restarting the build, but it had no effect. Where do I click?

I'll try for you :)

image

@tsmaeder
Copy link
Contributor Author

I don't get the "rerun" buttons in the rightmost columns. Who do I need to bribe?

@vince-fugnitto
Copy link
Member

I tried restarting the build, but it had no effect. Where do I click?

I'm not sure :) @marcdumais-work maybe you know about how to give rights to maintainers for Travis?

@tsmaeder
Copy link
Contributor Author

Now some other test fails and one of the platforms being tested actually passes. This is frustrating!

@tsmaeder
Copy link
Contributor Author

Also, locally on Windows, I get another test failure (pre-hook for "move file" fails). Are the tests expected to be flaky?

@marcdumais-work
Copy link
Contributor

I don't get the "rerun" buttons in the rightmost columns. Who do I need to bribe?

You should normally be permitted to do this, since you have write-access to the repo. Can you access to the following? https://travis-ci.com/github/eclipse-theia/theia/settings

@vince-fugnitto
Copy link
Member

Now some other test fails and one of the platforms being tested actually passes. This is frustrating!

I rebuilt, it previously failed since open-vsx was down and we could not download builtins for the tests.

loadTranslations(pluginModel)
]);
// translate vscode builtins, as they are published with a prefix.
const built_prefix = '@theia/vscode-builtin-';
Copy link
Contributor

Choose a reason for hiding this comment

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

This is to support using vscode built-ins from npm I think? Do you still use these in Che?
We have a couple of fixes, to work-around problems with specific built-ins during vsix packaging - I do not think we do the same with the npm version.

There is also some extra massaging done to each built-in's package.json, e.g. to make NLS work

@marcdumais-work
Copy link
Contributor

Tested again using browser and it works well. Electron does not.

Is this the case that because of the nature of this extension (it's Che-related after all), it's expected not to work on the Electron version of a Theia app?

@paul-marechal
Copy link
Member

paul-marechal commented Sep 25, 2020

@marcdumais-work more like that in a perfect world frontend extensions should work in any Theia product, but it was broken for both browser and electron contexts. This PR only fixes the browser part (I tested on the example apps), and I don't know how to fix Electron either so hence why I am happy with the current changes.

@tsmaeder
Copy link
Contributor Author

I don't get the "rerun" buttons in the rightmost columns. Who do I need to bribe?

You should normally be permitted to do this, since you have write-access to the repo. Can you access to the following? https://travis-ci.com/github/eclipse-theia/theia/settings

No, I get "Your permissions are insufficient".

@tsmaeder tsmaeder merged commit af68b7c into eclipse-theia:master Sep 28, 2020
@marcdumais-work
Copy link
Contributor

"Your permissions are insufficient"

I am not sure what the problem might be - the only hits on Google search seem to be CI for repos that their crawler was enable to access, giving this same error.

One thing worth a try: On the following page, click on "sync account", on the upper left quadrant of the page:
https://travis-ci.com/account/repositories

Do you see the "eclipse-theia" organization listed, under the button?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
electron issues related to the electron target plug-in system issues related to the plug-in system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants