Hi All,
I would like to contribute and work on plugin-system of theia.
But I'm unable to make the debug setup for the same.
I have followed these setups to debug the ~/theia/packages/plugin-ext/src/plugin/languages/hover.ts file-
1) Build Theia on VSCode.
2) From Debug "Launch Backend" Configuration.
3) From Debug "Launch Frontend" Configuration.
4) Create a plugin in the launched instance (hello world using the guide from https://www.theia-ide.org/doc/authoring_plugins ) and updated it to use the below code-
import * as theia from '@theia/plugin';
export function start() {
theia.languages.registerHoverProvider({scheme: 'file'}, {
provideHover(doc: theia.TextDocument, position: theia.Position) {
const range = doc.getWordRangeAtPosition(position);
const text = doc.getText(range);
return new theia.Hover(text);
}
});
}
export function stop() {
}
so that hover.ts source code is called.
5) Run command "Hosted mode: start instance"
After this step i get the below error-
yarn run v1.7.0
$ /home/kvbhat/git/IDE/theia/node_modules/.bin/theia start --port=3030
module.js:549
throw err;
^
Error: Cannot find module '/home/kvbhat/git/IDE/theia/src-gen/backend/main.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
Done in 0.47s.
Could someone please guide me on how to debug the plugin-system that are being develop for theia?
Update:
If i launch backend via command line and just launch fronted i dont get the above error but then breakpoints in hover.ts are not getting hit even though the hover plugin is activated and called.
Thanks
i tried the "hosted plugin: debug instance" command, which asks me for the path of the plugin (in my local environment it is theia/plugins/the-plugin-to-debug). And, the command populates a dialog that helps me to open another instance of theia.
however, my break points are not hit either. I tried dropping break point in both theia instances (i.e., the one running on port 3000, and the one on 3030), and neither worked. Could you @benoitf please point us to the wiki that explains how debugging
Thank you !
@elaihau you're using master branch and examples/browser or a different config ?
yes i am on the master branch, using examples/browser
@elaihau I made this quick video https://www.youtube.com/watch?v=Kjwovxq38Ms&feature=youtu.be
was trying against a Theia plug-in.
Thank you @benoitf !
Following your video I made a GIF to show how to debug a vscode extension as a theia plugin.

You can create a node debug launch configuration: https://github.com/theia-ide/theia/issues/4224#issuecomment-459752557
In order to debug just press F5:

Example of debug configuration:
{
"name": "Launch VS Code extension",
"type": "node",
"request": "launch",
"port": 9339,
"timeout": 100000,
"args": [
"${workspaceFolder}/examples/browser/src-gen/backend/main.js",
"${workspaceFolder}",
"--port=3030",
"--hosted-plugin-inspect=9339",
"--plugins=local-dir:${workspaceFolder}/plugins"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/**/*.js"
],
"internalConsoleOptions": "openOnSessionStart",
"outputCapture": "std"
}
Most helpful comment
You can create a node debug launch configuration: https://github.com/theia-ide/theia/issues/4224#issuecomment-459752557
In order to debug just press

F5:Example of debug configuration: