Che-Theia plug-in API

The Che-Theia plug-in API consists of two namespaces:

Namespace Description

theia

Provides a Che-Theia IDE-related API that allows to interact with its different components

che

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 Che-Theia commands

debug

API for debugger configuration and debugger events

env

API for accessing environment variables and query parameters of the Che-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 Che-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
  1. Add the @eclipse-che/plugin dependency to a plug-in package.json file.

  2. Import and use the namespace. For example:

    import * as che from '@eclipse-che/plugin';
    
    const wsConfig = che.workspace.getById(workspaceID);
Frontend plug-in
  1. Perform the same steps as for a back-end plug-in.

  2. Modify the externals section in webpack.config.js by adding the @eclipse-che/plugin key with the following value: che.<your_plugin_ID> (copy the @theia/plugin value, and substitute theia. for che.). 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.