Node debugging
Automatically Attach to Node.js processes
A first version of a new Auto Attach feature has been added to VS Code’s Node.js debugger. If enabled, the Node debugger automatically attaches to Node.js processes that have been launched in debug mode from VS Code’s Integrated Terminal.
To enable the feature, either use the Toggle Auto Attach action or, if the Node debugger is already activated, use the Auto Attach Status Bar item.
Whether or not a process is in “debug mode” is determined by analyzing the program arguments. Currently, we detect the patterns --inspect
, --inspect-brk
, --inspect-port
, --debug
, --debug-brk
, --debug-port
(all optionally followed by a ‘=’ and a port number).
Please note that this feature does not (yet) work for terminal multiplexers like ‘tmux’ (where launched processes are not children of VS Code’s integrated terminal).
Improved Process Picker
In previous releases, a process picker for Node.js processes was only available as an “interactive variable” that could be used from within a launch configuration.
In this release, we’ve made the picker available as an Attach to Node Process action that can be used without a launch configuration.
To make the picker and the new action more useful, we now support attaching to Node.js processes via a debug port (in addition to attaching via the process id).
In addition to Node.js processes, the picker now shows all programs that were launched with one of the various forms of --debug
or --inspect
arguments. This makes it possible to attach to Electron’s or VS Code’s helper processes.
The individual process items listed in the picker show the debug port and the detected protocol in addition to the process id.