r-lib / rlang

Low-level API for programming with R
https://rlang.r-lib.org
Other
507 stars 139 forks source link

Support warning backtraces in Rmd documents #1557

Closed lionel- closed 1 year ago

lionel- commented 1 year ago
lionel- commented 1 year ago

Last commit fixes last_warnings() support.

@jennybc this might be useful to include in reprex as well to get warning backtraces?

jennybc commented 1 year ago

So you're saying I should add rlang_backtrace_on_warning_report = "full" to the options being set here (?):

https://github.com/tidyverse/reprex/blob/77ec1f612ea3d94534d6b37336a45f2d2957f3b2/R/reprex_document.R#L136-L141

And perhaps add rlang::global_entrace() before the options() call?

lionel- commented 1 year ago

So you're saying I should add rlang_backtrace_on_warning_report = "full" to the options being set here (?):

Exactly.

And perhaps add rlang::global_entrace() before the options() call?

Yes this is necessary for the global option above to have any effect. Also this will enable backtraces for base errors, if I'm not mistaken they're currently only shown for rlang errors.

lionel- commented 1 year ago

@hadley now rebased