Skip to content

Commit

Permalink
Add shim for rstudioapi::documentPath() (#642)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliasilge authored Dec 3, 2024
1 parent 268cbe4 commit 17fb694
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/ark/src/modules/rstudio/document-api.R
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 17fb694

Please sign in to comment.