-
-
Save shushanxingzhe/fd36f70b85581a5e8315b2aa7978cfc8 to your computer and use it in GitHub Desktop.
PhpStorm Protocol (Win)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
'modules' => [ | |
'debug' => [ | |
'class' => 'yii\debug\Module', | |
'traceLink' => function ($trace) { | |
$path = str_replace('/srv/www/myproject/', 'D:\\www\\myproject\\', $trace['file']); | |
return '<a href="phpstorm://open?url=file://' . $path . '&line=' . $trace['line'] . '">' . $path . ':' . $trace['line'] . '</a>'; | |
}, | |
] | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var settings = { | |
// Set to window title (only text after dash sign), that you see, when switching to running PhpStorm instance | |
window_title: 'PhpStorm', | |
// In case your file is mapped via a network share and paths do not match. | |
// eg. /var/www will can replaced with Y:/ | |
projects_basepath: '/app/', | |
projects_path_alias: 'D:\\www\\' | |
}; | |
// don't change anything below this line, unless you know what you're doing | |
var url = WScript.Arguments(0), | |
match = /^ide:\/\/open\/\?(url=file:\/\/|file=)(.+)&line=(\d+)$/.exec(url), | |
project = ''; | |
if (match) { | |
var shell = new ActiveXObject('WScript.Shell'), | |
file_system = new ActiveXObject('Scripting.FileSystemObject'), | |
file = decodeURIComponent(match[2]).replace(/\+/g, ' '), | |
search_path = file.replace(/\//g, '\\'), | |
link = shell.CreateShortcut('C:\\Users\\Public\\Desktop\\phpstorm.lnk'), | |
editor = link.TargetPath; | |
if (settings.projects_basepath != '' && settings.projects_path_alias != '') { | |
file = file.replace(new RegExp('^' + settings.projects_basepath), settings.projects_path_alias); | |
} | |
while (search_path.lastIndexOf('\\') != -1) { | |
search_path = search_path.substring(0, search_path.lastIndexOf('\\')); | |
if (file_system.FileExists(search_path + '\\.idea\\.name')) { | |
project = search_path; | |
break; | |
} | |
} | |
if (project != '') { | |
editor += ' "%project%"'; | |
} | |
editor += ' --line %line% "%file%"'; | |
var command = editor.replace(/%line%/g, match[3]) | |
.replace(/%file%/g, file) | |
.replace(/%project%/g, project) | |
.replace(/\//g, '\\'); | |
//WScript.Echo(command); | |
shell.Exec(command); | |
shell.AppActivate(settings.window_title); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REGEDIT4 | |
[HKEY_CLASSES_ROOT\phpstorm] | |
@="URL:phpstorm Protocol" | |
"URL Protocol"="" | |
[HKEY_CLASSES_ROOT\phpstorm\shell\open\command] | |
@="wscript \"C:\\Program Files\\PhpStorm Protocol (Win)\\run_editor.js\" \"%1\"" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment