Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using base::browser() to debug and develop (shiny) #10011

Open
aha-incom opened this issue Oct 27, 2021 · 1 comment
Open

Using base::browser() to debug and develop (shiny) #10011

aha-incom opened this issue Oct 27, 2021 · 1 comment

Comments

@aha-incom
Copy link

aha-incom commented Oct 27, 2021

Hi. I've found base::browser() extremely useful when developing (also debugging) shiny-apps.
I often use browser() inside a shiny::moduleServer() to develop further as this allows me to have all of the environment variables coming from input and other reactives very quickly (Working extremely well with shiny::reactiveConsole(TRUE)).
However, when writing something in console or either run some code the browser() functionality keeps sending me to a temporary file with message in top: "Debug location is approximate because the source is not available".

Is there any way to disable this behavior or maybe I've missed out on a similar functionality that is build for this

I've tried to create a reprex below:

char_names <- 
  c("run1",
    "run2",
    "run3",
    "run4")

purrr::map(char_names, .f = function(.x) {
  base::browser()
  paste(.x, "some more text .....")
})

I've originally created the post here: https://community.rstudio.com/t/using-base-browser-to-debug-and-develop/117938 but was encouraged to open a feature request here on GitHub. The problem is also restated by user huitzi with a video.

I'm using RStudio version ‘2021.9.0.351’ with this session info: (It seems like the base::browser() behavior is different on older versions of RStudio)
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

@jfunction
Copy link

Upvote - a bit disorienting to examine state and test new code I'm adding when I keep being taken back to the browser statement in another tab. Usually I move the observed function tab (one created when browser() is hit) to the left of the tab with code I'm editing then do ctrl+tab whenever this happens. Maybe there's a way to turn the auto-navigation off temporarily?

@mikebessuille mikebessuille modified the milestones: Future-4, Later Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants