首页 > 解决方案 > PhpStorm 不通过 xdebug.file_link_format 打开文件

问题描述

PhpStorm 不通过 xdebug.file_link_format 打开文件。

我尝试了不同的格式,但仍然无法正常工作。我在新标签中打开链接,没有任何反应。路径在地址栏中写入正确

xdebug.file_link_format = "phpstorm://open?file=%f&line=%l"

标签: phpphpstorm

解决方案


我创建了自己的协议和自定义程序来在 phpstorm 中打开文件

myproto.reg:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\myproto]
@="phpstorm"
"URL Protocol"=""

[HKEY_CURRENT_USER\Software\Classes\myproto\shell]

[HKEY_CURRENT_USER\Software\Classes\myproto\shell\open]

[HKEY_CURRENT_USER\Software\Classes\myproto\shell\open\command]
@="\"C:\\Program Files\\nodejs\\node.exe\" \"C:\\Users\\Alexander\\Desktop\\web\\ahk\\phpstorm.js\" \"%1\""

phpstorm.js:

const child_process = require('child_process');
const fs = require('fs')

let path = process.argv[2]
path = path.replace('myproto://','')
path = decodeURIComponent(path)
path = path.replace(/\/$/,'')

ls = child_process.exec('"C:\\Program Files\\JetBrains\\PhpStorm 2019.1.1\\bin\\phpstorm64.exe" ' + path + '')

php.ini:

xdebug.file_link_format = "myproto://%f:%l"

推荐阅读