microsoft / vscode-js-debug

A DAP-compatible JavaScript debugger. Used in VS Code, VS, + more
MIT License
1.67k stars 283 forks source link

feat: add basic network view, support experimental networking for node #2053

Closed connor4312 closed 3 months ago

connor4312 commented 3 months ago

This adds a basic network tree view that shows requests and responses in the debugee. It has a default "go to" action which opens a cURL representation of the request, and context menu actions to open the response body either in a text editor or the hex editor. It also has actions to copy the URL and replay the request.

I initially was hoping to turn this on by default for Node.js since their networking support in 22.6.0 inspired this change, but their functionality right now is very limited (we basically get the URL and nothing else.) Therefore I added an option to turn it on, but it's not on by default there.

I think I might end up toggling this off for the next stable release for now until we can polish it some more, but it's ship it in nightly to get some feedback!

Closes https://github.com/microsoft/vscode-js-debug/issues/2051

connor4312 commented 3 months ago

build failure is a known flake that's on my todo

vish01 commented 3 months ago

How do I enable this feature? I installed latest nightly version but don't see "network" tab in there.

connor4312 commented 3 months ago

It's automatically available if the debug target supports networking

vish01 commented 3 months ago

I am trying to debug an API call from a local VScode extension through debugger(which technically opens a new VScode window), is that supported?

connor4312 commented 3 months ago

VS Code extensions run in the extension host which is not on Node >=22.6 where networking support is available.

vish01 commented 3 months ago

Hmm I see, is that something I can update for my extension and upgrade node to >=22.6 or extension host node version needs to be upgraded by you guys?

connor4312 commented 3 months ago

The extension host's node is bundled with VS Code and isn't upgradable by users. And as I mentioned in the PR the network support Node added in 22.6 is very preliminary and not incredibly useful at the moment, so it'll be a minute.

This works for browsers however.

gabrieldomgen commented 2 weeks ago

Hi @connor4312 - I've tried that in the nightly build (I know it's not useful atm but wanted to check it out)

I have experimentalNetworking set as on in my launch.json - and it does add the correctly flag to node, but I'm just not seeing the network panel nor any of the commands related to it. Running on node 22.9

Any ideas on what it could be?

connor4312 commented 2 weeks ago

You'll want to also enable the VS Code setting debug.javascript.enableNetworkView