In many places in RStudio packages, rstudoapi::isAvailable() is used as a quick way to check if the user is running RStudio. This creates issues for VSCode where the rstudioapi is partially supported.
In some cases the use of rstudioapi::hasFun could be used instead to see if the desired functionality, rather than the RStudio IDE is present. Here is an example where that might make sense: https://github.com/r-lib/usethis/issues/1455
I expect in some cases that won't make sense and the rstudioapi may need some kind of isRStudio() function? Although I am little worried introducing something may lead to that being over used and unnecessarily lock VSCode users out of functionality.
Perhaps there needs to be some kind of API style-guide put together that talks about applying the minimally restrictive check? I'd be happy to contribute.
In many places in RStudio packages,
rstudoapi::isAvailable()
is used as a quick way to check if the user is running RStudio. This creates issues for VSCode where therstudioapi
is partially supported.In some cases the use of
rstudioapi::hasFun
could be used instead to see if the desired functionality, rather than the RStudio IDE is present. Here is an example where that might make sense: https://github.com/r-lib/usethis/issues/1455I expect in some cases that won't make sense and the
rstudioapi
may need some kind ofisRStudio()
function? Although I am little worried introducing something may lead to that being over used and unnecessarily lock VSCode users out of functionality.Perhaps there needs to be some kind of API style-guide put together that talks about applying the minimally restrictive check? I'd be happy to contribute.