How to add extensions and plugins to Eclipse Theia

How to add extensions and plugins to Eclipse Theia

The Eclipse Theia IDE is an extensible platform to build web-based tools and IDEs. In this article, we focus on how to add new features to Theia by adding extensions and/or plugins. Please see this article for a comparison of Eclipse Theia extensions and Theia plugins and here for a quick introduction of Theia and here about frequently asked questions about Theia

In Eclipse Theia, there are four ways of adding new functionality, which we describe in the following sections:

  • Adding extensions to Eclipse Theia
  • Adding plugins to Eclipse Theia
  • Adding plugins to Eclipse Theia using Che

How to add an extension to Eclipse Theia

This is actually very simple. As Eclipse Theia is essentially a node application, adding an extension to Theia just means  adding another dependency to the package.json of your Theia instance. Please see the article on How to launch Eclipse Theia from your own custom package.json for more details.

There are two sources  you can get new extensions from, either you add an extension which is published in the node package registry, or — if you are developing a Theia extension yourself — you can add it locally. The following example package.json adds two extensions to a Theia product, one being the existing outline view extension, published in the node package registry, the second one being a custom extension, that you have created locally (“myExtension”).

{
  "private": true,
  "dependencies": {
    "typescript": "latest",
    "...": "...",
    "...": "...",
    "@theia/outline-view@theia/java": "next".
    "myExtension": "myVersion"
  },
  "devDependencies": {
    "@theia/cli": "next"
  }
}

After rebuilding your Theia instance you will have those extensions available, e.g. with the outline view in the example above, you can now use the view to browse Java source files:

Please see here for a list of Theia extensions, which are currently published in the node package registry.

How to add plugins to Eclipse Theia

Please note that in the previous section we described how to add extensions to Theia, the remaining sections are about plugins. Please see this article on a comparison between Eclipse Theia plugins and extensions to get a more detailed picture on the differences between extensions and plugins.

Please note, that Theia Plugins are compatible with „VS Code Extensions“, we describe this in more detail in this article on how to use VS Code extensions in Eclipse Theia. Therefore, the documentation referenced in the following is about VS Code extensions, but also applies to Theia Plugins.

One of the differences is that, in contrast to extensions, plugins can be added at runtime. Please see here on how to install Theia Plugins at runtime.

If you want to make Theia Plugins a „built-in“ part of your application, please see this documentation.

How to add plugins to Eclipse Theia using Che

Eclipse Che is a workspace server and uses Theia as default IDE. Please see our article on the relationship between Eclipse Che and Theia for more details. Che adds some nice features on top of standard Theia, e.g. a plugin registry, from where users can install plugins. So when using Theia in Eclipse Che, you can open the following view called “Plugins” in your workspace configuration, select from a list of available plugins and even specify the version to be used. Please note that Eclipse Che plugins can contain more than just a Theia plugin, they can also extend the runtime and Che itself (as described in more detail in this article). Please note that quite a few of the  plugins provided in Che rely on VS Code plugins. As mentioned before, we will describe this capability more in detail in a follow up article.

Adding a Che-Theia plugin to Eclipse Che

Conclusion

Eclipse Theia is extensible in several ways,- using extension or plugins, at build time, at start-up or even at runtime. This covers various use cases – as a provider of a tool, you can add default features using extensions or by adding default plugins on start-up. As a user, you can add your favorite features by installing plugins as you like. Therefore, even if the two extension models might be a little confusing when getting started with Theia, their existence provides a lot of flexibility. As you can see with Che, which adopts Theia, you can even provide your own extension mechanism on top of Theia, make it simpler or more focused and therefore target your specific user group.

If you want to build such an extensible product based on Eclipse Theia or Che; or provide your own custom extension or plugin; miss a feature, or need general support and advice on Eclipse Theia, have a look at our support and consulting offering for Eclipse Theia and for Eclipse Che, our service offering for web-based tools or tools in general and please get in contact with us!

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