Xdebug in VS Code – working for anyone?

I’m struggling a bit with this, too. Purchased @nathanielks’s wonderful tutorial (https://roots.io/screencasts/debugging-php-with-xdebug), and working with with Visual Studio Code (v1.59.1), php 7.4.22 and xDebug v3.0.4.

Check the xDebug upgrade guide.

A few updates to the tutorial for xDebug 3:

  1. Make sure you are using current defaults for the role and check the template and tasks.
  2. xdebug_remote_autostart: 1 now would be xdebug_start_with_request: 1
  3. Default "port" is now 9003, not 9000.
  4. roles/xdebug/defaults/main.yml is a good starting place for vars to override in group_vars/development/php.yml, for example xdebug_show_local_vars defaults to 0.

You may want to rebase your updates over the latest trellis. Make sure you are working with a .git base directory of trellis and not the directory above site and trellis. Also make sure group_vars/all/main.yml contains php_version: "7.4", which is a new parameter.

Provisioning just xDebug:

ANSIBLE_TAGS=xdebug vagrant provision

(For some reason reprovisioning via trellis-cli fails, at least called with $ trellis provision --tags xdebug development yields /bin/sh: lsb_release: command not found.)

2 Likes