使用 Vagrant+Symfony 应用程序在 PHPStorm 中打开文件
Open files in PHPStorm with Vagrant+Symfony application
我知道您可以在 project/app/config.yml
中使用它从 Symfony 探查器或异常文件链接打开文件:
framework:
ide: "phpstorm://open?file=%%f&line=%%l"
更多信息:http://developer.happyr.com/open-files-in-phpstorm-from-you-symfony-application
然而,由于我使用的是 vagrant,因此服务器的文件路径与我的主机不匹配。
我已经使用正确的路径映射在 PHPStorm 中创建了一个 PHP Web 应用程序服务器,但仍然无法正常工作。
有什么想法吗?
谢谢
当运行您的应用程序在容器或虚拟机中时,您可以告诉 Symfony 通过更改前缀将文件从来宾映射到主机。此映射应在 URL 模板的末尾指定,使用 & 和 > 作为来宾到主机的分隔符:
// /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/&...'
不幸的是,Jeffry 给出的答案不再有效:(。当使用我的路径配置时,探查器会抛出:
ParameterNotFoundException
You have requested a non-existent parameter "f:".
我已经根据 SF 文档中的这一行配置了路径:This map should be specified at the end of the URL template
,结果是:
phpstorm://open?url=file://%%f&line=%%l&/path/to/guest/>/path/to/host/
然而,它确实打开了 PHPStorm,但是 phpstorm 没有打开文件,所以我现在有点卡在这里。
这解决了无法从 Vagrant 在 PhpStorm 中打开文件的问题:
phpstorm://open?file=%%f&line=%%l&/path/to/guest/>/path/to/host/
我知道您可以在 project/app/config.yml
中使用它从 Symfony 探查器或异常文件链接打开文件:
framework:
ide: "phpstorm://open?file=%%f&line=%%l"
更多信息:http://developer.happyr.com/open-files-in-phpstorm-from-you-symfony-application
然而,由于我使用的是 vagrant,因此服务器的文件路径与我的主机不匹配。
我已经使用正确的路径映射在 PHPStorm 中创建了一个 PHP Web 应用程序服务器,但仍然无法正常工作。
有什么想法吗?
谢谢
当运行您的应用程序在容器或虚拟机中时,您可以告诉 Symfony 通过更改前缀将文件从来宾映射到主机。此映射应在 URL 模板的末尾指定,使用 & 和 > 作为来宾到主机的分隔符:
// /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/&...'
不幸的是,Jeffry 给出的答案不再有效:(。当使用我的路径配置时,探查器会抛出:
ParameterNotFoundException
You have requested a non-existent parameter "f:".
我已经根据 SF 文档中的这一行配置了路径:This map should be specified at the end of the URL template
,结果是:
phpstorm://open?url=file://%%f&line=%%l&/path/to/guest/>/path/to/host/
然而,它确实打开了 PHPStorm,但是 phpstorm 没有打开文件,所以我现在有点卡在这里。
这解决了无法从 Vagrant 在 PhpStorm 中打开文件的问题:
phpstorm://open?file=%%f&line=%%l&/path/to/guest/>/path/to/host/