r-lib / styler

Non-invasive pretty printing of R code
https://styler.r-lib.org
Other
725 stars 71 forks source link

FR: Clickable links in CLI output #1116

Open olivroy opened 1 year ago

olivroy commented 1 year ago

I was wondering if it would be possible to have a clickable link to a styler error, using cli.

cli::cli_text("{.file file.R:2}")

Creates a link to file.R at line 2. https://cli.r-lib.org/reference/links.html?q=file%20lin#line-and-column-numbers

It could be quite handy for a large file

lorenzwalthert commented 1 year ago

I agree this would be handy. Also in the ouptut of style_pkg() and the like, where all files are enumerated. Even more generally, having clickable output might be desirable, e.g. also in styler:::ask_to_switch_to_non_default_cache_root_impl()'s output (to help file) and others. Contributions welcome.

olivroy commented 1 year ago

Hi,

I would like to contribute, but I don't really know how. I started looking at styler's source code and CONTRIBUTING.

meanwhile, I opened a PR with cosmetic changes to code (#1122), but nothing significant done.