Skip to content

Commit

Permalink
Added detailled description about extenssion types
Browse files Browse the repository at this point in the history
fixed #158

Contributed on behalf of STMicroelectronics

Signed-off-by: Jonas Helming <jhelming@eclipsesource.com>
  • Loading branch information
JonasHelming authored Aug 2, 2021
1 parent 2fe8b50 commit 689ac74
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
31 changes: 21 additions & 10 deletions src/docs/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,27 @@
title: Extensions
---

# Extensions
# Extensions and plugins

Theia is composed of extensions. An extension is an npm package that exposes
any number of DI modules (`ContainerModule`) that contribute to the creation of
the DI container.
Eclipse Theia is designed in a very modular and extensible way. It supports three ways of being extended/adapted to your specific requirements. These are complementary and are targeted at different use cases. You can pick the best option and even mix them within the same project.
In the following, we will give you a quick overview of the available extension mechanisms and provide more details in the sections below.

An extension is consumed by adding a dependency to the
npm-package in the `package.json` of the application.
Extensions can be installed/uninstalled at
runtime, which will trigger a recompilation and restart.
- **VS Code extensions**: Simple to write, installable at runtime, compatible with VS Code, limited to the VS Code extension API, some use cases not possible due to API restrictions => Used for adding features to existing tools. Note that you can also use existing VS Code extensions within Theia, too.
- **Theia extensions**: Install at compile time, full access to internals of Theia via dependency injection, almost no limitations in terms of accessible API => used to build custom products and for features not covered by the VS Code extension API. Note that the Theia project (including the core) is fully built using Theia extensions in a modular way.
- **Theia plugins**: Like VS Code extensions, additional access to some Theia specific APIs and the Frontend (frontend plugins), Theia specific parts are not compatible with VS Code.
The following diagram shows the high level architecture for all three options. VS Code extensions and Theia plugins run in a dedicated process, can be installed at runtime and work against a defined API. Theia extensions are added during compile time and become a first class citizen within your Theia application. They can access the full API of Theia.

Through a DI module, the extension can provide bindings from types to concrete
implementations, i.e. provide services and contributions.
<img src="/extensiontypes.png" alt="Theia Logo Blue" style="max-width: 525px">

If you would like more guidance on which mechanism to use, please also refer to this (detailed comparison of Theia extensions vs. VS Code extension)[https://eclipsesource.com/blogs/2021/03/24/vs-code-extensions-vs-theia-extensions/].

##Theia extensions
A Theia extension is a module that resides inside a Theia application and communicates with other modules (Theia extensions) via dependency injection. The Theia project itself is composed of Theia extensions too. To create a Theia application, you can select a number of Theia extensions provided by the Theia project, add your own custom Theia extensions and then compile and run the result. Your custom Theia extension will have the same level of access as the core ones. This modularity allows you to extend, adapt or remove almost anything in Theia according to your requirements. Also specific use cases, such as complex views are easier to develop with Theia extensions compared to VS Code extensions.
Technically, an extension is an npm package that exposes any number of DI modules (`ContainerModule`) that contribute to the creation of the DI container.
An extension is consumed by adding a dependency to the npm-package in the `package.json` of the application. Extensions are meant to be installed at compile time
See this section for more detail on how to author a Theia extension.
##VS Code extensions
VS Code extensions are the popular mechanism to extend VS Code with new language support and other features. VS Code extensions are simple to develop, they have access to a defined and restricted API and VS Code extensions can be installed at runtime. Eclipse Theia provides the same extension API as VS Code, so extensions are compatible. Therefore, to develop your own extension, please refer to the (VS Code extension documentation)[https://code.visualstudio.com/api]. Please also refer to this coverage report, highlighting which API of VS Code is covered by Theia.
Please also note that you can use existing VS Code extensions in Theia, too. A good source for installing or downloading extensions is the (Open VSX registry)[https://open-vsx.org/].
##Theia plugins
Theia plugins are a special type of VS Code extensions that only run in Eclipse Theia. They share the architecture and other attributes of VS Code extensions, but they also have access to additional API that is only available in Theia, not in VS Code. Most noticeable, Theia plugins can also directly contribute to the frontend while VS Code extensions are restricted to the backend. As a consequence Theia plugins can directly manipulate the UI without going through a webview abstraction, easing the development process. Please see [this section](https://theia-ide.org/docs/authoring_plugins/) for more details about Theia plugins.
2 changes: 1 addition & 1 deletion src/docs/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const MENU = [
'architecture'
),
M(
'Extensions',
'Extensions and Plugins',
'extensions'
),
M(
Expand Down
Binary file added static/extensiontypes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 689ac74

Please sign in to comment.