fix: clickable editorUrl
https://github.com/phpstan/phpstan/issues/7796
Tests are now green. But i am not sure how to test in correct in real App.
This is wrong syntax for symfony/console: https://symfony.com/blog/new-in-symfony-4-3-console-hyperlinks
What's the foundation behind your change?
Thanks for the link. Maybe the missing " will already fix the linked issue? Or removing the first "
That's up to you to test :)
I will try. If i run the UnitTest for the particular method it works. But with make tests it fails. So i am a bit confused what the difference is.
If your terminal does not support hyperlinks, they will be rendered as normal and non-clickable text and you won't see their URLs. That's why it's recommended to check out the growing [list of terminal emulators that support hyperlinks](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) before using this feature in your own apps and commands.
This is the reason of the failing in terminals that do not support the links.
This pseudo code would be correct in my eyes if there is a possibility to detect if the actual terminal supports links.
if($console->supportsLinks())
{
$message .= "\n✏️ <href=" . OutputFormatter::escape($url) . ">" . $this->relativePathHelper->getRelativePath($editorFile) . "</>";
}
else {
$message .= "\n✏️ <href=" . OutputFormatter::escape($url) . ">" . OutputFormatter::escape($url) . "</>";
}
But i do not know if it is possible to detect this.
We have a tradeoff here. With the latest version of this PR, ...
- Teminal with Link-Support: The link-Text is now longer (same as Target). Could lead to display-problems
- Teminal without Link-Support: Only Link-Text but now it can be clicked. Could lead to display-problems
There's now editorUrlTitle config option which you can use to fix the clickability: https://phpstan.org/user-guide/output-format#opening-file-in-an-editor