Ansi Links capability detection is not very precise
See original GitHub issueIs your feature request related to a problem? Please describe.
Currently as far as I could determine Ansi link support is determined by checking if a terminal supports Ansi, and the terminal is not cmd.exe
(basically what it comes down to I think) or has link support disabled explicitly through an Enhancer. There are as far as I can tell a lot of terminal emulators that support for example Ansi colours but not Ansi links (powershell, visual studio developer terminal, visual studio debugger console). I believe this combination can mean that if you use the capability check to decide if you can pretty-print a uri on a given terminal that you can end up printing something entirely unusable to the user, because the terminal cannot interpret the uri portion of the link and only prints the text portion. To be safe I think I should choosing to always print the full uri as the link text, which kinda defeats the purpose of using Ansi links to pretty print in the first place.
Describe the solution you’d like The capability detection should determine whether or not the terminal in question actually supports Ansi links, not just that it supports Ansi.
Additional context I know a library for the npm ecosystem that tries to do this, it involves sometimes specific checks for specific terminals or environments. This might be too much of a maintenance headache but at least they provide a starting point/shared codebase. See: https://github.com/jamestalmage/supports-hyperlinks
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
There currently is no standardized way of detecting this capability, so we just make assumptions. We’re happy to update the rules for this if you have any concrete suggestions.
@patriksvensson until there is a way to detect ansi link support we have the workaround of printing the link path as the link text. This is what we had before anyway so it is acceptable. It would be nice if some day there would be a way to detect this so we can make it prettier.
Would you know of a place where I could suggest something like this? So far it seems like the ansi link feature comes entirely from one user with a gist on GitHub who’s been pushing for support at well known terminal maintainers…