Reputation: 3384
Is there any way to debug Shiny (R) inside VS Code? I can easily debug Shiny apps inside RStudio but I like to code inside VS Code so looking for the way to debug R code inside VS Code.
Upvotes: 8
Views: 3838
Reputation: 115
I was not able to see plots or html (e.g. from plotly) when in debugging mode. I already had "httpgd" as plotting device enabled. The option says it also changes the corresponding R option vsc.use_httpgd
, but I checked it was NULL
. Setting it explicitly in my .Rprofile
or also live in the debugging session allowed me to see plots again, e.g. via print(plot(1:5))
.
# For your .Rprofile
options("vsc.use_httpgd" = TRUE)
# code to check if option is set
getOption("vsc.use_httpgd")
Upvotes: 0
Reputation: 51
Seems, shiny can be debugged in VSCode using browser
-statements 🙌
Prerequisites
appDir
when running ?shiny::runApp
for possible setups)Debugging
browser()
(RStudio Article)shiny::runApp()
in the Debug Console as soon the Debugger pausesFurther Ressources
Upvotes: 3