binaryage / dirac

A Chrome DevTools fork for ClojureScript developers
Other
769 stars 30 forks source link

Loopback mode and pausing on a breakpoint #94

Open darwin opened 4 years ago

darwin commented 4 years ago

Investigate if it would be possible to evaluate code on a paused breakpoint when using loopback mode.

This is continuation of the discussion: https://github.com/thheller/shadow-cljs/issues/636#issuecomment-706654730

lucywang000 commented 4 years ago

Continue from https://github.com/thheller/shadow-cljs/issues/636#issuecomment-710727159 :

IIUC this doesn't seem to be able to work. cljs_eval('"foo"') sends the content to shadow-cljs server (through the websocket connection) to parse, which the server compiles down to js code and sends it back to the page to execute. When the page is paused by a breakpoint, there is no way for this to happen.

What's more shadow-cljs server sends ping requests to the client and in a breakpoint the client is not able to respond with a pong, so the server would disconnect the client.

Just for brainstorming, it seems we need somehow to implement a cljs_eval in the dirac dev tools (so it could execute even when the page js runtime is paused at breakpoint) to communicate with shadow-cljs server to compile the cljs code to js and then evaluate it using CDP.

thheller commented 4 years ago

I could add a no-ping config option if that would help. Also technically if you can open a websocket you have access to everything cljs_eval uses. So you could just get the JS code directly and trigger the eval yourself. Still need to do a full writeup for this though.