Xdebug with VSCode and DrupalVM

After installing xdebug as extension to VS Code there is simple config you need to do to make it work with DrupalVM and debug. Create debug profile in standard VS code way and add this

    "version": "0.2.0",
    "configurations": [
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9001,
            "pathMappings": {
                "/var/www/drupalvm/web": "${workspaceRoot}"
            "xdebugSettings": {
                "show_hidden": 1

so important part is to watch out for port that it matches one in DrupalVM and the pathMappings, if your code and index.php is sitting at "/var/www/drupalvm/web" this is what you need to put, and this should be it, after that start debugger and it should stop at your breakpoints. Note that you need to setup your Chrome Xdebug Helper extension to have specific IDE key, in this case you should put "VSCode" in "other" dropdown field.

I also like to put debug bar to be docked so edit your config to have this
"debug.toolBarLocation": "docked" as by default it is floating.

there is also setting in DrupalVM "php_xdebug_idekey" where you should also put VScode but seems to me it doesnt affect things as I have it as PHPStorm and xdebug runs in VSCode