Theia plugin vs. vs-code extensionMarch 3, 2019 at 7:31am
Hello, I would like to understand the plugin approach. I read that Theia aims to cover all API needed to simply run all vs-code extensions (here: https://email@example.com/theia-to-support-vs-code-extensions-a7b9100ec836).
At the same time, Theia offers its own plugin mechanism, and if I got it right, a Theia plugin would not run in VSCode (as is).
My question is, which of the following describes the ambition:
- Theia plugin API >= VSCode extension API
- in this case, one is better off write vscode ext as long as it has all it needs, and in the case something is only in Theia API - write a Theia API
- It is ok to pull request new plugin API even if they are not part of VSCode
- Theia plugin API == VSCode extension API
- in this case I don't understand why at all have own Theia plugin model, simply use VSCode's
- Theia plugin API != VSCode extension API
- Some VSCode extensions would work in Theia but some not
IMHO, I would hope for (1). The reason Theia may add API is the different use case - web-based/cloud-based, white labeled etc.
March 3, 2019 at 4:18pm
This is a bit of history. There are 2 different ways to extend Theia. There are Theia extensions and there is Theia plugins. Theia extensions is the original way to extend Theia. They are build-time extensions but they give you access to everything. You are not really limited with the exposed plugin APIs.
When we decided to adopt Theia for Che we looked at this extension mechanism and did not find it serve well for our purposes. We did not want to have a build time on our workspace startups and we did not want an extension to be able to slow an IDE to halt. So we came up with the Theia plug-ins, which are runtime-extensions and they are isolated. While developing the APIs for plugins since they were very much like vscode extensions, we decided to not reinvent and use vscode compatible APIs. As a consequence vscode extensions are usually compatible with theia plugins.
The desire is to keep the compatibility of Theia plugins and vscode extensions but theia extensions will always be a different story.
It is clear to me why Theia extensions is a different story, and why the runtime exensibility, in the form of plugin is required. My question, do we really need Theia plugin model, or vscode ext is enough?
It make sense to have both, if we find use cases fit for Theia plugin that are not needed and won't be ever added to vscode...
March 4, 2019 at 9:10am
Maybe eventually there could be a way to shim Theia to VS Code APIs in order to run Theia plugins in VS Code. A challenge will be to figure out how to separate valid API usages in the same package.
In the ideal world theia and vscode APIs could be used in the same package next to each other and don't have overlap. Extension developers could organize package code in 2 parts:
- one can use only VS Code API and loaded in VS Code and Theia
- another can use VS Code and Theia APIs and loaded only in Theia.
Right now, it is not a case.