2

I recently have encountered an issue in debugging package code in RStudio. Suppose I have a function in source file, say foo.R, and set a breakpoint in the body of that function. Then when I run something in the console that reaches that breakpoint, a second copy of foo.R shows up in the code panel, and it pops to the foreground. The line where I had set the breakpoint is highlighted in the new view, but the red dot shows up in the first copy. This is driving me crazy because it happens with every single source file and makes a mess out of my code window.

Moreover, if I make changes in the first copy of the file, rebuild, and don't close the debug copy, then the changes are not shown in the debug copy if I still have active breakpoints. This is very confusing.

Here's an illustration of what I see after I entered a call. The first version of the file has the red dot; and you can see the tab for the second copy:

code window 1

The second copy of the file is where debugging is displayed:

code window 2

And this is what I had entered in the console:

console command

I had the idea that this might v\have something to do with its immediately going from Browse[1] to Browse[2]. However, I tried debuggingState(on = FALSE) and that doesn't make a difference.

This is not a bug I am able to reproduce. If I switch to a different project, this doesn't happen. It's apparently some setting in my project that got messed-up.

Russ Lenth
  • 5,922
  • 2
  • 13
  • 21
  • PS. Yes, I have tried a bunch of things: I have stopped and restarted R; I have rebooted; I have disabled and then re-enabled `--with-keep-source`; I have detached and installed an old version from CRAN, then rebuilt. – Russ Lenth Jul 23 '20 at 19:07

1 Answers1

0

I figured this out. My setup maps a drive letter H: to a path I treat as my home directory. That means there are two different versions of the file path for any file in that mapped directory. The duplicate files were created in the other version of its path. I re-loaded the project from the path it wanted to use, and that solves the problem!

Russ Lenth
  • 5,922
  • 2
  • 13
  • 21