VSCode-R-Debugger icon indicating copy to clipboard operation
VSCode-R-Debugger copied to clipboard

Enhancement when set a break point at blank line

Open xiajunwen1007 opened this issue 3 years ago • 2 comments

Describe the enhancement When I set a breakpoint at the line with no command, the R debugger would automatically run the following lines with commands. For example, set a breakpoint at the blank line before K=1 with the following code. A gif will be posted to show this.

fo <- function(x){
    x + K
}

bar <- function(x,y){
    fo(x + y)
}

K=1
print(bar(1, 2))

屏幕录制2021-08-08 下午1 32 42

xiajunwen1007 avatar Aug 08 '21 05:08 xiajunwen1007

Thanks for raising this issue.

To an extent, this is intended, since stopping at an empty line might be a bit confusing (since nothing would happen if you click "Step Over (F10)").

Apparently, the python extension handles this by moving the breakpoint to the previous (non-empty) line. Something like this should be possible here. Is this the behaviour you would expect?

Also, note that a breakpoint always pauses the execution before running the specified line of code, so in your example you could safely set the breakpoint in line 9.

ManuelHentschel avatar Aug 19 '21 07:08 ManuelHentschel

Rstudio handles this by moving the breakpoint to the next (non-empty) line. I prefer this as well. But it is ok to follow the python extension.

xiajunwen1007 avatar Aug 19 '21 12:08 xiajunwen1007