microsoft / microsoft/vscode-js-debug
Debug terminal terminates parent session when program execution ended
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 373
- Avg merge
- 1d 9m
- Merged PRs (30d)
- 6
Description
Question
In Zed, we have support for the runInTerminal reverse request since the beginning of the debugger implementation. But back then (~October 2024), users could execute multiple programs and auto-attach to it using the integratedTerminal feature. Since the debugger feature got released, a user reported that auto-attaching to multiple programs no longer works https://github.com/zed-industries/zed/issues/33101#issuecomment-3067191061. Could it be that we are missing some configuration that could make this work again? Because It also still seem to work in VS Code.
I'm not sure if they do some magic under the hood to make this work. Also tried going back to the version of the JS debug adapter we used back then, but that didn't resolve the issue.
Details
Initial implementation - auto-attaching to multiple programs
As you can see inside the initial implementation video, auto-attaching to multiple programs worked fine back then. Using the same configuration options as we use now.
https://github.com/user-attachments/assets/c4deff07-80dd-4dc6-ad2e-0c252a478fe9
Current implementation
As you can see inside the video, after the first program's execution was ended, both the parent (root) and child session are terminated.
Because of this, we can no longer auto-attach to multiple programs.
https://github.com/user-attachments/assets/6855848b-a347-419d-9ac1-39af5aa6935e
Requests from parent session
// Send
{
"type": "request",
"seq": 2,
"command": "launch",
"arguments": {
"request": "launch",
"type": "pwa-node",
"cwd": "/Users/remcosmits/Documents/code/prettier-test",
"console": "integratedTerminal",
"sourceMaps": true,
"pauseForSourceMap": true,
"sourceMapRenames": true
}
}
// Send
{
"seq": 9,
"type": "request",
"command": "runInTerminal",
"arguments": {
"kind": "integrated",
"title": "",
"cwd": "/Users/remcosmits/Documents/code/prettier-test",
"args": [
"/opt/homebrew/bin/node"
],
"env": {
"NODE_OPTIONS": " --require \"/Users/remcosmits/Library/Application Support/Zed/debug_adapters/JavaScript/JavaScript_v1.102.0/js-debug/src/bootloader.js\" --inspect-publish-uid=http",
"VSCODE_INSPECTOR_OPTIONS": ":::{\"inspectorIpc\":\"/var/folders/hx/t0sdmy610b5fbcmqvxc_kzm80000gn/T/node-cdp.46856-645a63b2-0.sock\",\"deferredMode\":false,\"waitForDebugger\":\"\",\"execPath\":\"/opt/homebrew/bin/node\",\"onlyEntrypoint\":false,\"autoAttachMode\":\"always\",\"fileCallback\":\"/var/folders/hx/t0sdmy610b5fbcmqvxc_kzm80000gn/T/node-debug-callback-b989ae2e9f4b78a4\"}"
},
"argsCanBeInterpretedByShell": false
}
}
// Send
{
"type": "response",
"seq": 10,
"request_seq": 9,
"success": true,
"command": "runInTerminal",
"body": {
"shellProcessId": 46862
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the runInTerminal reverse-request handling for integratedTerminal and compare the parent and child session lifecycle after the first program exits. Reproduce the launch configuration and request sequence shown in the issue, then verify that ending the first child leaves the parent session alive and permits a second auto-attached program.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100