vscode-js-debug icon indicating copy to clipboard operation
vscode-js-debug copied to clipboard

Allow overriding `autoAttachMode` when starting node debugger

Open CynicalBusiness opened this issue 8 months ago • 1 comments

Is your feature request related to a problem? Please describe. When starting a debug profile via launch.json, the only control we currently have over the auto-attach behavior is to disable it completely (via autoAttachChildProcesses).

When attempting to use a launch configuration to start processes via a "dev server" style of tool, a lot of extraneous child processes are spawned that don't need to be attached to before user code is actually reached. Combine that with a package manager like yarn, things like dotenvx, and especially a complex toolchain like nx, and you get this madness:

Image Image

I can see that the debug.javascript.autoAttachFilter is completely ignored, per #923, and indeed I can see in VSCODE_INSPECTOR_OPTIONS that autoAttachMode is being set to always. There was also some discussion regarding it I found in microsoft/vscode#102057, but it's quite old at this point and the consensus there was to entirely disable auto-attach, which I'm trying to avoid.

Describe the feature you'd like

I'd like if there was some way to override the autoAttachMode passed to VSCODE_INSPECTOR_OPTIONS (or equivalent) with values that match the debug.javascript.autoAttachFilter setting.

The autoAttachChildProcesses setting could be adjusted to accept the same values as debug.javascript.autoAttachFilter, potentially keeping the true/false behavior as aliases for always and disabled, respectively, or an entirely new property introduced (such as autoAttachFilter or autoAttachMode).

CynicalBusiness avatar Feb 14 '25 00:02 CynicalBusiness