Theia to Support VS Code Extensions

I hope you had a relaxing holiday season and recharged for an exciting new year. What better way to start the year than writing about plans and perspectives?

In this post I want to talk about one of the most important new features coming in Eclipse Theia in 2019: Support for VS Code extensions. But first let’s have a brief look at the status quo.

Theia Adoption

The Theia community is growing and adoption is coming along nicely. Just yesterday, Google announced the use of Theia in their Google Cloud Platform. This is particularly nice as we are using GCP to run Gitpod.io, so we can now use Theia to do the sysadmin thing on our cloud infrastructure, too.

Another important milestone for Theia is when later this year Eclipse Che will release Version 7. For Che this is a huge step, as it now finally separates the IDE part from the workspace server. It is going to ship with Theia as its default IDE but allows to host others as well. Also, IBM has recently announced their new cloud IDE for Cobol which too is based on Theia. Still waiting for what ARM has up their sleeves, as they have been contributing for almost a year now.

The TypeFox team helps several clients, building awesome developer products based on Theia. And, obviously, we are super thrilled about Gitpod, our frictionless hosting solution for Theia. We are close to leaving the beta phase, making the on-premise version available and releasing an exciting new feature, that will eliminate build-times.

What’s Next?

I am not the only one thinking that VS Code is the best editor / IDE available today. I love its speed, its keyboard focus and simplicity. The only three reasons TypeFox and Ericsson started the Theia project two years ago were these goals, not covered by VS Code:

  • Theia runs in browsers / cloud settings
  • Theia is hosted under vendor-neutral open-source organisation (Eclipse Foundation)
  • Theia allows for creating white labeled products (more extendable)

To support the last item we developed an extension system at the core of the Theia IDE, which is not sandboxed like the VS Code one. A Theia extension can contribute (and override!) any functionality and even the core part is developed as such an extension. This flexibility allows for tailoring an IDE to your needs without the need to fork any code repositories.

We use this mechanism to build rich engineering tools, including diagraming (using sprotty) and other ways of viewing and editing code and data.

Supporting VS Code Extensions

On the contrary, VS Code’s extension system uses a sandbox-model, where extensions run in their own process and communicate with the main IDE through an IPC protocol. As an extension developer you have no access to any browser APIs nor can you call anything that is not part of the official ‘vscode’ namespace. While this approach is very limiting in terms of what you can do it also makes sure that malfunctioning extensions don’t break the user experience (too much). Also, the dependency graph between extensions is much less complex, as most functionality is provided through the main extension API. This means fewer issues with incompatible versions etc. which makes it easier to install and update extensions without breaking the whole application.

Long story short, this model definitely has its advantages. More importantly, the flourishing VS Code extension community with currently over 9000 available extensions, makes adopting it very attractive.

VS Code marketplace with over 9000 extensions

That said, it is not an easy undertaking as the API surface is huge. The Red Hat team started working on it almost one year ago already. Finally, we can see first VS Code extensions starting to working. For instance, this Pull Request lets Theia run VS Code’s node debugger extension directly.

Merging with the VS Code community

Supporting VS Code extensions directly will also free the Theia community from having to maintain their own extensions when there is an extension for VS Code available already. Instead of maintaining Theia-specific extensions we can contribute to the VS Code extensions and help make them better for both Theia and VS Code.

Supporting the VS Code extension API forces Theia to become even more like VS Code. A lot of assumptions are made on how the various features work and the extension developers rely on these assumptions so we need to to align them. But as I said we all like VS Code a lot and did the alignment anyway from the get go, so this is not a huge change.

When is it ready?

So far the Red Hat team has done most of the ground work and it already looks pretty good. TypeFox will now dive in and help finishing this exciting new capability. The idea is to pick one VS Code extension after the other, run it in Theia and fix any rough edges. I am optimistic to reach the “80% works”-threshold quite soon and then further harden and polish towards a 100% coverage in Q2.

Summary

Theia will maintain its flexibility and control for white labeled products through its original extension architecture. The additional VS Code extension support enables an alternative, less invasive and yet more robust extension mechanism on top of that.

If the things you want to build are covered by the VS Code extension API you should use it and support VS Code and Theia at once. If you want to build complex UI-contributions or a developer focused product, the Theia extension system is the way to go.