Highlight hyperlinks in Command Line Tools output

Answered

I am using Command Line Tools Support feature to execute commands like Composer and Symfony console. The output spits out something like this:

Autowirable Types
=================

The following classes & interfaces can be used as type-hints when autowiring:

]8;;phpstorm://open?file=/Users/andrey/Sites/classic-at-home/vendor/contao/core-bundle/src/Config/ResourceFinderInterface.php&line=17\Contao\CoreBundle\Config\ResourceFinderInterface]8;;\ (contao.resource_finder)

]8;;phpstorm://open?file=/Users/andrey/Sites/classic-at-home/vendor/contao/core-bundle/src/Framework/ContaoFramework.php&line=42\Contao\CoreBundle\Framework\ContaoFramework]8;;\ (contao.framework)

]8;;phpstorm://open?file=/Users/andrey/Sites/classic-at-home/vendor/contao/core-bundle/src/Framework/ContaoFrameworkInterface.php&line=19\Contao\CoreBundle\Framework\ContaoFrameworkInterface]8;;\ (contao.framework)

]8;;phpstorm://open?file=/Users/andrey/Sites/classic-at-home/vendor/contao/core-bundle/src/Image/ImageFactoryInterface.php&line=20\Contao\CoreBundle\Image\ImageFactoryInterface]8;;\ (contao.image.image_factory)

I would like to either make those ugly "]8;;phpstorm://open?file="  lines into real clickable links or just get rid of them completely and have the original output, intended by the command, which should look like this:

Autowirable Types
=================

The following classes & interfaces can be used as type-hints when autowiring:

Contao\CoreBundle\Config\ResourceFinderInterface (contao.resource_finder)

Contao\CoreBundle\Framework\ContaoFramework (contao.framework)

Contao\CoreBundle\Framework\ContaoFrameworkInterface (contao.framework)

 

Is there a way to achieve this in PHPStorm 2021.2.3?

0
9 comments

We would need to check that on our end. What tool & command were you using? What symfony version is it?

0

To be precise, I am using Contao CMS, which is a framework built on top of Symfony and has its own console which an extended version of Symfony's console; in my original example it's Symfony 5.3, and I tested "console debug:autowiring" and "console debug:router".

For the sake of experiment I went ahead and try that on pure Symfony project (v5.2.6), the results are identical.

The tool I set up is Symfony's console. I also tried running the same commands from built-in terminal. Here's what I found:

Symfony's console produces "]8;;phpstorm://open?file=" text on Command Line Tools output, and just colored plain text Class FQNs in built-in terminal (which is a default behaviour of the command in a regular terminal).

 

0

Hm, both on Win & Mac I'm not getting these kind of links:

 

Checked that on a demo symfony 5.3 app. I might be missing some package that does it for you. Is it possible to share a project that reproduces the issue for you that I can also check out & test?

0

Your Win screenshot shows output from Command Line Tools Support, but your Mac screenshot is built-in terminal. As I pointed out, the built-in terminal works fine, the problem I'm having is with Command Line Tools output. (sorry I forgot to mention I'm on a Mac, although you've probably inferred that from paths:)

0

Sure, here's one from Com line tools support on Mac:

Same behavior, unfortunately

 

0

I just tried it with a fresh Symfony 5.3 demo project, and unfortunately, I still have the problem. Something is obviously messed up with my IDE settings, but it's not clear, what should I tweak... The only one that hints on it is "Highlight hyperlinks", but it does not do anything for me (no effect).

0

I'll attach a screenshot this time:

0

Ok, I figured it out, it was Xdebug producing those links, sorry😅

Xdebug has "xdebug.file_link_format" setting in php.ini, and it has somehow slipped to my php-cli.ini. After I commented that line in php-cli.ini, the problem resolved itself.

Update: at first, it got resolved for the demo app, but not for my project, until I found that I have an overriding setting in my Symfony config:

I removed this line and finally, it works.

Thanks for helping me to resolve the issue!

1

Thanks for sharing this with us! That's really helpful!

0

Please sign in to leave a comment.