langium
langium copied to clipboard
Debugging library TypeScript code does not work in generated hello-world project
Langium version: 0.5.0-next.f2b3802 Package name: langium
Steps To Reproduce
- Generate the hello-world project
- Start the language server and attach to it for debugging
- Set a breakpoint in the DSL code, step out to Langium code
- 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.
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
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?
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).