-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Need ability to add custom plugin API namespace that's directly connected to a backend implementation #12946
Comments
@jcortell68 Please correct me if I'm paraphrasing this issue incorrectly, but you're asking for a way to extend the Theia back-end at install/run time, as opposed to the compile-time extensibility we have now, correct? |
A way to extend and/or utilize the backend of a Theia app via something that can be deployed and installed at runtime, same as how Theia supports VSIX files. We're not asking for any specific backend-to-backend API from Theia, though. We want to use this new capability to utilize/extend product specific backend services. I.e., I as a Theia product developer will develop a Theia extension that contributes the backend-to-backend API namespaces. Whether Theia the platform at some point wants to add any backend-to-backend API, that's up to you guys.
And that would be perfectly fine :-)
Yep. Basically, if you want any plugin API in your product, you get the Theia API in the mix. I.e., if I wanted to build a Theia product that supports only product-specific plugins that have access only to product-specific API, that's not possible today. The plugin mechanism and the vscode/theia extension API are bundled into the same Theia extension (@theia/plugin-ext). So indeed, if you end up using the same infrastructure to support backend-to-backend plugins, then that would have to be broken up.
That's what I was hoping for. That we could use the same programming model for adding backend-to-backed API namespaces. I.e., that this guidance would equally apply for backend-to-backend API, at least mostly. As for having a dedicated plugin host process for all this, there I wonder if we couldn't avoid that and save apps the added runtime overhead of another Node.js process (apps that make use of this new capability, that is). At least theoretically, a single Node.js process should be able to communicate with both the browser and with Theia's backend Node.js via RPC. It's doing the former today; we just need it to do the latter as well. Naturally, we'd need separate lifecycles hooks for each. |
Closed with #13138 |
Feature Description:
The following documentation describes how a Theia extension can extend the plugin API with new API namespaces.
https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/doc/how-to-add-new-plugin-namespace.md
And it works great. But...it's limited in that the new API can't be directly supported by the Theia extensions' backend. The API connects the plugin running in the plugin host node process to the Theia extension's frontend. And if the API ultimately is about driving logic in the frontend, then that works out perfectly. BTW, this configuration is the only one shown in the diagram here.
But imagine the Theia extension having a backend service that it wants to expose to plugins. It should be able to define an API namespace that connects the plugin code to the backend service in the Theia extension. Today, you can't make that direct connection. You would have to go through an intermediary in the frontend. That is inefficient on multiple fronts.
Basically, a Theia extension's backend should be able to bind a
MainPluginApiProvider
and have it work in the same way it does when the frontend binds that. ButMainPluginApiProvider
is only injected by Theia frontend code (in@theia/plugin-ext
).Here is an example of a Theia app that contributes a working API namespace wired to the frontend, but then fails to contribute API namespace from the backend. See commit message and comments in the code. In particular, look at the diff between the head commit and the previous one.
What are you looking for? Notice the following doesn't show up in stdout when you launch the app.
That absence proves that the Theia extension has no chance of contributing an API namespace implemented in its backend. You can see that the normal (wired to frontend) API namespace works fine by invoking the
Hello World
command that the extension contributes. The message string you see was obtained by exercising the custom plugin API.The text was updated successfully, but these errors were encountered: