I have a debug environment set in PhpStorm, but since I started using VS Code for ES6 version of Qedy, I was lazy to fire up the other IDE just to debug a problem.
One day I was fed up by only using debugger
statement, so I decided to set up debugging in VS Code as well.
I installed “Debugger for Microsoft Edge” extension by Microsoft.
I wanted to attach the debugger to my Edge Dev I'm already using, but most tutorials expect to launch a new browser every time.
Launch Edge with --remote-debugging-port=9222
Brilliant idea are conditions for keyboard shortcuts, I can use F5 for both Debug/Restart (when: inDebugMode && debugState == 'stopped'
) and Debug/Continue (when: debugState == 'stopped'
).
I installed “PHP Debug” extension by Xdebug.
settings.json
Most terminals allow to print colored text and the default Terminal in VS Code (based on PowerShell) is no exception.
asdf
asdf
asdf
Install Node.js from official web.
Install nodemon:
launch.json
When I debugged the router and module init, I wanted to run it immediately after nodemon restarted, so simply I added a HTTP GET call right into server.listen
function:
In VS Code you don't even need to hunt for extensions, “Node Debug” is already built-in.
I have to admit, it's quite joyous to work like that. I really like the simplicity of PHP and this isn't actually that far off.
asdf