microsoft / microsoft/vscode-js-debug

Allow overriding `autoAttachMode` when starting node debugger

Open
#2,172 1 comment 0 reactions 1 assignee View on GitHub

@connor4312 is already working on this.

Since Feb 14, 2025.

feature-request
Dominant language
TypeScript
Stars
2k
Forks
373
Avg merge
1d 9m
Merged PRs (30d)
6

Description

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).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.