posit-dev / posit-dev/positron
calling handlers from `.Rprofile` don't persist in session
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.3k
- Forks
- 184
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 206
Description
System details:
Positron and OS details:
Positron Version: 2025.03.0 (Universal) build 116
Code - OSS Version: 1.96.0
Commit: 7f0f93873e8b24c9f393bb3586724f4783c5e72c
Date: 2025-03-01T18:51:44.014Z
Electron: 32.2.6
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Darwin arm64 24.3.0
Interpreter details:
R 4.4.1 or Python 3.11.6
Describe the issue:
If I set calling handlers in my .Rprofile, they aren't applied in my console.
Steps to reproduce the issue:
- Run
usethis::edit_r_profile()in the R console - Add
globalCallingHandlers(error = function(e) stop("Caught that!"))to the end of the file - Restart R
- Run R code that errors, e.g.
sum(1, "n") - Observe that the calling handler isn't applied, e.g.
Error in sum(): ! invalid 'type' (character) of argumentrather thanCaught that!
Expected or desired behavior:
I would have expected that calling handlers set in .Rprofile are applied in the session. e.g. if I start RStudio with the same .Rprofile, I see:
sum(1, "n")
#> Error in h(simpleError(msg, call)) : Caught that!
Were there any error messages in the UI, Output panel, or Developer Tools console?
No error messages in the UI. The developer tools console is quite busy but they all seem related to specific extensions, so I won't paste that here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue by adding globalCallingHandlers(error = function(e) stop("Caught that!")) through usethis::edit_r_profile(), restarting R, and running sum(1, "n") in the R console. Compare the console startup behavior with RStudio; the work is done when the handler from .Rprofile is applied in the Positron session and the error reports "Caught that!".
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100