Skip to content

Commit 0112f03

Browse files
committed
allow arbitrary document types in documentNew (closes #316)
1 parent fba4729 commit 0112f03

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# rstudioapi (development version)
22

3+
* `rstudioapi::documentNew()` now accepts arbitrary document types. (#316)
4+
5+
36
# rstudioapi 0.17.1
47

58
* Ensure a more appropriate error message is emitted for calls to

R/document-api.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#'
2424
#' @param execute Should the code be executed after the document
2525
#' is created?
26-
#'
26+
#'
2727
#' @param allowConsole Allow the pseudo-id `#console` to be returned, if the \R
2828
#' console is currently focused? Set this to `FALSE` if you'd always like to
2929
#' target the currently-active or last-active editor in the Source pane.
@@ -76,7 +76,7 @@
7676
#'
7777
#' The \code{documentSave} and \code{documentSaveAll} functions were added
7878
#' with version 1.1.287 of RStudio.
79-
#'
79+
#'
8080
#' The \code{documentId} and \code{documentPath} functions were added with
8181
#' version 1.4.843 of RStudio.
8282
#'
@@ -200,7 +200,7 @@ documentSaveAll <- function() {
200200
#' \code{contents} \tab The contents of the document.\cr
201201
#' \code{selection} \tab A \code{list} of selections. See \bold{Details} for more information.\cr
202202
#' }
203-
#'
203+
#'
204204
#' @param id The ID of a particular document, as retrieved by `documentId()`
205205
#' or similar. Supported in RStudio 2022.06.0 or newer.
206206
#'
@@ -229,7 +229,7 @@ getConsoleEditorContext <- function() {
229229
#' @export
230230
documentNew <- function(
231231
text,
232-
type = c("r", "rmarkdown", "sql"),
232+
type = NULL,
233233
position = document_position(0, 0),
234234
execute = FALSE)
235235
{

0 commit comments

Comments
 (0)