diff --git a/crates/ark/src/modules/rstudio/document-api.R b/crates/ark/src/modules/rstudio/document-api.R index ea3277c9e..e4a96c832 100644 --- a/crates/ark/src/modules/rstudio/document-api.R +++ b/crates/ark/src/modules/rstudio/document-api.R @@ -33,7 +33,17 @@ )) } +#' @export +.rs.api.documentPath <- function(id = NULL) { + # TODO: Support document IDs + stopifnot(is.null(id)) + context <- .ps.ui.LastActiveEditorContext() + if (is.null(context)) { + return() + } + context$document$path +} #' @export .rs.api.getActiveDocumentContext <- function() {