vscode: Auto Attach is not toggling for Node.js since latest update

  • VSCode Version: 1.47.2
  • OS Version: Windows 10 v1909 (Build 18363.959)

Steps to Reproduce:

I use WSL to start VSCode with code . from my project directory in Windows Terminal. When VSCode starts up, “Auto Attach: Off” is shown in the status bar:

enter image description here

Clicking “Auto Attach: Off” in the status bar does not toggle it.

I then start my project in VSCode’s integrated terminal with npm run debug, which corresponds to the following scripts line in package.json:

"scripts": {
  "debug": "NODE_ENV=development DEBUG='knex:*' nodemon --inspect ./server.js"
}

However, the debugger is not auto-attached, so I need to manually run the Attach configuration from the Run panel shown on the left here:

enter image description here

The debugger works, but I still cannot toggle the Auto Attach: Off to be On instead:

enter image description here

Even if I Ctrl+Shift+P --> Debug: Toggle Auto Attach, nothing happens. Even if I restart VSCode after doing so.


So, in conclusion, how can I start my VSCode with code . from Windows Terminal and then just type npm run debug and have VSCode, run my program AND auto-attach the debugger? I also need the server to restart upon file changes, which is why I am using nodedemon in the npm run debug script.

Do I need to either:

  • change launch.json configuration? Though I have tried essentially all of the boilerplate launch.json configs shown in VSCode, but none worked.

  • or modify my package.json defined script for debug?

  • or correct some setting on VSCode?

Does this issue occur when all extensions are disabled?: Yes

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 37 (18 by maintainers)

Most upvoted comments

@msanandrea BTW, the “protocol” and “sourceMaps” properties are no longer necessary…