Skip to content

Conversation

@rschnekenbu
Copy link
Contributor

@rschnekenbu rschnekenbu commented Jul 30, 2025

What it does

Note: This PR is largely based on work done in the context of eclipsesource#96.

It tries to get away from using non-working npm based commands to debug vscode extensions from Theia (see https://github.com/eclipse-theia/theia-blueprint/issues/ 281 (remove the whitespace when doing the final PR))

How to test

  1. Create a packaged electron version either via electron-builder or by linking the packages into the theia-ide. I used the following contribution to be able to build Theia IDE based on a local version of theia: https://github.com/eclipse-theia/theia-ide/blob/jf/local-theia-build/local-theia-build.md.
    To get the local build running, I had to adapt docker file with an updated node version (22) and updated the entrypoint as it was still on yarn (https://github.com/eclipse-theia/theia-ide/blob/046f5a2c6fa5f51ebe33750cec51b97ee9b6714c/docker/local-theia-build/entrypoint#L44)
  2. Create a workspace with a vscode extension with the yeoman generator
  3. Open the workspace with the theia application
    You will need to slightly adapt the launch.json, due to other bugs. Comment out the preLaunchTask line
  4. Run the Run extension debug config.
    This is the part where it fails. A second window opens, but as the initial tool does not detect the start of the second app (looking for 'Theia app listening' pattern in logs), the debug session fails.

Follow-ups

I did not fully rework on the filtering mechanism as commented by Thomas on eclipsesource#96. The filtering is a kind of mess between args or undefined being returned instead of true/false for example.

Breaking changes

  • This PR introduces breaking changes and requires careful review. If yes, the breaking changes section in the changelog has been updated.

Attribution

Review checklist

Reminder for reviewers

remove usage from npm and try reuse current executable to trigger a second instance of theia based application.
@github-project-automation github-project-automation bot moved this to Waiting on reviewers in PR Backlog Jul 30, 2025
@rschnekenbu rschnekenbu requested a review from tsmaeder July 30, 2025 09:07
// according to process.argv documentation, the first argument is the path to the node executable
// and the second argument is the path to the script being executed
// second argument will be treated as the workspace location, so it should be ignored
if (index === 1 || arg.startsWith('--port') || args[index - 1] === '--port') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filter() expects a boolean return, unlike map()

@rschnekenbu
Copy link
Contributor Author

Quick update on this task:

  • Thanks to an adapted version of https://github.com/eclipse-theia/theia-ide/blob/jf/local-theia-build/local-theia-build.md, it is possible to build quite easily (takes time however!) a version of theia IDE with a local version of Theia. Changes consist of updating this line and the following line https://github.com/eclipse-theia/theia-ide/blob/046f5a2c6fa5f51ebe33750cec51b97ee9b6714c/docker/local-theia-build/entrypoint#L44 with the npm equivalent commands since Theia now builds with npm (yarn => npm & yarn build => npm run build)
  • The run extension task consist of compiling the extension with a pre-build task, and then the tool tries to trigger a new instance of theia with the HOSTED_PLUGIN to be tested. The debugging application listens to the line "Theia app listening" on the output of the debugged instance to know it is started and should connect the debugger.
  • Currently, I could not get the debugged instance to trigger a new backend and a new frontend, but only a new frontend. Thus the output never receives "Theia app listening[...]" output and as such, never connects the debbuger. Also, the hosted plugin is not present in the list of installed plugins.

According to the documentation, we should be able to spawn a new backend if we provide a new electron user data area, but this is not sufficient. I tried also providing a theia config dir using some environment variables on the new spawned process, with no success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting on reviewers

Development

Successfully merging this pull request may close these issues.

3 participants