Debugging Embedded and Inline JavaScript with PHPStorm

I’m working on this god awful creation that has most of the JavaScript embedded and inline within the php source code. Is there a way I can set-up break-points with PHPStorm or an extension so I can debug this mess easier or is the only way to use console.log? I’ve never seen such a bigger mess of indian “engineering”… and of course it runs on codeIgnitor – what a piece of crap!!! You don’t give people a workflow to manage assets you end up with them placing JavaScript and CSS every f**kin where!!!

I found this answer on StackOverflow which seems to work but still requires modifying the source file.

Add a debugger; line to your JavaScript code. For example:

debugger; // Trigger a breakpoint.

Of course that’s somewhat dated - now you’d use console.log rather than alert for your debugging and have alert turned off in the browser.

Well no because the ide stops at that break point and than you can further step in and out of code line by line. I think there is also a way to do it without modifying the file but I’m have trouble figuring it out.

No one is disagreeing with that.

It is unnecessary to stop the code immediately before and after the breakpoint using antiquated alert debugging calls though.

How is it possible to stop code execution at a console.log call and step through the code within the ide itself for embedded JavaScript? Within PHPStorm I’m not able to set-up breakpoints within script tags for php files. Unless there is a setting or something I’m failing to enable. The onyl way which I have found to get close to achieving that is adding the debugger line. At which point the code execution stops at the debugger; flag and allows use of the JavaScript debugging features in the ide.

Well you don’t actually need console.log calls either side of the break created by the debugger call either.

That call by itself should start the debugger and allow you to set the breakpoint - to the best of my knowledge of how it works - although it is browser dependent.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.