Eclipse Theia extensions vs. plugins vs. Che-Theia plugins

Eclipse Theia extensions vs. plugins vs. Che-Theia plugins

In this article, we compare Eclipse Theia plugins with Theia extensions and highlight the differences. In case  you are wondering what Eclipse Theia is, please head over to our introduction to Theia and have a look at the frequently asked questions about Eclipse Theia. Eclipse Theia is an extensible framework for building tools and IDEs. It can be extended by custom features. This can be done by adding existing or custom Theia extensions, Theia plugins or even VS Code plugins. That obviously leads us to the first interesting question, which we will cover in this article:

What is the difference between an Eclipse Theia plugin and an extension?

Let us start with Eclipse Theia extensions, as they have been there first. Theia has been designed in a very modular and extensible way, this has always been a core design principle. The first mechanism available for that was the “extension”. As a matter of fact, everything in Theia, including the base parts such as the Monaco editor, the basic frame or the “Explorer View” are extensions. Therefore, extensions are first-class citizens in Eclipse Theia. If you create a custom Theia extension, you can do and access everything that the existing core extensions can do. Therefore, the extension mechanism of Theia is both very powerful and flexible. For the communication and “glue” between extensions, Eclipse Theia uses dependency injection (see here for details on dependency injection with inversify in Theia).

Eclipse Theia extension architecture

So, if your use case is to build a custom product based on Theia, reusing some of the existing extensions and adding some custom extensions are a pretty perfect way to do so. Please see this article on how to add extensions and plugins to Eclipse Theia and here for more details about Theia extensions.

Eclipse Theia plugins have been introduced at a later time as an alternative to Theia extensions. That leads us to the next question:

What is the advantage of an Eclipse Theia plugin compared to an extension?

Around the time when Red Hat adopted Eclipse Theia as the new default IDE for Eclipse Che, two shortcomings were identified with the this existing extension approach:

  1. Extensions are not suited  to be installed/added at runtime, they are meant to be added at build time.
  2. Extensions are not “isolated,” neither from an API point of view nor are they running in a separate process. While this makes Theia extensions very powerful, you can easily “harm” or slow down the full product from within an extension.

If you are a tool provider and you develop a full custom solution based on Theia to your clients, you might not be affected by those two issues, especially if you do not want to allow anybody else to extend your solution. Please note that even the “extend at runtime” issue is a different story in the web compared to the desktop. Adding a new feature via extensions to your own custom product can be done in a centrally managed way and transparent to users as you control the deployment.

This all changes in a scenario, where you provide a more generic product based on Theia, and want to allow a community of developers to add features to it based on their individual needs. In this scenario, you also want to allow individual users of the tool to install those new features as plugins into their instance of your tool. If there is a marketplace of plugins available that you do not have full control over, the two issues described above become important. In such a scenario, you indeed want to allow users to install plugins at runtime and you need to ensure that those plugins do not affect the stability of your base tool. In a nutshell, the second scenario is much like the VS Code ecosystem or like the Eclipse desktop IDE. This is exactly what plugins achieve compared to extensions. Please see this article on how to install/add Eclipse Theia plugins.

Plugins are enabled in Eclipse Theia by a specific extension (remember, everything in Theia in an extension). This “Plugin Extension” provides an API to be used by plugins. This API is “restricted”, meaning it only provides selected features. Furthermore, it is “decoupled”, so plugins can run in there own process or even container.

Eclipse Theia plugin architecture

Please note that extensions were originally also designed to allow for extensibility at runtime, and there used to be an “extension manager” in Eclipse Theia, a UI to manage extensions at runtime. However, this approach has been deprecated in favor of plugins.

So now that we have described the difference between an Eclipse Theia extension and a plugin, that leads to us to another follow-up question.

What is the relationship between an Eclipse Theia plugin and VS Code?

This one is pretty simple. When it was decided to design another mechanism to extend Eclipse Theia (the plugin mechanism), the definition of a corresponding API was part of this task. By that time, VS Code had already defined such an API, which (1) fulfilled the two original goals and (2) covered the expected functionality. Following the “do not reinvent the wheel” paradigm, which is luckily very common in Theia, the VS Code plugin API was adopted for Eclipse Theia. This provides two additional advantages: (1) If you know the VS Code plugin API, you can easily transfer this knowledge to Eclipse Theia plugins and (2) VS Code plugins can potentially also be used in Eclipse Theia. “Potentially” means that currently “Eclipse Theia plugin API < VS Code plugin API”, but Theia is catching up. For details check the comparison of the VS Code API and the Eclipse Theia API and the documentation on the Eclipse Theia plugin API.

The best way to find out whether a VS Code plugin works in Theia is actually to try it out, see this article for details. Finally you might be interested in a comparison between Eclipse Theia and VS Code.

With that, there is one final open question. Eclipse Theia is often used in combination with Eclipse Che (see here for the relationship between Eclipse Theia and Che). In Eclipse Che, there is also a concept often referred to as plugins, sometimes they are called “Che-Theia Plugins”.

What is the relationship between an Eclipse Theia plugin and a Che-Theia plugin?

Eclipse Che is a workspace server to host web-based development environments for multiple users. See this article for a description of the relationship between Eclipse Che and Eclipse Theia. Eclipse Theia is the default IDE to be used in Eclipse Che. Che calls this an “editor”. Therefore, you can extend the Che IDE (which is Theia) using extensions and plugins. Eclipse Che adds some nice features on top of the Eclipse Theia plugin mechanism. A Che-Theia plugin is a Theia plugin wrapped into a container. Those containers can potentially contain more than just a Theia plugin, so they are a more generic mechanism to extend the development environment and other Che parts. Additionally, Che provides a plugin registry for plugins so that they can be installed by the end user using a nice UI (see screenshot below)

Che-Theia plugin selection

In a nutshell, Che-Theia plugins are typically regular Theia plugins wrapped in a container, but also allow other customizations too. In addition, they provide a container and deployment solution. Please see the documentation on more information on Che-Theia plugins.

Conclusion and more

In this article, we have compared Eclipse Theia extensions to Eclipse Theia plugins. In a nutshell, extensions are more powerful and targeted at “build time extensibility”, while plugins are isolated, targeted at “runtime extensibility” and they are compatible with the VS Code plugin API. Thereby, you can even reuse some VS Code plugins without any adaptations in Theia.

Both mechanisms to extend Theia have their use cases, they even combine well. In this scenario, you would define your base product as a set of extensions and then potentially allow users to add more features at runtime via plugins. In both cases, you should always try to design your code as independant and modular as possible. The extension or plugin mechanism only wires your features into Theia, so ideally most of the effort is spent on code which is independent of both the extension and the plugin mechanism.

If you are looking for support in designing an Eclipse Theia extension or plugin, or need help to figure out, which mechanism is better suited  to your project or if you need general support and advice on implementing a tool, extension or plugin based on Eclipse Theia, have a look at our service and support offering for Eclipse Theia, for web-based tools or tools in general and please get in contact with us!

Finally, if you are interested in future parts of this series, e.g. how to extend Eclipse Theia and how to customize it, please follow us on Twitter, we will publish the next parts of this article series soon.