Disable node.js app debugging in Visual Studio Code (vscode) - node.js

I am working on this node.js application using Visual Studio Code IDE. Everytime I run this application, it is attaching a debugger (which takes around 2-5 seconds) and then executing the application.
So, my issue is everytime if I modify some code (or a simple variable name) and execute the program, it takes this much time to see the output even though I haven't set any breakpoints.
Need help in disabling the debugger in Visual Studio Code IDE for node applications development. I can't find anything helpful on net :( .

There is workbench.action.debug.run which is bound to cmd+f5 / ctrl+f5 by default.
You can find it in the command palette under the name "Debug: Start without Debugging"

Inside the VsCode terminal, I've switched the terminal to zsh instead of the JS Debug Console and it fixed it:
Screenshot of the terminal's dropdown

You can just switch from "Javascript Debug Terminal" to "powershell" (command terminal). it doesn't attach the debugger again

consider passing the option below on settings.json
"debug.javascript.autoAttachFilter": "onlyWithFlag"
with this option, you will always need to pass ---inspect option to start debugging mode. otherwise, it will always start normal running mode.

Related

Invisible and locked Breakpoint in Sphere SDK for vs code

I'm trying to get started with microsoft's azure sphere development.
When I try to debug any of the starter projects within vs code, it tells me that I have a breakpoint set on the first line of the app.
However, vs code doesn't show any breakpoints in the "Breakpoints" tab.
I am running the latest VS code version (1.44) with the Azure Sphere Extension 20.1 on windows 10. The same problem appears on Linux.
To reproduce the bug:
Download the starter projects from github
Install the Azure sphere extension for visual studio code.
open HelloWorld_HighLevelApp folder in azure-sphere-samples\Samples\HelloWorld\HelloWorld_HighLevelApp in visual studio code.
Go to the Debug tab and hit the green play button on top left corner. Next to the button it should say Launch for Azure Sphere High-Level Applications (gdb)
For me it doesn't an error but the output console shows:
Deploying image...
Starting debugger....
Process /mnt/apps/1689d8b2-c835-2e27-27ad-e894d6d15fa9/bin/app created; pid = 2233
Listening on port 2345
Remote debugging from host 192.168.35.1, port 54911
Starting CMake Hello World application...
The Debug Console shows:
...
Breakpoint 1, main () at ../../main.c:45
45 {
Loaded 'target:/usr/lib/libapplibs.so.0'. Symbols loaded.
Loaded 'target:/lib/libgcc_s.so.1'. Symbols loaded.
Loaded 'target:/usr/lib/libc++runtime.so.1'. Symbols loaded.
Is there a work around / a plan to fix the issue?
Addition 1:
To provide extra clarification here is a screenshot, showing the miss match of console output (breakpoint set) and ui (no breakpoint set)
Azure Sphere uses gdbserver to provide a debug channel to the device. A default behavior of gdb is to break on entering main. This can be confusing to people on Windows who expect a run to breakpoint behavior as is common in Visual Studio. For our interface with GDB we intentionally silently skip the breakpoint on entering main in Visual Studio to be consistent. You can actually see that breakpoint skipped in the debug log output window.
For VS Code we also skip the breakpoint on main when you are on Windows. It looks like you are on Linux from the output above. I haven't used it on Linux for a few weeks so can't recall if the behavior is intentionally different there or not. It would make sense to me to break on entering to main when on Linux as that is the common expectation when using GDB which is more common there than on Windows. I'll check if this is by design or not and reply back, but I suspect it is.
Solution:
Finally I found the root cause of the issue. Visual studio code acts just slightly different when debugging the sphere device compared to just plain c code.
When you start the debugging mode and you haven't set a breakpoint initially, it won't start running your program till you have set a breakpoint. In plain c debugging the program just runs through and printed values are shown in the debug console.

Debugging in WebStorm and npm

I am new to web development (am a backend developer normally).
I am trying to set up a development environment to reflect my current workflow. I develop Java in IntelliJ Ultimate and I like how I can step through and debug.
The current front end development team start npm and then use Chrome developer tool window to debug.
Is there a way to connect WebStorm to this process so that I can set a break point in WebStorm instead of using the Chrome developer tool window?
I have installed the JetBrains extension in Chrome and I cannot find how to do this on their site.
Again, please excuse my ignorance as I am very new to front end development. but if I can get this functionality it would be fantastic.
Any help or guidance would be very much appreciated.
Create JavaScript Debug run configuration per instructions at https://confluence.jetbrains.com/display/WI/Starting+a+JavaScript+debug+session#StartingaJavaScriptdebugsession-Startingadebugsessionwhenusingadifferentwebserver, add breakpoints, start your server via npm, then select the configuration above and press Debug.
See also these videos:
Quick start: https://www.youtube.com/watch?v=a-IsnxZpRrQ
Breakpoints, stepping, watches: https://www.youtube.com/watch?v=CdXoeVRN1JU
You need chrome extension that you already installed here is link also ExtensionJetBrains IDE Support
once you install know enable breakpoint
here is the way to do all step you can see shortcut key too
once you enabled breakpoint then just click near to line number to set breakpoint
another option go to File-> setting and enable breakpoint
when you run your code open inspect as well then you will see this magic :D :)

How can I debug Gulp tasks using Node Tools for Visual Studio?

I recently installed NodeJS Tools for Visual Studio which touts support for Node environments in VS. Notably, it has the ability to set debug breakpoints from the IDE.
It's unclear to me if it is possible to set breakpoints when debugging Gulp tasks. The Task Runner has the ability to detect the Gulp task and output console.log statements to a window, but I haven't found a better means of debugging.
I found this post from a while back: How can I debug gulpfile.js when running it with Visual Studio Task Runner Explorer? However, this post doesn't involve NodeJS Tools for VS. So, I'm re-asking the question to take that plugin into consideration.
You can. Right-click the Node project, select Properties, and configure your app as follows (in the image, default is the Gulp task that you want to run).
Alternative method:
In a terminal, and in the directory where the gulpfile is, run node --debug=44331 --debug-brk ../node_modules/gulp/bin/gulp.js default. In my case, default is the task name I want to run/debug.
In Visual Studio, go to Debug | Attach to Process. Select Node.js Remote debugging as Transport, and in the qualifier select localhost:44331. Press enter and you should see the Node process appear in the list. Click Attach.
Voila, the breakpoints are hit.
A couple of things to notice:
If you get something like Unable to attach to process. Error 0x80004005 use a different port. I couldn't get it to work with port 5858.
It may not work the first time you attach to the process (see my previous screenshot how I got ECANCELED?). Try again.

Visual Studio Code debugging client side JavaScript

I am using Visual Studio Code for a javascript project. You can set breakpoints and step through and debug very easily the code that runs in nodejs. Is there any way to allow breakpoints and debugging for the client side, browser running code?
Debugging via console.log gets old real quick.
For debugging in Chrome there is the Visual Studio Code: Debugger for Chrome extension. You can find this extension in the marketplace, search for debugger as told in the debugging manual. Unfortunately there is (currently) no support for other browsers,
Debugging node.js works out of the box, see the debugging manual above or John Papa's blog post.
Debugging both client and server (as Phil commented) is not possible at least in my opinion since you need to have two different launch configurations, sorry.
You should use developer tools which all modern browses have (F12).
I prefer chrome because with workspaces and you can inline edit your code in browser.
By opening you project in chorme Browser and using chrome DevTools.
You can debug it whatever you want.
steps:
Open your project (with url).
Open DevTools (F12)
Choose the "Elements" and choose the Element
You can see "Event Listeners" on the right panel , Select what you needed
And then, You can right click the event you, Select "Show function defination"
Enjoy yourself !
If you means Debug Nodejs ,As I known there's A npm package named "debuger"?
Another technique is to use the Visual Studio Code: Debugger for Chrome extension. Save the contents of your launch.json config for node.js and delete it. Then create the Chrome launch.json. Combine the two and you can debug either the server or the client in Code (but not both at the same time).
To debug the client, the server must be running, so from a command prompt use the "node" command that starts the server. In Code launch the Chrome debugger and debug the client side.

MPI debugging with VS2012

The cluster debugging option is removed from Visual studio 2012.
So is there any way to debug MPI apps in VS2012 ?
Visual studio 2012 and later versions do not support MPI debugging. However there is a workaround:
Start debugging by specifying mpiexec.exe as your command and related parameters and the name of your executable as command arguments:
Command-> mpiexec.exe
CommandArguments-> -n 2 myapp.exe
When the execution starts, use Debug->Attach to process... to attach the debugger to one your processes. Sometimes I add a simple press any key to continue logic to my app, just to pause the program until I finish this attaching process.
In order to ease tings you can use an extension called Reattach that lets you attach to the last processed you attached with one button click.
One problem with this workaround is that you cannot select which MPI process you attach :(

Resources