dotnetic Posted October 11, 2019 Share Posted October 11, 2019 Update August 2022: There finally now is a native way of opening the correct file, if tracy throws an error. You have to use Jetbrains Toolbox for this to work. Go to tracy's 'Editor links' setting and in the input write this, and replace projectname with the PHPStorms project name: jetbrains://php-storm/navigate/reference?project={projectname}&path=%file:%line Also if you are using a folder structure, where the PW installation lies not in the root, then you want to modify the "Local root path" setting in Tracy. Here is an example of my settings: Original post from 2019 Tracy Debugger offers an Editor protocol handler link so you can jump directly to a file from a Tracy Debugger dump message. Unfortunately this does not work on Windows, as the URI protocol handler isn't implemented in the Windows version (see link). However, all IDEA products (IntelliJ, PHPStorm, etc.) provide a REST API from which you can open files. The syntax is http://localhost:63342/api/file//absolute/path/to/file.kt for absolute pathnames (please note the double backslash behind "file") and http://localhost:63342/api/file/relative/to/module/root/path/to/file.kt for relative filenames. To use this, you have to set up Tracy with the following parameter: http://localhost:63342/api/file/%file:%line:0 If you click on a link now in Tracy, PHPStorm will focus and ask for permission to open the file. ATTENTION: PHPStorm has to be opened and also your project has to be opened (so PHPStorm knows the root for relative path). This is a little bit cumbersome, but better than nothing. Ping @adrian to bring this to your attention. 1 Link to comment Share on other sites More sharing options...
dragan Posted October 11, 2019 Share Posted October 11, 2019 @Jens Martsch - dotnetic Awesome! Pinging @adrian ? Link to comment Share on other sites More sharing options...
adrian Posted October 11, 2019 Share Posted October 11, 2019 Hey guys - just wondering if you have read this page: https://tracy.nette.org/en/open-files-in-ide Does that help at all? What do you guys need me to do (if anything) to get things working more easily within Tracy? Link to comment Share on other sites More sharing options...
dotnetic Posted October 11, 2019 Author Share Posted October 11, 2019 @adrian The solution you linked to could work (not tested), I found a similar script that I tried, that didn't work. But the script utilizes the Windows Scripting host and requires you to put the path in the .js file, which is a detour. My solution provides a native way. Not saying, that this is the correct way, but one more way. You could add the syntax with a comment "For Windows and PHPStorm use the following syntax" to Tracy's settings. I think, this could help some people. Link to comment Share on other sites More sharing options...
adrian Posted October 12, 2019 Share Posted October 12, 2019 Thanks @Jens Martsch - dotnetic - I just want to ping a few other Windows users: @Robin S @bernhard @tpr to get their experience with this. Link to comment Share on other sites More sharing options...
bernhard Posted October 12, 2019 Share Posted October 12, 2019 I'm not using PHPStorm, I'm using VSCode and it just works. I think I had to install this once: https://github.com/shengyou/vscode-handler This one is linked in that document: https://github.com/aik099/PhpStormProtocol And I just found this one linked there as well ? https://github.com/recca0120/laravel-tracy 1 Link to comment Share on other sites More sharing options...
dotnetic Posted October 12, 2019 Author Share Posted October 12, 2019 I also tried Nette's solution and it does work on Windows 10 (but with different paths, as I am Using Jetbrains Toolbox to install PHPStorm), there is an alert before opening the file. After clicking ok, its working fine, but I have to focus PHPStorm manually, as the title of the window is always different, depending on which file you have opened. Link to comment Share on other sites More sharing options...
dotnetic Posted October 12, 2019 Author Share Posted October 12, 2019 @bernhard The first solutions you provided does the same as Nette's script. Link to comment Share on other sites More sharing options...
bernhard Posted October 12, 2019 Share Posted October 12, 2019 My links where not meant to be solutions. Just shared my quick research. I'm happy with tracy + vscode and can't reproduce your problems ? Ever thought of switching to VSCode? *scnr ? Link to comment Share on other sites More sharing options...
dotnetic Posted October 12, 2019 Author Share Posted October 12, 2019 Yeah thought often about it, but PHPStorm offers me features that VScode does not have (yet) or are not that comfortable and that are important for me. And I don't switch my editor/IDE just because of this small issue. 1 Link to comment Share on other sites More sharing options...
adrian Posted October 12, 2019 Share Posted October 12, 2019 17 hours ago, Jens Martsch - dotnetic said: You could add the syntax with a comment "For Windows and PHPStorm use the following syntax" to Tracy's settings. I think, this could help some people. I think rather than using that custom syntax, it maybe makes more sense to install the protocol handler that @bernhard linked to. Actually, I just noticed that in the Tracy settings I was linking to a protocol handler for PHPStorm, but it was Linux only, so I have linked to the one bernhard mentioned instead. Link to comment Share on other sites More sharing options...
dotnetic Posted October 12, 2019 Author Share Posted October 12, 2019 It is up to you Adrian, but my solution is a native one and the other one is a hacky solution which also requires modifiying the .js file. Link to comment Share on other sites More sharing options...
adrian Posted October 12, 2019 Share Posted October 12, 2019 6 minutes ago, Jens Martsch - dotnetic said: It is up to you Adrian, but my solution is a native one and the other one is a hacky solution which also requires modifiying the .js file. Do you still need to modify the js file if you install https://github.com/aik099/PhpStormProtocol ? Link to comment Share on other sites More sharing options...
dotnetic Posted October 12, 2019 Author Share Posted October 12, 2019 9 minutes ago, adrian said: Do you still need to modify the js file if you install https://github.com/aik099/PhpStormProtocol ? Yes. If you look into the file https://github.com/aik099/PhpStormProtocol/blob/master/PhpStorm Protocol (Win)/run_editor.js there are two variables you have to change and if you are using Jetbrain Toolbox to install and update your IDE, then even the paths in https://github.com/aik099/PhpStormProtocol/blob/master/PhpStorm Protocol (Win)/run_editor.js#L22 are completely different. 1 Link to comment Share on other sites More sharing options...
adrian Posted October 12, 2019 Share Posted October 12, 2019 Thanks for the explanation @Jens Martsch - dotnetic - I wonder if you'd be willing to submit a PR with changes to https://github.com/adrianbj/TracyDebugger/blob/master/docs/configuration.md that detail your approach? Thanks, Adrian 1 Link to comment Share on other sites More sharing options...
Robin S Posted October 13, 2019 Share Posted October 13, 2019 21 hours ago, adrian said: I just want to ping a few other Windows users: @Robin S @bernhard @tpr to get their experience with this. All good if another way is added to open files in PhpStorm, but I use the editor:// protocol with PhpStorm and never had any problem with it. It's been a long time since I set it up but I expect I followed the PhpStorm docs and I don't remember it being difficult. 2 Link to comment Share on other sites More sharing options...
horst Posted October 13, 2019 Share Posted October 13, 2019 @Jens Martsch - dotnetic, I had set it up some years ago under win7 with a (sort of) proxy batchfile. It is a single file, that I pointed the modules default protocol settings to. Don't know if this can be of help for you, as I hadn't read all the posts here. But here is the windows batchfile that I use(d): @GOTO START <?php $editor = "C:\\Program Files\\NuSphere\\PhpED\\phped.exe"; if($argc > 1) $url = $argv[1]; list($file, $line) = explode('&line=', str_replace(array('editor://open/?url=file://', ''), '', urldecode($url))); if(is_file($file)) { exec("\"$editor\" \"$file\" --line=$line"); } exit(0); ?> EXIT :START @ECHO OFF SET PHP=C:\php\php.exe %PHP% "%0" %* EXIT Short explanation: the batch script (maybe named something like "tracyopener.bat", located somewhere in the system path) is called with the tracy default params for file & line. the first line tells the win batch interpreter to skip the PHP section and start at the line where the php exe is defined the next line calls the PHP interpreter, passes the own script to it "%0", followed by all other params "%*", what is an alias for %1 - %9 when the PHP interpreter processes the script, the first line is interpreted as HTML or text output and therefor ignored. the next lines get and prepare the passed params for usage with my preferred editor NuSphere PhpEd, using the exec() function. 1 Link to comment Share on other sites More sharing options...
dotnetic Posted October 13, 2019 Author Share Posted October 13, 2019 Hey @horst Your solution is very similar how scripts like https://github.com/aik099/PhpStormProtocol work. As mentioned before this is a workaround and a hacky way, and my solution provides a native alternative which works. I am not searching for another hacky solution, I just wanted to provide a native way of handling URI schemes in Tracy Debuger Link to comment Share on other sites More sharing options...
dotnetic Posted August 19, 2022 Author Share Posted August 19, 2022 Update August 2022: There finally now is a native way of opening the correct file and line, if tracy throws an error. Please see the updated first post. Link to comment Share on other sites More sharing options...
Recommended Posts