1

Currently the only way to debug in RTVS is to first attach the debugger and then source the file, as shown in this official manual. However, this is rather inconvenient, since my script usually expands to hundreds of lines and it will take forever for the debugger to execute to the breakpoint, which usually at the last of the script.

The only workaround I can come up with now is to comment all the above lines before the codes of interests. But, is there any elegant way to achieve that?

R. Zhu
  • 415
  • 4
  • 16
  • As the official doc demonstrated, so far that's how VS debug R at present, not an expert on R, you want to speed up executing it while debugging? – Fletcher Jan 29 '18 at 10:06
  • @FletchZhou-MSFT Thanks for the clarification. I was just looking for a way to debug certain lines of R code without sourcing the whole file, now it seems I have to comment all the unrelated lines before sourcing the script. – R. Zhu Jan 30 '18 at 10:43
  • Sorry about the convenience, so far we still have to debug it with the source file, maybe only commenting out the lines above could work a litter faster, as you mentioned in your post. I've posted the reply below to your question by giving an negative answer.And of course, I'll let you know if there is a matched feature integrated in VS on day. – Fletcher Feb 02 '18 at 06:25

1 Answers1

0

So far there is no shortcut for it yet, to debug the certain line in R, we still have to launch the debugger with the code in script.R by either selecting the Source startup file button on the toolbar, selecting the Debug > Source startup file menu items, or pressing F5. Visual Studio enters its debugging mode and starts running the code. It stops on the line where you set the breakpoint:

https://learn.microsoft.com/en-us/visualstudio/rtvs/getting-started-with-r#debugging-your-code

Fletcher
  • 422
  • 1
  • 6
  • 21