Jonas Helming, Maximilian Koegel and Philip Langer co-lead EclipseSource, specializing in consulting and engineering innovative, customized tools and IDEs, with a strong …
How to add extensions and plugins to Eclipse Theia
October 17, 2019 | 3 min ReadEclipse Theia 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, a quick introduction of Theia and learn more about frequently asked questions about Theia.
In Eclipse Theia, there are two ways of adding new functionality, which we describe in the following sections:
- Adding Theia extensions to Eclipse Theia
- Adding plugins / VS Code extensions to Eclipse Theia
How to add Theia 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 / VS Code extensions 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.
Conclusion
Eclipse Theia is extensible in several ways, using extension or plugins / VS Code extensions, 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.
If you want to build such an extensible product based on Eclipse Theia; 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, 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.