The simplest way to start developing a new debugger is to generate a sample and understand how it works. Integrating a new debugger into Eclipse Che is very similar to how it is done in VS Code. So, let’s install the latest Theia plugin yeoman generator which will generate a simple debugger plugin for Che Theia.
npm install -g yo @theia/generator-plugin
Generate a sample by running:
When prompted confirm choices for “Backend plug-in”, “Samples” and then “Debugger sample”:
It will create a project and a ready-to-use plugin which can be deployed in Che Theia. This is a mock debugger with a single configuration which allows debugging arbitrary text files. The purpose of this sample is to understand how things work. Let’s deploy and try it.
Build the plugin by running yarn in the root of the project and copy the resulted file ending with
.theia into plugins folder of
Che Theia. After that, start Theia. In the
Debug menu, select
Open Configurations. and in the
launch.json file, add debug configuration for
Theia Mock Debug:
Open any text file in the editor, switch to
Debug View, and start the debugger using
Debug a text file configuration. Now it is possible to debug a text file line by line:
Let’s briefly go through the generated project structure.
package.json contains a section with a debugger contribution to Che Theia. This is a place to add a new debugger. More details and explanation about available attributes read here contributes.debuggers and here anatomy of package.json:
"label": "Theia Mock Debug",
backend.ts file is plugin’s entrypoint. Implementation of plugin
stop methods are here.
theia-mock-debug-configuration-provider.ts is a basic implementation of a configuration provider. See details configuration provider.
That’s basically it. To deeply understand Visual Studio Code’s debugging architecture read VS Code debugger extension documentation.
Join the community: