eclipse-langium / langium

Next-gen language engineering / DSL framework
https://langium.org/
MIT License
754 stars 68 forks source link

Debugging library TypeScript code does not work in generated hello-world project #572

Closed spoenemann closed 2 years ago

spoenemann commented 2 years ago

Langium version: 0.5.0-next.f2b3802 Package name: langium

Steps To Reproduce

  1. Generate the hello-world project
  2. Start the language server and attach to it for debugging
  3. Set a breakpoint in the DSL code, step out to Langium code
  4. Set a breakpoint in the langium .ts code

The current behavior

The debugger jumps to the .js code. The .ts breakpoint is not bound.

The expected behavior

Debugging the .ts code should work.

msujew commented 2 years ago

It seems like the out files aren't correctly set by default:

https://github.com/langium/langium/blob/87ac732b1ab1d7c372fc2d7d51eb5f566c826561/packages/generator-langium/langium-template/.vscode/launch.json#L25-L27

They should look like this:

https://github.com/langium/langium/blob/87ac732b1ab1d7c372fc2d7d51eb5f566c826561/.vscode/launch.json#L56-L62

spoenemann commented 2 years ago

Debugging the .ts files of the hello-world project works fine. It's just the langium library files that are not correctly mapped. Isn't the outFiles setting just for the local project?

msujew commented 2 years ago

Nope, it's not only for the local project. If you're trying to debug .ts code from a node_module, you need to add the js files to the outFiles for vscode to pick up the source maps.

Removing "${workspaceFolder}/packages/langium/lib/**/*.js" from the mentioned launch config prevents you from debugging the langium core codebase (just tested it).