symfonyphpstormwindows-subsystem-for-linux

Symfony's framework.ide config for PhpStorm and WSL


How do I set up framework.ide config value so that it properly links to files in PhpStorm, when the code is run from WSL

I've tried phpstorm://open?file=%%f&line=%%l

I used to use the substitution function &/var/www/html/>C:/web/PhpstormProjects/ before using WSL. (https://symfony.com/doc/current/reference/configuration/framework.html#ide)

I've tried phpstorm://open?file=%%f&line=%%l&/var/www/html/>//wsl.localhost/Debian/home/web/PhpstormProjects/ without result.

What would be the solution please ?

# config/packages/framework.yaml
framework:
    secret: '%env(APP_SECRET)%'
...
    ide: 'phpstorm://open?file=%%f&line=%%l&/var/www/html/>\\wsl.localhost\Debian\home\web\PhpstormProjects\'

Solution

  • After a big fight with this, I managed to solve it by exploring the options in PHPStorm Copy Path/Reference menu. I just aligned the two paths and it works.

    In my case, using Windows WSL2, Docker Desktop and Symfony project, my setting had to be similiar to

    FRAMEWORK_IDE='jetbrains://phpstorm/navigate/reference?project=my_project&path=%f:%l&/srv/app/>'
    

    where /srv/app was my project path inside the docker container and after the ">" symbol, I rewrite to nothing. This resolves to:

    jetbrains://phpstorm/navigate/reference?project=my_project&path=src/Controller/OfferingController.php:34
    

    in the symfony debug toolbar.

    I found it easier with the JetBrains Toolbox, because you can reference your project name instead of the strange WSL2 path.