$ PID=$(pgrep -f "^/Applications/Visual Studio Code\.app/.*--type=extensionHost")
$ echo $PID
35791
Argument -f tells pgrep to match the pattern against the full process argument string, not just the process name.
$ kill -SIGUSR1 $PID
(This produces no output.)
3. Find which port the process started listening on using lsof:
$ lsof -p $PID -a -i4tcp
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Code\x20H 35791 tim.vergenz 58u IPv4 0x8af67df8a9aa26a8 0t0 TCP localhost:63767 (LISTEN)
Argument explanations:
-p means filter by PID
-i4tcp means filter by Internet address (4tcp means only IPv4 / tcp protocl)
- the
-a in between combines the two filters via AND instead of the default OR
In the "NAME" column you'll find the host and port that your VS Code extension host process is listening on -- i.e. in the example above, localhost:63767.
4. Open Chrome Devtools, and add the debug address under Devices > Discover network targets > Configure.
![Chrome Devtools @ chrome://inspect]()
![add debugger address from step 3]()
5. Open your new debug target:
![connect to new debug target]()
You may need to manually add ~/.vscode/extensions to your workspace in order to browse files and add breakpoints:
![add folder to workspace]()
... and click "Allow" to grant it permission:
![allow devtools to access ~/.vscode/extensions]()
Success!
![success! VS Code extensions now show in devtools]()