I just spent an hour or so trying to set up VSCode and Xdebug (in combination with DrupalVM). Being relatively new to VSCode, I don't have lots of experience yet in configuration files. But at work I am used to working with PHPStorm, so I do have experience in using XDebug and setting that up. I copied the example code (from the VSCode Marketplace) and couldn't get it to work, when suddenly I saw the $ prefixed in another configuration example. That led me to this repo, and eventually I noticed the (probably) highly related issue #207 .
pathMapping example code on marketplace.visualstudio.com (and thus also in the VSCode Extension Info page) lacks an $ before {workspaceRoot}, which was already fixed on Github by #207.
User @ooystein noticed this as well: https://github.com/felixfbecker/vscode-php-debug/pull/207#issuecomment-358629097


I came here to mention the same thing...
Same here, this took me way to long to figure out (ashamed to say). But it needs to be fixed, such a small step for a man, giant leap for....the rest trying to figure this out.
Maybe you could add an example for Windows directories to the documentation as well. It took me an hour to figure out that the drive letter has to be written in lowercase and that slashes have to be written as / and not as \\...
This works for me:
"/var/www/html": "c:/Users/Example/FooBar"
Update should now reflect that ${workspaceRoot} is deprecated in favour of ${workspaceFolder}.
Also should have an usage example when in multiroot environment with may be a link to VSCode Variable Reference.
Most helpful comment
Maybe you could add an example for Windows directories to the documentation as well. It took me an hour to figure out that the drive letter has to be written in lowercase and that slashes have to be written as
/and not as\\...This works for me: