ChatGPT解决这个技术问题 Extra ChatGPT

Skip line while debugging in Chrome developer tools

Is there a feature in Google Chrome developer tools that would allow skipping a line without it being executed while debugging, in a similar way that it can be done in Visual Studio?

One workaround I can think of is 'live editing' the code by wrapping the line in

if(false){ //line to be skipped }

But this is not the most convenient workaround that I would have to do after every refresh. Is there a built-in or faster, better way of doing this?

No, control transfer is not supported in DevTools. Please file a feature request at crbug.com/new
@AlexanderPavlov Done. code.google.com/p/chromium/issues/…

M
Matas Vaitkevicius

No, and is not going to happen.

Last comment from dev says:

We're going to hold off on this feature for now. It's complexity is high and it's not common enough a workflow. One could also just comment out the lines and hit ctrl-s to get the same effect, pretty much. Status: WontFix –

The workaround is to comment out the line you want to skip and press Ctrl+S.


Hi Matas, any idea why its not going to happen?
@CHash_Mike if you would click on link last comment from dev says: We're going to hold off on this feature for now. It's complexity is high and it's not common enough a workflow. One could also just comment out the lines and hit ctrl-s to get the same effect, pretty much. Status: WontFix
So completely recompiling the whole block and trying to match up the instruction pointer is easier than advancing the instruction pointer to the next statement? Bizarre, but perhaps becuase its javascript, and interpreted line-by-line
In case anyone else comes here for the same reason I did, this doesn't work if you are using the "Pretty Print" option to view your code in dev tools.
It also doesn't work, rather obviously, if you're debugging javascript via chrome://inspect on a mobile device against deployed code, say for example, within a cordova build.