MediaWiki-Docker/Configuration recipes/Xdebug config for VS Code

Xdebug for VS Code
To debug PHP code in VS Code, do the following:


 * 1) Set up xdebug in the container.
 * 2) In VS Code, install the PHP Debug extension
 * 3) Open the MediaWiki codebase in VS Code. Go to the Run tab (play button with a little bug), click "create a launch.json file" and select PHP as the environment. (If you already have a launch.json file, select "add configuration" from the dropdown.) The launch.json file should look something like this:
 * 1) The important things are 1)the "pathMappings" configuration is defined and 2) the port number corresponds to the the XDEBUG_CONFIG port number in your .env file (9000 by default)
 * 2) Set your Xdebug browser extension of choice to listen for the debugger. In the MediaWiki codebase, place a breakpoint in the PHP code you'd like to step through. Visit your local site in the browser and, if the breakpoint is placed on a line of code that's run, the debugger will pause on that line and allow you to step through the code.

Notes:
 * 1) If the debugger stops on errors or exceptions unexpectedly, in VS Code, uncheck "Everything" in the Breakpoints window within the Run tab.
 * 2) This won't work for extension codebases opened in VS Code; you must run the debugger from the MediaWiki core codebase (but you can place breakpoints in extension code there).