Search code examples
drupalddev

Exception clickthrough using DDEV and Vscode on Drupal 10 with Ignition


I'm using the Ignition module on Drupal 10. When I encounter an exception, the link to open the file is invalid; it points to the file inside of the DDEV container, something VSCode can't see.

How can I get serve my website via DDEV, and get the click-through function working with DDEV?

Test

  1. Install Ignition module on Drupal 10.
  2. Create a new module, with a route that has a missing controller.
bad_module.settings:
  path: '/bad_module'
  defaults:
    _controller: 'Drupal\bad_module\Controller\MissingController'
    _title: 'Bad routing'
  requirements:
    _permission: 'administer modules'
  1. Access '/bad_module' will throw an InvalidArgumentException exception due to missing controller.
  2. Click "ClassResolver:24" should open my IDE at the file.

enter image description here

Drupal: 10.0

Ignition: 1.0@alpha2

OS: WSL2 Ubuntu on Win10

VSCode: 1.74.3

DDEV: 1.21.4, vHEAD-a0f42dd


Solution

  • Solution

    There seems to be 2 things we need to fix:

    1. Get web container to use our config file.
    # Create a new one
    touch ./.ddev/homeadditions/.ignition.json
    
    # Alternatively, use an existing one as the new base
    mv ~/.ignition.json ./.ddev/homeadditions
    
    1. Configure .ignition.json to remap the directories.
        "editor": "vscode-remote",
        "remote_sites_path": "/var/www/html",
        "local_sites_path": "wsl+Ubuntu/home/user13/drupal/ignition-d10-demo"
    

    Because I'm using DDEV and VSCode via WSL, I need to following settings:

    • vscode-remote is VCode using one of the remote extensions
    • remote_sites_path is the project root inside DDEV
    • local_sites_path is the path of my project where
      • wsl is the remote style (as opposed to ssh)
      • Ubuntu is the WSL OS (wsl -l)
      • /home/user13/drupal/ignition-d10-demo is the path inside WSL (pwd)

    Full .ddev/homeadditions/.ignition.json

    {
        "theme": "dark",
        "editor": "vscode-remote",
        "hide_solutions": false,
        "remote_sites_path": "/var/www/html",
        "local_sites_path": "wsl+Ubuntu/home/user13/drupal/ignition-d10-demo"
    }