Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Node debugging auto-attaches to all Node sub-processes" seems not working #430

Closed
heejaechang opened this issue Apr 15, 2020 · 1 comment
Assignees
Labels
feature-request Request for new features or functionality verified Verification succeeded
Milestone

Comments

@heejaechang
Copy link

I tried the latest js-debug (https://marketplace.visualstudio.com/items?itemName=ms-vscode.js-debug-nightly&ssr=false#overview) with this repo (https://github.com/microsoft/pyright)

ran "Pyright Language Client" and expected all node processes to be automatically attached. but it didn't.

that's fine, so I attached to the server node manually using "Pyright Language Server" launch config. that worked. but it didn't show worker_threads (nodejs).

that seems to be another bug? or am I doing something wrong?

@connor4312
Copy link
Member

connor4312 commented Apr 15, 2020

Thanks for the issue! Indeed, we didn't attach child processes in extension host debugging. In the linked commit, we now do. You'll have to make two changes to make this work on your codebase:

  • Add autoAttachChildProcesses: true to your launch config. I've defaulted this to false for extension hosts since other extensions will often spin up processes the user doesn't care about, such as tsserver.js processes, eslint, etc. which would be noisy and potentially confusing.
  • Remove the explicit '--inspect=6600' in from the debugOptions in the client. This interferes with the auto attachment process in this extension.
patch file
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 0da1112..894b5c5 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -38,6 +38,7 @@
             "name": "Pyright Language Client",
             "type": "extensionHost",
             "request": "launch",
+            "autoAttachChildProcesses": true,
             "runtimeExecutable": "${workspaceRoot}/client/out/src/extension.js",
             "preLaunchTask": "npm: build:clientServerDebug",
             "args": [
@@ -100,4 +101,4 @@
             }
         }
     ]
-}
\ No newline at end of file
+}
diff --git a/client/src/extension.ts b/client/src/extension.ts
index 6967a05..42173e5 100644
--- a/client/src/extension.ts
+++ b/client/src/extension.ts
@@ -25,7 +25,7 @@ export function activate(context: ExtensionContext) {
 
     const bundlePath = context.asAbsolutePath(path.join('server', 'server.bundle.js'));
     const nonBundlePath = context.asAbsolutePath(path.join('server', 'src', 'server.js'));
-    const debugOptions = { execArgv: ['--nolazy', '--inspect=6600'] };
+    const debugOptions = { execArgv: ['--nolazy'] };
 
     // If the extension is launched in debug mode, then the debug server options are used.
     const serverOptions: ServerOptions = {

Node.js doesn't currently expose worker threads over the inspector protocol, see: nodejs/node#26609

@connor4312 connor4312 self-assigned this Apr 15, 2020
@connor4312 connor4312 added feature-request Request for new features or functionality verification-needed Verification of issue is requested labels Apr 15, 2020
@connor4312 connor4312 added this to the April 2020 milestone Apr 15, 2020
@aeschli aeschli added verified Verification succeeded and removed verification-needed Verification of issue is requested labels Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants