简体   繁体   中英

Open files in PHPStorm with Vagrant+Symfony application

I know you can open files from Symfony profiler or exception file links using this in project/app/config.yml :

framework:
    ide: "phpstorm://open?file=%%f&line=%%l"

More info: http://developer.happyr.com/open-files-in-phpstorm-from-you-symfony-application

However as I'm using vagrant, the file path of the server doesn't match my host.

I have created a PHP web application server in PHPStorm with the propper path mappings, but still doesn't work.

Any ideas?

Thanks

When running your app in a container or in a virtual machine, you can tell Symfony to map files from the guest to the host by changing their prefix. This map should be specified at the end of the URL template, using & and > as guest-to-host separators:

// /path/to/guest/.../file will be opened
// as /path/to/host/.../file on the host
// as /path/to/host/.../file on the host
'phpstorm://%f:%l&/path/to/guest/>/path/to/host/&/foo/>/bar/&...'

Symfony FrameworkBundle Configuration - IDE

The answer given by Jeffry no longer works unfortunately :(. When In configure that with my paths the profiler throws:

ParameterNotFoundException
You have requested a non-existent parameter "f:".

I have configured the path according to this line in the SF docs: This map should be specified at the end of the URL template , which results in this:

phpstorm://open?url=file://%%f&line=%%l&/path/to/guest/>/path/to/host/

However, it does open PHPStorm, but phpstorm does not open the file, so i'm a bit stuck here now.

This solves the issue with the file not opening in PhpStorm from a Vagrant:

phpstorm://open?file=%%f&line=%%l&/path/to/guest/>/path/to/host/

Source: https://youtrack.jetbrains.com/issue/IDEA-65879

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM