Positron IDE Debugger for R Demo with Nested Functions (Public Beta)

TheCoatlessProfessor
TheCoatlessProfessor
775 بار بازدید - 2 ماه پیش - Timeline ---
Timeline ---

00:00 Introduction: Discussing Positron's debugging capabilities.
00:05 Overview: Demonstrating a debugging function script with nested calls (F, G, and H functions).
00:16 Running the Script: Calling function F with argument -4 and running the script by pressing the run button or using the keyboard shortcut Cmd + Shift + S (macOS) or Cntrl + Shift + S (Windows).
00:17 Error Message: Script is sourced automatically, showing error and warning messages.
00:25 Traceback: Viewing an expandable traceback message.
00:32 Navigating Traceback: Jumping through different parts of the script (lines 17, 2, and 6).
00:53 Debugger Engagement: Engaging the debugger with debugonce() command on the top-level function f().
01:00 Debugging Bar: Debugging bar opens, showing variable values and call stack.
01:18 Disconnecting Debugger: Disconnecting the debugger using disconnect button or Q command.
01:30 Run and Debug Prompt Issue: Not able to restart the debugger via Run and Debug. GitHub issue ticket filed, thanks lionel.
01:57 Switching Functions: Switching focus from function f() to h() and rerunning the script.
02:11 Multiple Functions: Viewing multiple functions in the environment.
02:23 Step Over Command: Using step over (n) to move to the next computation.
02:47 Computing Value: Computing log of x, resulting in not a number (NaN) due to negative input.
03:00 Error Check: Running a check statement and viewing the error trace.
03:10 Conclusion: Summarizing the usefulness of the debugger and closing the video.

Summary ---

We explore in this video how the R debugger works in the Positron IDE (Public Beta) by Posit.

In short, it primarily uses `browser()` and has support for `traceback()`. When the error occurs, Positron flashes red on the status bar. You need to engage the browser either using `browser()` or `debug()`/`debugonce()` to enter into a special environment .

When compared to RStudio, one missing feature is breakpoints or being able to set a line of code by clicking on the left side of the line number in the script.

Links ---

GitHub Issue ticket with respect to the session snafu:

https://github.com/posit-dev/positron...

Breakpoints inside of RStudio:

https://support.posit.co/hc/en-us/art...

R Script used in the video here:

https://github.com/coatless-videos/po...

Positron IDE ---

Positron can be obtained from:

https://github.com/posit-dev/positron

This was demonstrated on:

Positron Version: 2024.06.1 (Universal) build 27
Code - OSS Version: 1.90.0
Commit: a893e5b282612ccb2200102957ac38d3c14e5196
Date: 2024-06-26T02:08:06.673Z
Electron: 29.4.0
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 23.5.0

#positron #posit #rstudio  #rstats
2 ماه پیش در تاریخ 1403/04/08 منتشر شده است.
775 بـار بازدید شده
... بیشتر