ambiorix-web / ambiorix

🖥️ Web framework for R
http://ambiorix.dev
GNU General Public License v3.0
211 stars 9 forks source link

Breakpoints Not Triggering in External Files When Using `box::use` in `ambiorix` #70

Closed nev-awaken closed 1 month ago

nev-awaken commented 2 months ago

Thanks for making this amazing package. I was trying to use box::use in an ambiorix app where it worked correctly in running the application, but I couldn't do the debugging through the VS Code debugger. I had placed breakpoints on different functions in different files, but they are not getting triggered; it just runs through the code and opens up the server in the browser.

> packageVersion("ambiorix")
[1] '2.1.0'
> packageVersion("vscDebugger")
[1] '0.5.3'

Reproducible Example : app.R

box::use(
  ./test_function[hello_world]
)

library(ambiorix)
PORT <- 3000L
localhost  <- "127.0.0.1"

app <- Ambiorix$new()
hello_world()

app$get("/", \(req, res){
  res$send("Using {ambiorix}!")
})

app$get("/about", \(req, res){
  res$text("About")
})

app$start(port = PORT, host = localhost)

test_function.R - in here I have debug placed at print()

#' @export
hello_world <- function(){
    print("hello World")
}

Debug Console Output :

[1] "hello World"
✔ 20-07-2024 21:11:07 Listening on http://127.0.0.1:3000
ℹ 20-07-2024 21:11:07 GET on /
kennedymwavu commented 2 months ago

hi @nev-awaken, this is a good inquiry but the issue is not related to ambiorix. to add breakpoints in R, have a look at ?browser

spirae-nevin commented 1 month ago

Hi @kennedymwavu . Thanks for the info. You can close this now.

nev-awaken commented 1 week ago

https://github.com/ManuelHentschel/VSCode-R-Debugger/issues/188 This solves it temporarily