Logpoint in Theia backend breaks/suspends execution unexpectedly (VS Code)


I am quite new to both JavaScript/TypeScript development and Theia development. I wanted to start experimenting with Eclipse Theia, and after getting a dev environment set up, I have modified the hello-world extension by implementing a backend service to retrieve the „Hello World“ string.

Now, I wanted to put a logpoint in my backend service to see on the console when it is called. But sadly, when the execution reaches the respective line, execution is suspended. Only after resuming execution, the expected log message is printed.

This is my setup:

I have created https://github.com/xpomul/theia-boilerplate and there, a branch named hello-world .

I use VS Code 1.63.2 and the Remote Containers Extension.

Here’s what I do:

  • Start VS Code
  • Use "Remote-Containers: Clone Repository in Container Volume…“ and clone the xpomul/theia-boilerplate repository branch hello-world
  • After some waiting to get everything installed, open hello-world-impl.ts and add a logpoint with the expression test in line 7 (so it has a diamond symbol)
  • Do to the Run/Debug view and select the Launch Backend launch configuration and start it
  • Open a browser at localhost, port 3000 and run Edit > Say Hello

I’d expect that the backend continues running and just prints test to the log.

Instead, it breaks/suspends execution at the line of the logpoint and I need to explicitly resume.

What am I doing wrong? Is it some configuration issue? Or is the logpoint functionality dependent on the node version and is just not yet supported with Theia’s node 12 version?

(see also my question on SO: https://stackoverflow.com/q/70938984/2239897)


@xpomul thank you for the discussion, I’m not sure I got everything but it seems correct to me that you would hit a breakpoint in the backend?

If you follow what the code is doing it will use this.helloWorldService.getHelloString() (which is implemented in the backend) to get the string to display in the frontend.

@vince-fugnitto thanks for the quick comment.

If I set a breakpoint, it is hit, the execution suspends, etc. Everything fine there.

The thing is, I want to use the Logpoint feature (https://code.visualstudio.com/blogs/2018/07/12/introducing-logpoints-and-auto-attach):

Instead of a bullet, the logpoint is shown as a diamond.
In contrast to a breakpoint, the execution should not suspend, but just print the expression I have specified for the logpoint when the code at this line is executed. But for me, execution is suspended even in this case…

@xpomul I see, I had not used the feature myself before but can confirm that it does break in vscode for such a case, perhaps it might be wortwhile to ask them as well? (I don’t see anything particularly wrong as to why it might not work)

I believe vscode looks at the [visual-studio-code] stackoverflow tag.

I ended up filing an issue to vscode-js-debug:

It seems that Theia overrides console.log to return a Promise instead of which caused the breakpoint to trigger unintendedly (at least that’s what I have understood…)

For anyone who is stumbling across this: The issue is now fixed in the latest nightly build of vscode-js-debug and should be included in the next official release of VS Code.

1 Like