|
139 | 139 | # * Use a `procsrcref` column for processed source references. |
140 | 140 | # Otherwise testthat (and probably other rlang based packages), will |
141 | 141 | # pick up the `srcref` column, and they expect an `srcref` object there. |
| 142 | +# |
| 143 | +# ### 3.1.0 -- 2022-10-04 |
| 144 | +# |
| 145 | +# * Add ANSI hyperlinks to stack traces, if we have a recent enough |
| 146 | +# cli package that supports this. |
142 | 147 |
|
143 | 148 | err <- local({ |
144 | 149 |
|
@@ -816,12 +821,18 @@ err <- local({ |
816 | 821 | if (is.null(ref)) return("") |
817 | 822 |
|
818 | 823 | link <- if (ref$file != "") { |
819 | | - cli::style_hyperlink( |
820 | | - cli::format_inline("{basename(ref$file)}:{ref$line}:{ref$col}"), |
821 | | - paste0("file://", ref$file), |
822 | | - params = c(line = ref$line, col = ref$col) |
823 | | - ) |
824 | | - |
| 824 | + if (Sys.getenv("R_CLI_HYPERLINK_STYLE") == "iterm") { |
| 825 | + cli::style_hyperlink( |
| 826 | + cli::format_inline("{basename(ref$file)}:{ref$line}:{ref$col}"), |
| 827 | + paste0("file://", ref$file, "#", ref$line, ":", ref$col) |
| 828 | + ) |
| 829 | + } else { |
| 830 | + cli::style_hyperlink( |
| 831 | + cli::format_inline("{basename(ref$file)}:{ref$line}:{ref$col}"), |
| 832 | + paste0("file://", ref$file), |
| 833 | + params = c(line = ref$line, col = ref$col) |
| 834 | + ) |
| 835 | + } |
825 | 836 | } else { |
826 | 837 | paste0("line ", ref$line) |
827 | 838 | } |
|
0 commit comments