Visual Studio Node: debug into Worker Threads (node 11) : <p>Can VS Code's Javascript debugger be made to debug node 11's new "Worker Threads"? Worker threads are modelled after web workers with a small number of extra capabilities on top and are available from the new worker_threads package (see <a href="https://nodejs.org/api/worker_threads.html" rel="noreferrer">https://nodejs.org/api/worker_threads.html</a>). Other than with node's sub processes, one can share memory with worker threads in the form of <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer" rel="noreferrer">SharedArrayBuffers</a>.</p>

<p>My VS Code launch configuration looks like that:</p>

<pre><code>   {
        "type": "node",
        "request": "launch",
        "name": "Mocha Tests",
        "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
        "runtimeArgs": [
            "--experimental-wasm-threads",
            "--experimental-worker"
        ],
        "args": [
            "-u", "tdd",
            "--timeout", "100000",
            "--colors", "${workspaceFolder}/test"
        ],
        "internalConsoleOptions": "openOnSessionStart",
        "autoAttachChildProcesses": true
   }
</code></pre>

<p>I can debug into the main node script, but the "autoAttachChildProcesses" flag is not effective in attaching to the spawned off worker threads and neither is adding a "debugger" statement within the code that runs inside the worker thread. </p>

<p>They mention that the "inspector" package is not yet supported for worker threads in their reference documentation, so I guess this may explain why that is.</p>

<p>Against all these odds, has anyone still succeeded in debugging into worker threads inside VS Code? </p>
