I'm new to VSCode and I use it for debugging node.js(Typescript) code. Something that I notices it that if my code stops in a breakpoint and then I use the option "Step Over" or "Step Into", the code goes to the post-compiled Javascript file, instead of the relevant Typescript file.
Do you know how to make the debugger go only to Typescript files as a result of using "Step into" / "Step over"?
My settings.json file look this way:
{
"type": "node2",
"request": "launch",
"name": "Launch TS Program",
"program": "${workspaceFolder}\\app.ts",
"preLaunchTask": "tsc: build - tsconfig.json",
"outFiles": [
"${workspaceFolder}\\**\\*.js"
],
"smartStep": true,
"outputCapture": "std",
"console": "internalConsole",
},
One of the key features of Visual Studio Code is its great debugging support. VS Code's built-in debugger helps accelerate your edit, compile, and debug loop.
Open a file to debug (either package main source file or the test file) in the editor, and select the Run and Debug button from the Run view. Alternatively, you can start debugging using Start Debugging (F5) command from the Run menu or from the Command Palette (Linux/Windows: Ctrl+Shift+P, Mac: ⇧+⌘+P).
In most languages supported by Visual Studio, you can edit your code in the middle of a debugging session and continue debugging. To use this feature, click into your code with your cursor while paused in the debugger, make edits, and press F5, F10, or F11 to continue debugging.
Try to set smartStep
to true
in your launch config file (launch.json
).
You can find more information about this option in the documentation here.
With the
smartStep
attribute set totrue
in a launch configuration, VS Code will automatically skip 'uninteresting code' when stepping through code in the debugger. 'Uninteresting code' is code that is generated by a transpiling process but is not covered by a source map so it does not map back to the original source.
I had the same issue. I set the following option in my tsconfig.json
and then deleted the directory specified by outDir
in tsconfig.json
.
{
...
"inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
...
}
Then when the project was rebuilt on the next debug, the stepping operations seemed to work fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With