-
Notifications
You must be signed in to change notification settings - Fork 126
Closed
Labels
area: kernelsIssues related to Jupyter kernels and LSP serversIssues related to Jupyter kernels and LSP serverslang: r
Milestone
Description
For example, when you hit the force(x) line, it exits debug mode even though we clearly are still in it:
fn <- function(x = if (1) 2 else 3) {
1 + 1
force(x)
2 + 2
3 + 3
}
debugonce(fn)
fn()Screen.Recording.2024-02-22.at.10.46.17.AM.mov
Another example is with tryCatch()
eval(parse(text = "fn <- function() {
tryCatch(
{
1 + 1
2 + 2
3 + 3
}
)
}", keep.source = FALSE))
debugonce(fn)
fn()and really anything that adds frames to the intermediate stack
tryCatchLike <- function(expr) {
onTheStack <- function(expr) {
expr
}
onTheStack(expr)
}
eval(parse(text = "fn <- function() {
tryCatchLike(
{
1 + 1
2 + 2
3 + 3
}
)
}
", keep.source = FALSE))
debugonce(fn)
fn()I did a little digging, and I think this bit of prompt_info() isn't working right
In the case of the tryCatch, there are 3 frames on the stack at the time when we erroneously exited debug mode, which looked like:
i.e. note that frame 3 is actually from the try-catch, not our code, so its environment doesn't have RDEBUG() set. So this heuristic is probably not quite right!
I'm not entirely sure what the right fix is here, so I'll probably have to rely on @lionel- for this one
Metadata
Metadata
Assignees
Labels
area: kernelsIssues related to Jupyter kernels and LSP serversIssues related to Jupyter kernels and LSP serverslang: r
