The Che-Theia plug-in API consists of two namespaces:
| Namespace | Description |
|---|---|
|
Provides a Che-Theia IDE-related API that allows to interact with its different components |
|
Provides a plug-in API to access parts of the Che API |
theia namespace
The available resources of the theia namespace are described in the theia.d.ts file in the Theia repository. The root of the namespace contains types declaration and the following API sections:
commands |
API for adding new and executing existing Theia commands |
debug |
API for debugger configuration and debugger events |
env |
API for accessing environment variables and query parameters of the Theia IDE |
languages |
API and events related to language support; typically is used by language servers |
languageServer (experimental) |
API for language-server integration |
plugins |
API for retrieving information about loaded plug-ins |
tasks |
API for providing custom task runners |
window |
API to control visual components of the IDE. It allows to manipulate the editor tabs, terminals, status bar, etc. The section contains events for changing the state of selected components and the whole IDE. Dialog popups. |
workspace |
API related to the Theia workspace with information about the current workspace state, documents in it, file-related operations including watching, finding, etc. The section contains state-change events. |
che namespace
| Many APIs in the namespace are experimental and can change in the future. |
Available resources of the che namespace are described in the che.d.ts file in the Che-Theia repository.
This namespace contains APIs and types related to Che. Some sections are a bridge to Che API. The following is a list of the sections:
factory |
Allows to work with the Che factory API; provides functionality to retrieve specified factory configuration |
task |
Allows to add Che-aware commands (Che-specific attributes, such as workspace ID or container name, are accessible from within task implementation) |
variables |
Allows to add a variable resolver |
workspace |
Allows to work with the Che workspace API; provides functionality to access workspaces, their lifecycle, and user settings. |
Using the che namespace in plug-ins
- Backend plug-in
-
-
Add the
@eclipse-che/plugindependency to a plug-inpackage.jsonfile. -
Import and use the namespace. For example:
import * as che from '@eclipse-che/plugin'; const wsConfig = che.workspace.getById(workspaceId);
-
- Frontend plug-in
-
-
Perform the same steps as for a backend plug-in.
-
Modify the
externalssection inwebpack.config.jsby adding the@eclipse-che/pluginkey with the following value:che.<your_plugin_id>(copy the@theia/pluginvalue, and substitutetheia.forche.). For example:externals: { "@theia/plugin": "theia.theia_test_api", "@eclipse-che/plugin": "che.theia_test_api" }
-
| It is possible to add a new API namespace for plug-ins using a separate extension. |