r-lib / cli

Tools for making beautiful & useful command line interfaces
https://cli.r-lib.org/
Other
654 stars 70 forks source link

Fix #621 #733

Closed TimTaylor closed 1 month ago

TimTaylor commented 1 month ago

This commit conditions on the presence of rstudioapi 0.17.0. If satisfied then use the new getMode() function (https://github.com/rstudio/rstudioapi/releases/tag/v0.17.0). Otherwise maintain the old behaviour.

Printing of a slowish ~data frame~ tibble in RStudio improved from ~18 seconds, to ~3 seconds with this commit and rstudioapi v0.17.0.

gaborcsardi commented 1 month ago

Thanks! Please see the comment above.

gaborcsardi commented 1 month ago

Thanks! getNamespaceVersion() still returns a string, so you still need to call package_version() on its return value to compare it as a version number:

❯ getNamespaceVersion(asNamespace("rstudioapi"))
 version
"0.16.0"

❯ getNamespaceVersion(asNamespace("rstudioapi")) > "0.16-1"
version
   TRUE

❯ package_version(getNamespaceVersion(asNamespace("rstudioapi"))) > "0.16-1"
[1] FALSE
TimTaylor commented 1 month ago

Cheers for your patience. I'm a doughnut! (I was sure I'd checked it returned a numeric_version). Now fixed (I hope)

gaborcsardi commented 1 month ago

Thank you!