Visual Studio Code Debug Problem


#1

Hello I’ve just started developing applications with NativeScript and have not debugged JavaScript in the visual studio code environment before. I put a breakpoint on the application like in the picture, but it stops in ts_helpers.js file. Why does not Breakpoin stop where I put it. Can you help?


#2

Hey, @mertaltun, NativeScript’s debugging experience is made to imitate that of Node.js apps - there is a --debug-brk / --inspector-brk flag that will stop as soon as the first script is parsed and begins to be executed. This gives the user enough time to setup breakpoints in desired places in their code, while also making sure the runtime (the javascript virtual machine executing all your code) does not skip the breakpoints in cases it initialized quicker than the debug agent could attach and talk to the runtime.

tl;dr - The debugger, when passed a --debug-brk flag will stop on the first script. Feel free to continue the program execution, and your breakpoint will eventually be hit (if execution passes through your code, of course)

Feel free to read through the docs articles about debugging:

https://docs.nativescript.org/tooling/debugging#debugging

https://docs.nativescript.org/tooling/visual-studio-code-extension#supply-additional-arguments-to-the-debug-command

https://docs.nativescript.org/tooling/chrome-devtools


#3

Thank you so much for making this work