From 6ef4599370eed743b524179f38d826a37ceca201 Mon Sep 17 00:00:00 2001 From: olivroy Date: Tue, 22 Oct 2024 14:03:08 -0400 Subject: [PATCH] Handle Positron unsaved documents --- R/open.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/open.R b/R/open.R index a37afcb..65fc794 100644 --- a/R/open.R +++ b/R/open.R @@ -72,6 +72,11 @@ active_rs_doc <- function() { # Will work for Positron >= 2024.11 # https://github.com/posit-dev/positron/issues/5112 path <- rstudioapi::getSourceEditorContext()$path + + # Handle Positron unsaved docs. + if (grepl("Untitled", path)) { + return(NULL) + } } else { cli::cli_abort("Not in RStudio or Positron. rstudioapi problem.") }