question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expose (some) CDP commands

See original GitHub issue

I’d love to play around with the Page.captureScreenshot request for an experimental VS Code extension. It would be awesome if the VS Code Debug Adapter would expose some request that would allow to call these CDB requests through debugSession.customRequest.

Advantages

  1. This would allow for some cool (experimental) VS Code extensions. The captureScreenshot request could be used to show a screenshot of variables that point to an HTML element. I guess there are also some other cool methods exposed by chrome that could further push the debugging experience.

Risks

  1. User experience could be degraded if such extensions bring the debug adapter in an inconsistent state by calling some CDP requests they are not supposed to call.

I guess to mitigate 1), the exposed CDP requests could be allow-listed (e.g. only when using the non-insiders build to enable exploring ideas). Page.captureScreenshot should be pretty risk free.

What do you think?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:21 (21 by maintainers)

github_iconTop GitHub Comments

3reactions
connor4312commented, Mar 2, 2021

whereas I would like to proxy “everything” to my own adapter

I would prefer a design where you don’t actually proxy ‘everything’. For example, you may not care about scriptParsed events for your use case and only request/response pairs and output events. CDP is chatty and latency is important, I don’t want to add extra work unnecessarily.

3reactions
hedietcommented, Jan 8, 2021

~Sorry for the delay. I had a look today, but I was not able to debug the debug-adapter. I opened the debug-adapter in the latest vscode insider build, ran npm run watch and launched the “Extension” launch config. The entry point of the extension called. However, my breakpoints in the constructor of the DebugAdapter are not hit.~

~I also get this error in the Extension Development Host:~ image

~I guess its a trivial mistake, but I’m stuck.~

I didn’t figure out that I had to uninstall the bundled JavaScript Debugger Extension. I didn’t even know this is possible… My breakpoints are being hit now 😉

It works nicely:

image

I’ll try to prepare a PR soon that exposes this cdp method. I think a hover provider can be implemented that shows a screenshot of HTML elements when hovering on an HtmlElement while debugging the code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CDP Command Reference - Cisco
This chapter describes commands used to monitor the router and network using Cisco Discovery Protocol. (CDP). • cdp enable, page 2. • cdp...
Read more >
Administrative commands | CDP Private Cloud
The subcommands of hdfs haadmin are extensively used for administering an HA cluster.
Read more >
Learn how CDP neighbor works on Routers and Switches
My courses you can buy at Lowest Price.1. Cisco Nexus Training : Go from Beginner to ...
Read more >
Understanding CDP (Cisco Discovery Protocol)
If for some reason it was previously disabled, and you want to re-enable it, you can use the cdp run command in global...
Read more >
CDP ( Cisco Discovery Protocol) and LLDP (Link Layer ...
Some of the important facts about CDP Protocols are given below:- ... information about them, you can the “show cdp neighbors' command:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found