rstudioapi/0000755000176200001440000000000014706024702012437 5ustar liggesusersrstudioapi/MD50000644000176200001440000002072714706024702012757 0ustar liggesuserse5c30fe46a5da89398b79a8ee4997740 *DESCRIPTION 2491c4039e00be047cce99c452d3fd00 *LICENSE b7fd16a45b0211b8cde777fae403e3d2 *NAMESPACE 09f236f8ced5b7f9331d3f4e53c3599f *NEWS.md 18ad1dc992094757632b7fe7718bc8be *R/auth.R 0221342300f5b1f6cc2627ff8e802e60 *R/bug-report.R 55173aca0882afbde1f0255d458bc4d1 *R/build-tools.R 5cc2cf64daa77f5d691a99cd5b297a91 *R/chunk.R 502aa20268aeaf56c7b1f0a4f071db63 *R/code.R 8fbb81159beab1d1873074cd68e73be1 *R/commands.R 27164947d053ce9107a674f564214180 *R/dependencies.R 842f0c10819e6dc0a22b592833f34924 *R/dialogs.R e7561a3402f858e5e21f7ebe2ad81927 *R/dictionaries.R 45bc506e9a6317662522c5b96de24ca7 *R/document-api.R 67bbc02f8f280d497a5459ff588e6f60 *R/document-methods.R bb6fd76d24b0f8b1c1f3e51de1e0ad49 *R/files-pane.R eaf30ede3ad997cd4ad6e2aafb1b3d8e *R/highlight-ui.R fdfeaa5076e2649ce7fd04beb94a7383 *R/jobs.R c301c8f3a8b709690a95decc70cb8d60 *R/launcher-functions.R a6b30acdc0bba6b16108033aee980ba6 *R/launcher.R 627c1993928ca912b11e33ee38fd7e15 *R/misc.R 3eeb5a0bd99758ad2f95af5f3650ad7b *R/prefs.R 02b10f6b86c32d5ef51bb837215f3cff *R/preview.R 08685a48e8f39a6dda4cd7f6042debbe *R/remote.R a54fcf01b4c73ce8bd5eea720485212b *R/selections.R c9f72b1ec9e754b2cdb865e7673b161d *R/stubs.R 1754d5d801354fcae0a9917e81d9bcdb *R/templates.R bb4d4636f7dc73b11c63fb42fa7b4070 *R/terminal.R ca8879b4099009e74eeb258890b2f3e7 *R/themes.R 803dd0ced443c56b0a3457007b52f89c *R/tutorial.R a38d11d8201877bb6bbcaa24cb4fc80a *R/urls.R 8117d88e3d261880f23701726df1bc2b *R/user.R 1219c514fd50cdd826fe436c25d006e0 *R/utils.R 2448c3646ded24e9ec9262c8c2a31bcc *build/vignette.rds bd533fab67709a0c98a10338d39ee679 *inst/doc/dialogs.R 01f5841a3d3d9249f0b6509697189d5e *inst/doc/dialogs.Rmd ecd91fff8adb3cb5666f84e1c37f9fa7 *inst/doc/dialogs.html 462250065182d40e516e44efddc7dc36 *inst/doc/document-manipulation.R 0a81e2595fc31915b1c6ec77cdbc8fe2 *inst/doc/document-manipulation.Rmd c2446697bb1da8f2473a7fed6f7f1625 *inst/doc/document-manipulation.html 4eb7f4d912f65f74a951b41ca1ab859d *inst/doc/introduction.Rmd 8be6c2fc50167b3b8566ff52785add5b *inst/doc/introduction.html 0ed95f3ce75ac90c6e6948d13c746b8e *inst/doc/projects.R b3f763976fc12d073ef5f4cf610589db *inst/doc/projects.Rmd e88fb83486f2584265fdd2fb1855497e *inst/doc/projects.html 5889354ea694e0f070cf36b1ddbe2901 *inst/doc/r-session.R 893b2edd4437db137894eac26be23bec *inst/doc/r-session.Rmd 9e1f9586fa1a3493d673c4b248d0141e *inst/doc/r-session.html 41a4c559971972d6d9dcd58bfff08ae1 *inst/doc/terminal.R f3c167a82271b465abde03d586184a2a *inst/doc/terminal.Rmd f903064493adf87f19c4303443e7d85f *inst/doc/terminal.html 74c12bf30c50046ff15f56607293cfd7 *inst/doc/visual-mode.R 8c43fae2c9ebca97036dc318a69f5487 *inst/doc/visual-mode.Rmd 24ec67641d2ac7fb4721270a3c9e33c0 *inst/doc/visual-mode.html 57a07882194feef826135554b64bc1b2 *inst/resources/bug-report.md 0a3f0746185f36f8b4b59b4b890aeb11 *man/addTheme.Rd a1cf55bd498336bae467889235fc3a69 *man/applyTheme.Rd 0c5d5807b395945bf929c9ef0b268ab6 *man/askForPassword.Rd 0b11c9c827e05e76ea22f49e75ea6405 *man/askForSecret.Rd 1b13b1ee4795ab97ac1e72447d6cc68b *man/bugReport.Rd 29d0b7def46ecdcf6a8a39aefda3209a *man/build-tools.Rd b52171c4f9e3ac9be7b52ba50541df9f *man/callFun.Rd 5063f553ec36db9e4e7c212f970e26f9 *man/chunk-callbacks.Rd c139c32e6b8efdb443f8e0839b1b3a86 *man/convertTheme.Rd 38232bcd1f0d79a40684c267996d3cd0 *man/createProjectTemplate.Rd e5623bd34e76ef7c44c4c37cccd9ffc3 *man/dictionaries.Rd 5a815a59461d3949444a7f93901a0f0e *man/document_position.Rd 00e6a39555080c8109179127ee4de883 *man/document_range.Rd e0608449bf43e423d89fe09e02356f83 *man/executeCommand.Rd 4c3047e389c08697fe6c69c223dffeb1 *man/figures/logo.png 29380004b7af0ba5beb88a78a6632b81 *man/figures/logo.svg e9e7e9a47bbc314ae4ab132674cab164 *man/file-dialogs.Rd 8c12da5457e21beaeaba00367ccb6a73 *man/filesPaneNavigate.Rd dad63d947fd2cda17bd71a2723cb9bfc *man/getActiveProject.Rd 909b41c9eb416582a36bc92e2c0e579f *man/getDelegatedAzureToken.Rd 31f7bb0ab2230789a430c2cd8cf5c395 *man/getMode.Rd 6c474fd4ff22c8f5ad1ad8c38dc342ae *man/getRStudioPackageDependencies.Rd 93d5c67ef034efb66ac76139ce7401c7 *man/getThemeInfo.Rd f1ac035f86ed13483176411fde218705 *man/getThemes.Rd ed7dbd8f99e6446831b3ffa4ed124260 *man/getVersion.Rd a2ac388d2c095a326862e5e2953412d2 *man/hasColorConsole.Rd 327c7314797942325c0c6ec1f29a83f0 *man/hasFun.Rd 65db3a95d2cecaed260b6fdcc084f377 *man/highlightUi.Rd 591e5b6971859f03464ab8ebe23019ad *man/isAvailable.Rd 033cdbc00d0f286edb50b9e5c21526d6 *man/isJob.Rd b4bd87f05798780198cbd2984368c7d2 *man/jobAdd.Rd c45058f13f806dc2b82e2deff4e45dda *man/jobAddOutput.Rd fd22ea26211db1a07d0cf3fc955111d0 *man/jobAddProgress.Rd a383e7c4097976d0473bfa2cba3e4197 *man/jobGetState.Rd 2c4927163065bd838994e82066805404 *man/jobList.Rd 439305ca9dd057e64aa18586d7af1918 *man/jobRemove.Rd bc167607282518cbee90d61ffa954169 *man/jobRunScript.Rd 8f35aeabdfe556f97cfd77af9110ef33 *man/jobSetProgress.Rd 35146c0eafd80fc3a0a2e683129e7020 *man/jobSetState.Rd 06b48d6936749d22fe816f7b3fef6ff7 *man/jobSetStatus.Rd c329a9904293ba917b3c5d140dc88b6c *man/launcherAvailable.Rd 8ba0b31ec2b65d02548ed6ffb6994894 *man/launcherConfig.Rd 03b87160f00aa29389314270e88a9364 *man/launcherContainer.Rd a4b00c62040b11d43492b07e5f2a5f79 *man/launcherControlJob.Rd 67828a0f47c00c7eb1f8ecaf1376029d *man/launcherGetInfo.Rd b3df7fab38f9912adb1ac12b6d90d378 *man/launcherGetJob.Rd 3dc58676c616565ab0ccfe530be47d84 *man/launcherGetJobs.Rd 7cb3a9b86800cf48d6f594da7c7ff0b4 *man/launcherHostMount.Rd efeefc9ed9512b9071676a7eb812beca *man/launcherNfsMount.Rd e8b1158b1b1fcae563ea742cfecc042d *man/launcherPlacementConstraint.Rd f33b9c84123c5c506df57a1a8e69f303 *man/launcherResourceLimit.Rd 2ebd4802fc4ef9780873dd576fafb520 *man/launcherSubmitJob.Rd 043456accb7ea2891748d8ecf0640dc5 *man/launcherSubmitR.Rd b9b06310fa01f5465f0d0450aa4fd392 *man/navigateToFile.Rd 3258087faf4f8e4713163d463483d625 *man/persistent-values.Rd 83b0ac45962984e167e57f550a05914d *man/previewRd.Rd f808e3d0bd2774e2e84f27d7d1df7947 *man/previewSql.Rd 81bb2b1792943c221022684a0d482a8e *man/primary_selection.Rd a5bc70d553da36bda84230472a0bd43e *man/projects.Rd e1eb52e247799e43f4f46bd19651f1e3 *man/readPreference.Rd 1a91ef4c25575988746ced151f7edd76 *man/readRStudioPreference.Rd e2fa8a7d632e42c6dcd5a441899b803b *man/registerCommandCallback.Rd 6b8c2a2259deb596247762f84832e030 *man/registerCommandStreamCallback.Rd f6fdc4654fd43e7e8051b137a57b9920 *man/removeTheme.Rd 83491d5d6470f51bad06aa3ac2d8b1ed *man/restartSession.Rd 8f69e57204f0aeae2a3dad35f14e2082 *man/rstudio-documents.Rd c495d7aa655d4baa055d54539231d7a7 *man/rstudio-editors.Rd b321e07723b3bcee950ed93297deea6a *man/savePlotAsImage.Rd 5342b3344bf56f8a7b586e36e9f4a292 *man/selections.Rd ae1cd15ade5dd28fe8b05e79345656e9 *man/sendToConsole.Rd 9bde245c35f2688ec456a1b45403bd08 *man/setGhostText.Rd 22f66b2b017036397350579467bd9b8e *man/showDialog.Rd 3eeedf4dddb45f4f62c71aaaa704d01c *man/showPrompt.Rd 78f09ede03d526516a963b08729f5fee *man/showQuestion.Rd f58e0ca2462362a0221f78cc636d7717 *man/sourceMarkers.Rd c64d52cabb74dc47ddb6f03a7aa42dd7 *man/systemUsername.Rd 077c236bf337d759cbff405db92a841b *man/terminalActivate.Rd 76226dfbe091e73e47b7ff20f1ca9815 *man/terminalBuffer.Rd b2fee934c9f1be20884d889b92226a43 *man/terminalBusy.Rd c3d6b4a1e7e44fa07c07417d8583403f *man/terminalClear.Rd db62c2064ec1b1f87ff022e3d3005932 *man/terminalContext.Rd a1b19ac4cf975c4710d40b60f45e53e5 *man/terminalCreate.Rd de09a551862aadfe79c9226a58caba34 *man/terminalExecute.Rd 75fb4425bee91608daa72303d71f3114 *man/terminalExitCode.Rd 85ffc689ebfb70c4e343ec82e6bd42be *man/terminalKill.Rd 45eb66e8a5b6b04334cdc4eb18231108 *man/terminalList.Rd 1c7a96689f86d954c5267ee4e01c3ce6 *man/terminalRunning.Rd bd98a27c50935b0055c381c58114fe12 *man/terminalSend.Rd c5ac2c4c3e59f027356790bcdd059a6b *man/terminalVisible.Rd 06c3a15a76e214d091b9238921f62419 *man/translateLocalUrl.Rd 1ec540918b559f4582e59adafd5104c7 *man/unregisterCommandCallback.Rd 0049081fc806fc15ea5fa7c64330ed5f *man/updateDialog.Rd 838bfa3b11a19467a2f607749c532105 *man/userIdentity.Rd 461afa8dc80205d5bdbe5447f219f725 *man/versionInfo.Rd 3405bebd5a68ce3fe2d7cbb48e655199 *man/viewer.Rd 54f1ec85c00d8a6421e5d6fc1cf6f810 *man/writePreference.Rd 8a7bf3eef91e035537cc9be4ed0029ac *man/writeRStudioPreference.Rd 01f5841a3d3d9249f0b6509697189d5e *vignettes/dialogs.Rmd 0a81e2595fc31915b1c6ec77cdbc8fe2 *vignettes/document-manipulation.Rmd 4eb7f4d912f65f74a951b41ca1ab859d *vignettes/introduction.Rmd b3f763976fc12d073ef5f4cf610589db *vignettes/projects.Rmd 893b2edd4437db137894eac26be23bec *vignettes/r-session.Rmd f3c167a82271b465abde03d586184a2a *vignettes/terminal.Rmd 8c43fae2c9ebca97036dc318a69f5487 *vignettes/visual-mode.Rmd rstudioapi/R/0000755000176200001440000000000014703771642012651 5ustar liggesusersrstudioapi/R/files-pane.R0000644000176200001440000000051714147112135015006 0ustar liggesusers#' Navigate to a Directory in the Files Pane #' #' Navigate to a directory in the Files pane. The contents of that directory #' will be listed and shown in the Files pane. #' #' #' @param path The filesystem path to be shown. #' @export filesPaneNavigate filesPaneNavigate <- function(path) { callFun("filesPaneNavigate", path) } rstudioapi/R/jobs.R0000644000176200001440000001433414561520767013740 0ustar liggesusers #' Add a Job #' #' Inform RStudio's Background Jobs pane that a job has been added. #' #' #' @param name The background job's name. #' @param status The initial status text for the job; optional. #' @param progressUnits The integer number of units of work in the job; for #' example, \code{100L} if the job's progress is expressed in percentages. Use #' \code{0L} if the number of units of work is unknown. #' @param actions A list of actions that can be performed on the job (see #' Actions). #' @param running Whether the job is currently running. #' @param autoRemove Whether to remove the job from the Background Jobs pane #' when it's complete. #' @param show Whether to show the job in the Jobs pane. #' @return An ID representing the newly added job, used as a handle to provide #' further updates of the job's status. #' @section Actions: #' #' The \code{actions} parameter is a named list of functions that the user can #' invoke on the job; for example: \code{actions = list(stop = function(id) { #' ... })}. The function will be passed a parameter named \code{id} with the #' job ID that invoked it. #' #' There are three special action names: \describe{ \item{stop}{If there is an #' action named \code{stop}, then the job will have a Stop button in in the #' Jobs pane, and pressing that button will invoke the \code{stop} action.} #' \item{info}{If there is an action named \code{info}, then the job will have #' an informational link in the Background Jobs pane rather than an output display, #' and clicking the link will invoke the \code{info} action.} #' \item{replay}{If there is an action named \code{replay}, then the job will #' have a Replay button that displays when the job has finished running. Clicking #' the button will invoke the \code{replay} action.}} #' #' @family jobs #' @export jobAdd <- function(name, status = "", progressUnits = 0L, actions = NULL, running = FALSE, autoRemove = TRUE, show = TRUE) { callFun("addJob", name = name, status = status, progressUnits = progressUnits, actions = actions, running = running, autoRemove = autoRemove, show = show) } #' Remove a Background Job #' #' Remove a background job from RStudio's Background Jobs pane. #' #' @param job The ID of the job to remove. #' #' @family jobs #' @export jobRemove <- function(job) { callFun("removeJob", job = job) } #' Set Background Job Progress #' #' Updates the progress for a background job. #' #' @param job The ID of the job to set progress for. #' @param units The integer number of total units of work completed so far. #' #' @family jobs #' @export jobSetProgress <- function(job, units) { callFun("setJobProgress", job = job, units = units) } #' Add Background Job Progress #' #' Adds incremental progress units to a background job. #' #' #' @param job The ID of the job to update progress for. #' @param units The integer number of new progress units completed. #' #' @family jobs #' @export jobAddProgress <- function(job, units) { callFun("addJobProgress", job = job, units = units) } #' Set Background Job Status #' #' Update a background job's informational status text. #' #' #' @param job The ID of the job to update. #' @param status Text describing job's new status. #' #' @family jobs #' @export jobSetStatus <- function(job, status) { callFun("setJobStatus", job = job, status = status) } #' Get Background Job State #' #' @param job The ID of the job. #' #' @family jobs #' @export jobGetState <- function(job) { callFun("getJobState", job = job) } #' Set Background Job State #' #' Changes the state of a background job. #' #' #' @param job The ID of the job on which to change state. #' @param state The new job state. #' @section States: #' #' The following states are supported: \describe{ \item{idle}{The job is #' waiting to run.} \item{running}{The job is actively running.} #' \item{succeeded}{The job has finished successfully.} \item{cancelled}{The #' job was cancelled.} \item{failed}{The job finished but did not succeed.} } #' #' @family jobs #' @export jobSetState <- function(job, state = c("idle", "running", "succeeded", "cancelled", "failed")) { callFun("setJobState", job = job, state = state) } #' Add Background Job Output #' #' Adds text output to a background job. #' #' #' @param job The ID of the job that has emitted text. #' @param output The text output emitted by the job. #' @param error Whether the output represents an error. #' #' @family jobs #' @export jobAddOutput <- function(job, output, error = FALSE) { callFun("addJobOutput", job = job, output = output, error = error) } #' Run R Script As Background Job #' #' Starts an R script as a background job. #' #' #' @param path The path to the R script to be run. #' @param name A name for the background job. When \code{NULL} (the default), #' the filename of the script is used as the job name. #' @param encoding The text encoding of the script, if known. #' @param workingDir The working directory in which to run the job. When #' \code{NULL} (the default), the parent directory of the R script is used. #' @param importEnv Whether to import the global environment into the job. #' @param exportEnv The name of the environment in which to export the R #' objects created by the job. Use \code{""} (the default) to skip export, #' \code{"R_GlobalEnv"}` to export to the global environment, or the name of an #' environment object to create an object with that name. #' #' @family jobs #' @export jobRunScript <- function(path, name = NULL, encoding = "unknown", workingDir = NULL, importEnv = FALSE, exportEnv = "") { path <- normalizePath(path, winslash = "/", mustWork = TRUE) callFun("runScriptJob", path = path, name = name, encoding = encoding, workingDir = workingDir, importEnv = importEnv, exportEnv = exportEnv) } #' List Background Jobs #' #' List any registered background jobs. #' #' @family jobs #' @export jobList <- function() { callFun("listJobs") } rstudioapi/R/document-api.R0000644000176200001440000002006014277744605015364 0ustar liggesusers#' Interact with Documents open in RStudio #' #' Use these functions to interact with documents open in RStudio. #' #' @param location An object specifying the positions, or ranges, wherein text #' should be inserted. See \bold{Details} for more information. #' #' @param text A character vector, indicating what text should be inserted at #' each aforementioned range. This should either be length one (in which case, #' this text is applied to each range specified); otherwise, it should be the #' same length as the \code{ranges} list. #' #' @param id The document id. When \code{NULL} or blank, the requested operation #' will apply to the currently open, or last focused, RStudio document. #' #' @param position The cursor position, typically created through #' \code{\link{document_position}()}. #' #' @param ranges A list of one or more ranges, typically created #' through \code{\link{document_range}()}. #' #' @param type The type of document to be created. #' #' @param execute Should the code be executed after the document #' is created? #' #' @param allowConsole Allow the pseudo-id `#console` to be returned, if the \R #' console is currently focused? Set this to `FALSE` if you'd always like to #' target the currently-active or last-active editor in the Source pane. #' #' @details #' #' \code{location} should be a (list of) \code{\link{document_position}} or #' \code{\link{document_range}} object(s), or numeric vectors coercable to #' such objects. #' #' To operate on the current selection in a document, call \code{insertText()} #' with only a text argument, e.g. #' #' \preformatted{ #' insertText("# Hello\\n") #' insertText(text = "# Hello\\n") #' } #' #' Otherwise, specify a (list of) positions or ranges, as in: #' #' \preformatted{ #' # insert text at the start of the document #' insertText(c(1, 1), "# Hello\\n") #' #' # insert text at the end of the document #' insertText(Inf, "# Hello\\n") #' #' # comment out the first 5 rows #' pos <- Map(c, 1:5, 1) #' insertText(pos, "# ") #' #' # uncomment the first 5 rows, undoing the previous action #' rng <- Map(c, Map(c, 1:5, 1), Map(c, 1:5, 3)) #' modifyRange(rng, "") #' } #' #' \code{modifyRange} is a synonym for \code{insertText}, but makes its intent #' clearer when working with ranges, as performing text insertion with a range #' will replace the text previously existing in that range with new text. For #' clarity, prefer using \code{insertText} when working with #' \code{\link{document_position}}s, and \code{modifyRange} when working with #' \code{\link{document_range}}s. #' #' @note #' The \code{insertText}, \code{modifyRange} and \code{setDocumentContents} #' functions were added with version 0.99.796 of RStudio. #' #' The \code{setCursorPosition} and \code{setSelectionRanges} functions were #' added with version 0.99.1111 of RStudio. #' #' The \code{documentSave} and \code{documentSaveAll} functions were added #' with version 1.1.287 of RStudio. #' #' The \code{documentId} and \code{documentPath} functions were added with #' version 1.4.843 of RStudio. #' #' @name rstudio-documents NULL #' @name rstudio-documents #' @export insertText <- function(location = NULL, text = NULL, id = NULL) { # unfortunate gymnastics needed for older versions of RStudio if (getVersion() < "1.4") { if (is.null(location) && is.null(text)) { callFun("insertText", id = id) } else if (is.null(location)) { callFun("insertText", text = text, id = id) } else if (is.null(text)) { callFun("insertText", location = location, id = id) } else { callFun("insertText", location = location, text = text, id = id) } } else { callFun("insertText", location = location, text = text, id = id) } } #' @name rstudio-documents #' @export modifyRange <- insertText #' @name rstudio-documents #' @export setDocumentContents <- function(text, id = NULL) { location <- document_range( document_position(1, 1), document_position(Inf, 1) ) insertText(location, text, id) } #' @name rstudio-documents #' @export setCursorPosition <- function(position, id = NULL) { callFun("setSelectionRanges", position, id) } #' @name rstudio-documents #' @export setSelectionRanges <- function(ranges, id = NULL) { callFun("setSelectionRanges", ranges, id) } #' @name rstudio-documents #' @export documentId <- function(allowConsole = TRUE) { callFun("documentId", allowConsole = allowConsole) } #' @name rstudio-documents #' @export documentPath <- function(id = NULL) { path <- callFun("documentPath", id = id) Encoding(path) <- "UTF-8" path } #' @name rstudio-documents #' @export documentSave <- function(id = NULL) { callFun("documentSave", id) } #' @name rstudio-documents #' @export documentSaveAll <- function() { callFun("documentSaveAll") } #' Retrieve Information about an RStudio Editor #' #' Returns information about an RStudio editor. #' #' The \code{selection} field returned is a list of document selection objects. #' A document selection is just a pairing of a document \code{range}, and the #' \code{text} within that range. #' #' @note #' The \code{getActiveDocumentContext} function was added with version 0.99.796 #' of RStudio, while the \code{getSourceEditorContext} and the \code{getConsoleEditorContext} #' functions were added with version 0.99.1111. #' #' @return A \code{list} with elements: #' \tabular{ll}{ #' \code{id} \tab The document ID.\cr #' \code{path} \tab The path to the document on disk.\cr #' \code{contents} \tab The contents of the document.\cr #' \code{selection} \tab A \code{list} of selections. See \bold{Details} for more information.\cr #' } #' #' @param id The ID of a particular document, as retrieved by `documentId()` #' or similar. Supported in RStudio 2022.06.0 or newer. #' #' @rdname rstudio-editors #' @name rstudio-editors #' @export getActiveDocumentContext <- function() { getDocumentContext("getActiveDocumentContext") } #' @name rstudio-editors #' @export getSourceEditorContext <- function(id = NULL) { getDocumentContext("getSourceEditorContext", id) } #' @name rstudio-editors #' @export getConsoleEditorContext <- function() { getDocumentContext("getConsoleEditorContext") } #' @note The \code{documentNew} function was introduced in RStudio 1.2.640. #' #' @name rstudio-documents #' @export documentNew <- function( text, type = c("r", "rmarkdown", "sql"), position = document_position(0, 0), execute = FALSE) { type <- match.arg(type) callFun("documentNew", type, text, position[1], position[2], execute) } #' @param path The path to the document. #' @param line The line in the document to navigate to. #' @param col The column in the document to navigate to. #' @param moveCursor Boolean; move the cursor to the requested location after #' opening the document? #' #' @note The \code{documentOpen} function was introduced in RStudio 1.4.1106. #' #' @name rstudio-documents #' @export documentOpen <- function( path, line = -1L, col = -1L, moveCursor = TRUE) { path <- normalizePath(path, winslash = "/", mustWork = TRUE) callFun("documentOpen", path, line, col, moveCursor) } #' @param save Whether to commit unsaved changes to the document before closing it. #' #' @note The \code{documentClose} function was introduced in RStudio 1.2.1255 #' #' @details #' #' \code{documentClose} accepts an ID of an open document rather than a path. #' You can retrieve the ID of the active document using the \code{documentId()} #' function. #' #' Closing is always done non-interactively; that is, no prompts are given to #' the user. If the user has made changes to the document but not saved them, #' then the \code{save} parameter governs the behavior: when \code{TRUE}, #' unsaved changes are committed, and when \code{FALSE} they are discarded. #' #' @name rstudio-documents #' @export documentClose <- function(id = NULL, save = TRUE) { callFun("documentClose", id, save) } rstudioapi/R/bug-report.R0000644000176200001440000000347014577650171015070 0ustar liggesusers#' File an RStudio Bug Report #' #' A utility function to assist with the filing of an RStudio bug report. This #' function will pre-populate a template with information useful in #' understanding your reported bug. #' #' #' @export bugReport bugReport <- function() { verifyAvailable() rstudioInfo <- versionInfo() rstudioVersion <- format(rstudioInfo$version) rstudioEdition <- sprintf( "%s [%s]", if (rstudioInfo$mode == "desktop") "Desktop" else "Server", if (is.null(rstudioInfo$edition)) "Open Source" else toupper(rstudioInfo$edition) ) rInfo <- utils::sessionInfo() rVersion <- rInfo$R.version$version.string rVersion <- sub("^R version", "", rVersion, fixed = TRUE) osVersion <- rInfo$running templateFile <- system.file("resources/bug-report.md", package = "rstudioapi") template <- readLines(templateFile) rendered <- renderTemplate(template, list( RSTUDIO_VERSION = rstudioVersion, RSTUDIO_EDITION = rstudioEdition, OS_VERSION = osVersion, R_VERSION = rVersion )) if (rstudioInfo$mode == "desktop" && requireNamespace("clipr", quietly = TRUE)) { clipr::write_clip(rendered) writeLines("* The bug report template has been written to the clipboard.") writeLines("* Please paste the clipboard contents into the issue comment section,") writeLines("* and then fill out the rest of the issue details.") } else { header <- "" text <- c(header, rendered) file <- tempfile("rstudio-bug-report-", fileext = ".html") on.exit(unlink(file), add = TRUE) writeLines(text, con = file) utils::file.edit(file) } url <- "https://github.com/rstudio/rstudio/issues/new?assignees=&labels=bug%2Cnew&projects=&template=1_bug_report.md&title=" utils::browseURL(url) } rstudioapi/R/build-tools.R0000644000176200001440000000267514147112135015227 0ustar liggesusers#' Build Tools #' #' Check, install, and use build tools as required. #' #' These functions are intended to be used together -- one should #' first check whether build tools are available, and when not, #' prompt for installation. For example: #' #' ```R #' compile_model <- function(...) { #' #' if (rstudioapi::isAvailable()) { #' #' if (!rstudioapi::buildToolsCheck()) #' rstudioapi::buildToolsInstall("Model compilation") #' #' rstudioapi::buildToolsExec({ #' # code requiring build tools here #' }) #' #' } #' } #' ``` #' #' The `action` parameter is used to communicate (with a prompt) the operation #' being performed that requires build tool installation. Setting it to `NULL` #' or the empty string will suppress that prompt. #' #' @param action The action (as a string) being taken that will require #' installation of build tools. #' #' @param expr An \R expression (unquoted) to be executed with build tools #' available and on the `PATH`. #' #' @note The `buildToolsCheck()`, `buildToolsInstall()`, and `buildToolsExec()` #' functions were added with version 1.2.962 of RStudio. #' #' @name build-tools NULL #' @name build-tools #' @export buildToolsCheck <- function() { callFun("buildToolsCheck") } #' @name build-tools #' @export buildToolsInstall <- function(action) { callFun("buildToolsInstall", action) } #' @name build-tools #' @export buildToolsExec <- function(expr) { callFun("buildToolsExec", expr) } rstudioapi/R/highlight-ui.R0000644000176200001440000000510014147112135015336 0ustar liggesusers#' Highlight UI Elements within the RStudio IDE #' #' This function can be used to highlight UI elements within the RStudio IDE. #' UI elements can be selected using query selectors; most commonly, one should #' choose to highlight elements based on their IDs when available. #' #' The tool at:\preformatted{Help -> Diagnostics -> Show DOM Elements } #' #' can be useful for identifying the classes and IDs assigned to the different #' elements within RStudio. #' #' @param queries A list of "query" objects. Each query should be a list with #' entries \code{"query"} and \code{"parent"}. See \strong{Queries} for more #' details. #' @note The \code{highlightUi} function was introduced in RStudio 1.3.658. #' @section Queries: #' #' Elements are selected using the same queries as through the web #' \code{querySelectorAll()} API. See #' \url{https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll} #' for more details. #' #' For example, to highlight the Save icon within the Source pane, one might #' use:\preformatted{rstudioapi::highlightUi("#rstudio_tb_savesourcedoc") } #' #' In some cases, multiple UI elements need to be highlighted -- e.g. if you #' want to highlight both a menu button, and a menu item within the menu #' displayed after the button is pressed. We'll use the Environment Pane's #' Import Dataset button as an example. To highlight the \verb{From Text #' (readr)} command, you might use:\preformatted{rstudioapi::highlightUi( list( #' list(query = "#rstudio_mb_import_dataset", parent = 0L), list(query = #' "#rstudio_label_from_text_readr_command", parent = 1L) ) ) } #' @examples #' #' \dontrun{rstudioapi::highlightUi("#rstudio_workbench_panel_git")} #' #' # clear current highlights #' \dontrun{rstudioapi::highlightUi("")} #' #' # highlight within an RMD #' \dontrun{rstudioapi::highlightUi(".rstudio_chunk_setup .rstudio_run_chunk")} #' #' # Optionally provide a callback adjacent to #' # the queries that will be executed when the #' # highlighted element is clicked on. #' \dontrun{rstudioapi::highlightUi( #' list( #' list( #' query="#rstudio_workbench_panel_git", #' callback="rstudioapi::highlightUi('')" #' ) #' ) #' )} #' #' @export highlightUi highlightUi <- function(queries) { queries <- lapply(queries, function(data) { if (is.character(data)) data <- list(query = data, parent = 0L) if (is.null(data$query)) stop("missing 'query' in highlight request") data$highlight <- as.integer(data$highlight %||% 0) data }) invisible(callFun("highlightUi", queries)) } rstudioapi/R/remote.R0000644000176200001440000000562614703770712014275 0ustar liggesusers #' Detect RStudio Jobs #' #' Use this function to detect whether RStudio is running an R "job". #' These jobs are normally used for actions taken in the Jobs tab, as well #' as within the \R build pane. #' #' `isWorkbenchJob()` is used to detect scripts which have been launched as #' Workbench jobs, and is only available in RStudio Workbench 2024.04 or newer. #' These jobs use the RStudio Launcher to run \R scripts on remote clusters, as #' opposed to `isBackgroundJob()`, which is used to detect background jobs #' which are run on the local machine. #' #' This function is primarily intended to be used by package authors, who #' need to customize the behavior of their methods when run within an #' RStudio job. #' #' @return Boolean; `TRUE` if this is an RStudio job. #' #' @export isJob <- function() { isBackgroundJob() || isWorkbenchJob() } #' @name isJob #' @export isBackgroundJob <- function() { !is.na(Sys.getenv("RSTUDIOAPI_IPC_REQUESTS_FILE", unset = NA)) } #' @name isJob #' @export isWorkbenchJob <- function() { identical(Sys.getenv("RSTUDIO_WORKBENCH_JOB"), "1") } callRemote <- function(call, frame) { # check for active request / response requestFile <- Sys.getenv("RSTUDIOAPI_IPC_REQUESTS_FILE", unset = NA) responseFile <- Sys.getenv("RSTUDIOAPI_IPC_RESPONSE_FILE", unset = NA) secret <- Sys.getenv("RSTUDIOAPI_IPC_SHARED_SECRET", unset = NA) if (is.na(requestFile) || is.na(responseFile) || is.na(secret)) stop("internal error: callRemote() called without remote connection") # clean up on exit on.exit(unlink(c(requestFile, responseFile)), add = TRUE) # remove srcrefs (un-needed for serialization here) attr(call, "srcref") <- NULL # ensure rstudioapi functions get appropriate prefix callFun <- if (is.name(call[[1L]])) { call("::", as.name("rstudioapi"), call[[1L]]) } else { call[[1L]] } # ensure arguments are evaluated before sending request call[[1L]] <- quote(base::list) args <- eval(call, envir = frame) call <- as.call(c(callFun, args)) # write to tempfile and rename, to ensure atomicity data <- list(secret = secret, call = call) tmp <- tempfile(tmpdir = dirname(requestFile)) saveRDS(data, file = tmp) file.rename(tmp, requestFile) # loop until response is ready (poll) # in theory we'd just do a blocking read but there isn't really a good # way to do this in a cross-platform way without additional dependencies now <- Sys.time() timeout <- getOption("rstudioapi.remote.timeout", default = 10) repeat { # check for response if (file.exists(responseFile)) break # check for lack of response diff <- difftime(Sys.time(), now, units = "secs") if (diff > timeout) stop("RStudio did not respond to rstudioapi IPC request") # wait a bit Sys.sleep(0.1) } # read response response <- readRDS(responseFile) if (inherits(response, "error")) stop(response) response } rstudioapi/R/misc.R0000644000176200001440000000031014147112135013705 0ustar liggesusers#' @importFrom utils capture.output formatText <- function(text, n = 20L, truncated = "<...>") { result <- if (nchar(text) < n) text else paste(text, truncated) encodeString(result) } rstudioapi/R/preview.R0000644000176200001440000000116614147112135014445 0ustar liggesusers#' Preview SQL statement #' #' Makes use of 'DBI' and \code{dbGetQuery()} to preview a SQL statement for a #' given 'DBI' connection. #' #' #' @param conn The 'DBI' connection to be used to execute this statement. #' @param statement The SQL statement to execute. Either a path to a file #' containing a SQL statement or the SQL statement itself. #' @param ... Additional arguments to be used in \code{dbGetQuery()}. #' @note The \code{previewSql} function was introduced in RStudio 1.2.600 #' @export previewSql previewSql <- function(conn, statement, ...) { callFun("previewSql", conn = conn, statement = statement, ...) } rstudioapi/R/terminal.R0000644000176200001440000002536114147112135014602 0ustar liggesusers#' Send Text to a Terminal #' #' Send text to an existing terminal. #' #' #' @param id The terminal id. The \code{id} is obtained from #' \code{\link{terminalList}()}, \code{\link{terminalVisible}()}, #' \code{\link{terminalCreate}()}, or \code{\link{terminalExecute}()}. #' @param text Character vector containing text to be inserted. #' @note The \code{terminalSend} function was added in version 1.1.350 of #' RStudio. #' @examples #' #' \dontrun{ #' termId <- rstudioapi::terminalCreate() #' rstudioapi::terminalSend(termId, 'ls -l\n') #' } #' #' #' @export terminalSend terminalSend <- function(id, text) { callFun("terminalSend", id, text) } #' Clear Terminal Buffer #' #' Clears the buffer for specified terminal. #' #' #' @param id The terminal id. The \code{id} is obtained from #' \code{\link{terminalList}()}, \code{\link{terminalVisible}()}, #' \code{\link{terminalCreate}()}, or \code{\link{terminalExecute}()}. #' @note The \code{terminalClear} function was added in version 1.1.350 of #' RStudio. #' @examples #' #' \dontrun{ #' termId <- rstudioapi::terminalCreate() #' rstudioapi::terminalSend(termId, 'ls -l\n') #' Sys.sleep(3) #' rstudioapi::terminalClear(termId) #' } #' #' #' @export terminalClear terminalClear <- function(id) { callFun("terminalClear", id) } #' Create a Terminal #' #' Create a new Terminal. #' #' #' @param caption The desired terminal caption. When \code{NULL} or blank, the #' terminal caption will be chosen by the system. #' @param show If \code{FALSE}, terminal won't be brought to front. #' @param shellType Shell type for the terminal: NULL or "default" to use the #' shell selected in Global Options. For Microsoft Windows, alternatives are #' "win-cmd" for 64-bit Command Prompt, "win-ps" for 64-bit PowerShell, #' "win-git-bash" for Git Bash, or "win-wsl-bash" for Bash on Windows Subsystem #' for Linux. On Linux, Mac, and RStudio Server "custom" will use the custom #' terminal defined in Global Options. If the requested shell type is not #' available, the default shell will be used, instead. #' @return The terminal identifier as a character vector (\code{NULL} if unable #' to create the terminal or the given terminal caption is already in use). #' @note The \code{terminalCreate} function was added in version 1.1.350 of #' RStudio and the ability to specify shellType was added in version 1.2.696. #' @examples #' #' \dontrun{ #' termId <- rstudioapi::terminalCreate('My Terminal') #' } #' #' #' @export terminalCreate terminalCreate <- function(caption = NULL, show = TRUE, shellType = NULL) { if (rstudioapi::getVersion() < "1.2.696") { if (!is.null(shellType)) { warning('shellType parameter ignored: not supported in this version of RStudio') } callFun("terminalCreate", caption, show) } else { callFun("terminalCreate", caption, show, shellType) } } #' Is Terminal Busy #' #' Are terminals reporting that they are busy? #' #' This feature is only supported on RStudio Desktop for Mac and Linux, and #' RStudio Server. It always returns \code{FALSE} on RStudio Desktop for #' Microsoft Windows. #' #' @param id The terminal id. The \code{id} is obtained from #' \code{\link{terminalList}()}, \code{\link{terminalVisible}()}, #' \code{\link{terminalCreate}()}, or \code{\link{terminalExecute}()}. #' @return a boolean #' @note The \code{terminalBusy} function was added in version 1.1.350 of #' RStudio. #' @examples #' #' \dontrun{ #' # create a hidden terminal and run a lengthy command #' termId <- rstudioapi::terminalCreate(show = FALSE) #' rstudioapi::terminalSend(termId, "sleep 5\n") #' #' # wait until a busy terminal is finished #' while (rstudioapi::terminalBusy(termId)) { #' Sys.sleep(0.1) #' } #' print("Terminal available") #' } #' #' @export terminalBusy terminalBusy <- function(id) { callFun("terminalBusy", id) } #' Is Terminal Running #' #' Does a terminal have a process associated with it? If the R session is #' restarted after a terminal has been created, the terminal will not restart #' its shell until it is displayed either via the user interface, or via #' \code{\link{terminalActivate}()}. #' #' #' @param id The terminal id. The \code{id} is obtained from #' \code{\link{terminalList}()}, \code{\link{terminalVisible}()}, #' \code{\link{terminalCreate}()}, or \code{\link{terminalExecute}()}. #' @return a boolean #' @note The \code{terminalRunning} function was added in version 1.1.350 of #' RStudio. #' @examples #' #' \dontrun{ #' # termId has a handle to a previously created terminal #' # make sure it is still running before we send it a command #' if (!rstudioapi::terminalRunning(termId)) { #' rstudioapi::terminalActivate(termId)) #' #' # wait for it to start #' while (!rstudioapi::terminalRunning(termId)) { #' Sys.sleep(0.1) #' } #' #' terminalSend(termId, "echo Hello\n") #' } #' } #' #' @export terminalRunning terminalRunning <- function(id) { callFun("terminalRunning", id) } #' Get All Terminal Ids #' #' Return a character vector containing all the current terminal identifiers. #' #' #' @return The terminal identifiers as a character vector. #' @note The \code{terminalList} function was added in version 1.1.350 of #' RStudio. #' @export terminalList terminalList <- function() { callFun("terminalList") } #' Retrieve Information about RStudio Terminals #' #' Returns information about RStudio terminal instances. #' #' #' @param id The terminal id. The \code{id} is obtained from #' \code{\link{terminalList}()}, \code{\link{terminalVisible}()}, #' \code{\link{terminalCreate}()}, or \code{\link{terminalExecute}()}. #' @return A \code{list} with elements: \tabular{ll}{ \code{handle} \tab the #' internal handle\cr \code{caption} \tab caption\cr \code{title} \tab title #' set by the shell\cr \code{working_dir} \tab working directory\cr #' \code{shell} \tab shell type\cr \code{running} \tab is terminal process #' executing\cr \code{busy} \tab is terminal running a program\cr #' \code{exit_code} \tab process exit code or NULL\cr \code{connection} \tab #' websockets or rpc\cr \code{sequence} \tab creation sequence\cr \code{lines} #' \tab lines of text in terminal buffer\cr \code{cols} \tab columns in #' terminal\cr \code{rows} \tab rows in terminal\cr \code{pid} \tab process id #' of terminal shell\cr \code{full_screen} \tab full screen program running\cr #' } #' @note The \code{terminalContext} function was added in version 1.1.350 of #' RStudio. #' @examples #' #' \dontrun{ #' termId <- rstudioapi::terminalCreate("example", show = FALSE) #' View(rstudioapi::terminalContext(termId)) #' #' } #' #' #' @export terminalContext terminalContext <- function(id) { callFun("terminalContext", id) } #' Activate Terminal #' #' Ensure terminal is running and optionally bring to front in RStudio. #' #' #' @param id The terminal id. The \code{id} is obtained from #' \code{\link{terminalList}()}, \code{\link{terminalVisible}()}, #' \code{\link{terminalCreate}()}, or \code{\link{terminalExecute}()}. If NULL, #' the terminal tab will be selected but no specific terminal will be chosen. #' @param show If TRUE, bring the terminal to front in RStudio. #' @note The \code{terminalActivate} function was added in version 1.1.350 of #' RStudio. #' @examples #' #' \dontrun{ #' # create a hidden terminal and run a lengthy command #' termId = rstudioapi::terminalCreate(show = FALSE) #' rstudioapi::terminalSend(termId, "sleep 5\n") #' #' # wait until a busy terminal is finished #' while (rstudioapi::terminalBusy(termId)) { #' Sys.sleep(0.1) #' } #' print("Terminal available")#' #' #' rstudioapi::terminalActivate(termId) #' } #' #' #' @export terminalActivate terminalActivate <- function(id = NULL, show = TRUE) { callFun("terminalActivate", id, show) } #' Get Terminal Buffer #' #' Returns contents of a terminal buffer. #' #' #' @param id The terminal id. The \code{id} is obtained from #' \code{\link{terminalList}()}, \code{\link{terminalVisible}()}, #' \code{\link{terminalCreate}()}, or \code{\link{terminalExecute}()}. #' @param stripAnsi If FALSE, don't strip out Ansi escape sequences before #' returning terminal buffer. #' @return The terminal contents, one line per row. #' @note The \code{terminalBuffer} function was added in version 1.1.350 of #' RStudio. #' @export terminalBuffer terminalBuffer <- function(id, stripAnsi = TRUE) { callFun("terminalBuffer", id, stripAnsi) } #' Kill Terminal #' #' Kill processes and close a terminal. #' #' #' @param id The terminal id. The \code{id} is obtained from #' \code{\link{terminalList}()}, \code{\link{terminalVisible}()}, #' \code{\link{terminalCreate}()}, or \code{\link{terminalExecute}()}. #' @note The \code{terminalKill} function was added in version 1.1.350 of #' RStudio. #' @export terminalKill terminalKill<- function(id) { callFun("terminalKill", id) } #' Get Visible Terminal #' #' Get Visible Terminal #' #' #' @return Terminal identifier selected in the client, if any. #' @note The \code{terminalVisible} function was added in version 1.1.350 of #' RStudio. #' @export terminalVisible terminalVisible <- function() { callFun("terminalVisible") } #' Execute Command #' #' Execute a command, showing results in the terminal pane. #' #' #' @param command System command to be invoked, as a character string. #' @param workingDir Working directory for command #' @param env Vector of name=value strings to set environment variables #' @param show If FALSE, terminal won't be brought to front #' @return The terminal identifier as a character vector (\code{NULL} if unable #' to create the terminal). #' @note The \code{terminalExecute} function was added in version 1.1.350 of #' RStudio. #' @examples #' #' \dontrun{ #' termId <- rstudioapi::terminalExecute( #' command = 'echo $HELLO && echo $WORLD', #' workingDir = '/usr/local', #' env = c('HELLO=WORLD', 'WORLD=EARTH'), #' show = FALSE) #' #' while (is.null(rstudioapi::terminalExitCode(termId))) { #' Sys.sleep(0.1) #' } #' #' result <- terminalBuffer(termId) #' terminalKill(termId) #' print(result) #' } #' #' #' @export terminalExecute terminalExecute <- function(command, workingDir = NULL, env = character(), show = TRUE) { callFun("terminalExecute", command, workingDir, env, show) } #' Terminal Exit Code #' #' Get exit code of terminal process, or NULL if still running. #' #' #' @param id The terminal id. The \code{id} is obtained from #' \code{\link{terminalList}()}, \code{\link{terminalVisible}()}, #' ,\code{\link{terminalCreate}()}, or \code{\link{terminalExecute}()}. #' @return The exit code as an integer vector, or NULL if process still #' running. #' @note The \code{terminalExitCode} function was added in version 1.1.350 of #' RStudio. #' @export terminalExitCode terminalExitCode <- function(id) { callFun("terminalExitCode", id) } rstudioapi/R/user.R0000644000176200001440000000054214147112135013737 0ustar liggesusers#' Get User Identity #' #' Returns the identity (displayed name) of the current user. #' #' #' @export userIdentity userIdentity <- function() { callFun("userIdentity") } #' Get System Username #' #' Returns the system username of the current user. #' #' #' @export systemUsername systemUsername <- function() { callFun("systemUsername") } rstudioapi/R/templates.R0000644000176200001440000000640714147112135014765 0ustar liggesusers#' Create a Project Template #' #' Create a project template. See #' \url{https://rstudio.github.io/rstudio-extensions/rstudio_project_templates.html} #' for more information. #' #' #' @param package The path to an package sources. #' @param binding The skeleton function to associate with this project #' template. This is the name of the function that will be used to initialize #' the project. #' @param title The title to be shown within the \strong{New Project...} #' wizard. #' @param subtitle (optional) The subtitle to be shown within the \strong{New #' Project...} wizard. #' @param caption (optional) The caption to be shown on the landing page for #' this template. #' @param icon (optional) The path to an icon, on disk, to be used in the #' dialog. Must be an \code{.png} of size less than 64KB. #' @param open_files (optional) Files that should be opened by RStudio when the #' project is generated. Shell-style globs can be used to indicate when #' multiple files matching some pattern should be opened -- for example, #' OpenFiles: R/*.R would indicate that RStudio should open all .R files within #' the R folder of the generated project. #' @param overwrite Boolean; overwrite a pre-existing template file if one #' exists? #' @param edit Boolean; open the file for editting after creation? #' @export createProjectTemplate createProjectTemplate <- function(package = ".", binding, title, subtitle = paste("Create a new", title), caption = paste("Create", title), icon = NULL, open_files = NULL, overwrite = FALSE, edit = TRUE) { package <- normalizePath(package, winslash = "/", mustWork = TRUE) # construct metadata metadata <- list( Binding = binding, Title = title, Subtitle = subtitle, Caption = caption, Icon = icon, OpenFiles = open_files ) # drop nulls metadata <- metadata[vapply(metadata, Negate(is.null), FUN.VALUE = logical(1))] # create templates directory templates_dir <- file.path(package, "inst/rstudio/templates/project") if (!file.exists(templates_dir)) if (!dir.create(templates_dir, recursive = TRUE)) stop(sprintf("failed to create '%s' directory", templates_dir)) # construct DCF metadata contents dcf <- paste(names(metadata), ": ", metadata, sep = "") # add header linking to online documentation header <- c( "# This file provides the metadata necessary for RStudio to", "# use the '%s()' function when initializing a project. See", "# the documentation online at: ", "#", "# https://rstudio.github.io/rstudio-extensions/rstudio_project_templates.html", "#", "# for more details.", "" ) header <- sprintf(header, binding) dcf <- c(header, dcf) # construct path to file name <- gsub("[^a-zA-Z0-9_.]", "_", binding) path <- file.path(templates_dir, paste(name, "dcf", sep = ".")) if (file.exists(path) && !overwrite) stop(sprintf("a skeleton function already exists at path '%s'", path)) # write out writeLines(dcf, con = path) if (edit) utils::file.edit(path) TRUE } rstudioapi/R/launcher-functions.R0000644000176200001440000003335714502355251016605 0ustar liggesusers#' Retrieve Workbench Launcher Information #' #' Retrieve information about the Workbench launcher, as well as the different clusters #' that the launcher has been configured to use. #' #' @family job-launcher functionality #' @export launcherGetInfo <- function() { callLauncherFun("launcher.getInfo") } #' Check if Workbench Launcher is Available #' #' Check if the Workbench launcher is available and configured to support #' Workbench jobs; that is, jobs normally launched by the user through #' the RStudio IDE's user interface. #' #' @family job-launcher functionality #' @export launcherAvailable <- function() { callLauncherFun("launcher.jobsFeatureAvailable") } #' Retrieve Workbench Job Information #' #' Retrieve information on Workbench jobs. #' #' @param statuses Return only jobs whose status matches one of `statuses`. #' Valid statuses are: Pending, Running, Suspended, Failed, Finished, Killed, #' Canceled. When `NULL`, all jobs are returned. #' #' @param fields Return a subset of fields associated with each job object. #' When `NULL`, all fields associated with a particular job are returned. #' #' @param includeSessions Boolean; include jobs which are also operating #' as RStudio R sessions? #' #' @param tags An optional set of tags. Only jobs that have been assigned one #' of these requested tags will be returned. #' #' @family job-launcher functionality #' @export launcherGetJobs <- function(statuses = NULL, fields = NULL, tags = NULL, includeSessions = FALSE) { callLauncherFun("launcher.getJobs", statuses = statuses, fields = fields, tags = tags, includeSessions = includeSessions) } #' Retrieve Workbench Job Information #' #' Retrieve information on a Workbench job with id \code{jobId}. #' #' #' @param jobId The id of a Workbench job. #' #' @family job-launcher functionality #' @export launcherGetJob <- function(jobId) { callLauncherFun("launcher.getJob", jobId = jobId) } #' Define a Workbench Launcher Configuration #' #' Define a Workbench launcher configuration, suitable for use with the \code{config} #' argument to \code{\link[=launcherSubmitJob]{launcherSubmitJob()}}. #' #' #' @param name The name of the launcher configuration. #' #' @param value The configuration value. Must either be an integer, float, or #' string. #' #' @family job-launcher functionality #' @export launcherConfig <- function(name, value = NULL) { valueType <- if (is.integer(value)) "int" else if (is.double(value)) "float" else if (is.character(value)) "string" value <- format(value) callLauncherFun("launcher.newConfig", name = name, value = value, valueType = valueType) } #' Define a Workbench Launcher Container #' #' Define a launcher container, suitable for use with the \code{container} #' argument to \code{\link[=launcherSubmitJob]{launcherSubmitJob()}}. #' #' #' @param image The container image to use. #' #' @param runAsUserId The user id to run as within the container. Defaults to #' the container-specified user. #' #' @param runAsGroupId The group id to run as within the container. Defaults to #' the container-specified group. #' #' @family job-launcher functionality #' @export launcherContainer <- function(image, runAsUserId = NULL, runAsGroupId = NULL) { if (is.numeric(runAsUserId)) runAsUserId <- as.integer(runAsUserId) if (is.null(runAsGroupId)) runAsGroupId <- as.integer(runAsGroupId) callLauncherFun("launcher.newContainer", image = image, runAsUserId = runAsUserId, runAsGroupId = runAsGroupId) } #' Define a Workbench Launcher Placement Constraint #' #' Define a launcher placement constraint, suitable for use with the #' \code{placementConstraints} argument to #' \code{\link[=launcherSubmitJob]{launcherSubmitJob()}}. #' #' #' @param name The name of this placement constraint. #' #' @param value The value of the constraint. A job will only be placed on a #' requested node if the requested placement constraint is present. #' #' @family job-launcher functionality #' @export launcherPlacementConstraint <- function(name, value = NULL) { callLauncherFun("launcher.newPlacementConstraint", name = name, value = value) } #' Define a Workbench Launcher Resource Limit #' #' Define a launcher resource limit, suitable for use with the #' \code{resourceLimits} argument to #' \code{\link[=launcherSubmitJob]{launcherSubmitJob()}}. #' #' #' @param type The resource limit type. Must be one of cpuCount, cpuFrequency, #' cpuSet, cpuTime, memory, memorySwap. Different launcher plugins may support #' different subsets of these resource limit types; please consult the plugin #' documentation to learn which limits are supported. #' #' @param value The formatted value of the requested limit. #' #' @family job-launcher functionality #' @export launcherResourceLimit <- function(type, value) { callLauncherFun("launcher.newResourceLimit", type = type, value = value) } #' Define a Workbench Launcher Host Mount #' #' Define a launcher host mount, suitable for use with the \code{mounts} #' argument to \code{\link[=launcherSubmitJob]{launcherSubmitJob()}}. This can #' be used to mount a path from the host into the generated container. #' #' @param path The host path to be mounted. #' #' @param mountPath The destination path for the mount in the container. #' #' @param readOnly Boolean; should the path be mounted read-only? #' #' @family job-launcher functionality #' @export launcherHostMount launcherHostMount <- function(path, mountPath, readOnly = TRUE) { callLauncherFun("launcher.newHostMount", path = path, mountPath = mountPath, readOnly = readOnly) } #' Define a Workbench Launcher NFS Mount #' #' Define a launcher NFS mount, suitable for use with the \code{mounts} #' argument to \code{\link[=launcherSubmitJob]{launcherSubmitJob()}}. This can #' be used to mount a path from a networked filesystem into a newly generated #' container. #' #' #' @param host The host name, or IP address, of the NFS server. #' #' @param path The NFS path to be mounted. #' #' @param mountPath The destination path for the mount in the container. #' #' @param readOnly Boolean; should the path be mounted read-only? #' #' @family job-launcher functionality #' @export launcherNfsMount launcherNfsMount <- function(host, path, mountPath, readOnly = TRUE) { callLauncherFun("launcher.newNfsMount", host = host, path = path, mountPath = mountPath, readOnly = readOnly) } #' Submit a Workbench Job #' #' Submit a Workbench job. See #' for more #' information. #' #' #' @param name A descriptive name to assign to the job. #' #' @param cluster The name of the cluster this job should be submitted to. #' #' @param tags A set of user-defined tags, used for searching and querying #' jobs. #' @param command The command to run within the job. This is executed via the #' system shell. Only one of command or exe should be specified. #' #' @param exe The (fully pathed) executable to run within the job. Only one of #' \code{command} or \code{exe} should be specified. #' #' @param args An array of arguments to pass to the command / executable. #' #' @param environment A list of environment variables to be set for processes #' launched with this job. #' #' @param stdin Data to be written to stdin when the job process is launched. #' #' @param stdoutFile The file used for the job's generated standard output. Not #' all launcher plugins support this parameter. #' #' @param stderrFile The file used for the job's generated standard error. Not #' all launcher plugins support this parameter. #' #' @param workingDirectory The working directory to be used by the command / #' executable associated with this job. #' #' @param host The host that the job is running on, or the desired host during #' job submission. #' #' @param container The container to be used for launched jobs. #' #' @param exposedPorts The ports that are exposed by services running on a #' container. Only applicable to systems that support containers. #' #' @param mounts A list of mount points. See #' \code{\link[=launcherHostMount]{launcherHostMount()}} and #' \code{\link[=launcherNfsMount]{launcherNfsMount()}} for more information. #' #' @param placementConstraints A list of placement constraints. See #' \code{\link[=launcherPlacementConstraint]{launcherPlacementConstraint()}} #' for more information. #' #' @param resourceLimits A list of resource limits. See #' \code{\link[=launcherResourceLimit]{launcherResourceLimit()}} for more #' information. #' #' @param queues A list of available submission queues for the cluster. Only #' applicable to batch systems like LSF. #' #' @param config A list of cluster-specific configuration options. See #' \code{\link[=launcherConfig]{launcherConfig()}} for more information. #' #' @param user The user-name of the job owner. #' #' @param applyConfigSettings Apply server-configured mounts, exposedPorts, and #' environment, in addition to any specified in this call. #' #' @family job-launcher functionality #' @export launcherSubmitJob <- function(name, cluster = "Local", tags = NULL, command = NULL, exe = NULL, args = NULL, environment = NULL, stdin = NULL, stdoutFile = NULL, stderrFile = NULL, workingDirectory = NULL, host = NULL, container = NULL, exposedPorts = NULL, mounts = NULL, placementConstraints = NULL, resourceLimits = NULL, queues = NULL, config = NULL, user = Sys.getenv("USER"), applyConfigSettings = TRUE) { callLauncherFun("launcher.submitJob", args = args, cluster = cluster, command = command, config = config, container = container, environment = environment, exe = exe, exposedPorts = exposedPorts, host = host, mounts = mounts, name = name, placementConstraints = placementConstraints, queues = queues, resourceLimits = resourceLimits, stderrFile = stderrFile, stdin = stdin, stdoutFile = stdoutFile, tags = tags, user = user, workingDirectory = workingDirectory, applyConfigSettings = applyConfigSettings) } #' Execute an R Script as a Workbench Job #' #' Convenience function for running an R script as a Workbench job using #' whichever R is found on the path in the Workbench launcher cluster. #' #' See \code{\link[=launcherSubmitJob]{launcherSubmitJob()}} for running jobs #' with full control over command, environment, and so forth. #' #' @param script Fully qualified path of R script. Must be a path that is #' available in the job container (if using containerized job cluster such as #' Kubernetes). #' #' @param cluster The name of the cluster this job should be submitted to. #' #' @param container The container to be used for launched jobs. #' #' @family job-launcher functionality #' @export launcherSubmitR <- function(script, cluster = "Local", container = NULL) { # don't proactively check for existence of the script; possible the supplied # path only resolves correctly in the job cluster scriptPath <- path.expand(script) scriptFile <- basename(scriptPath) scriptArg <- paste("-f", scriptPath) jobTag <- paste("rstudio-r-script-job", scriptFile, sep = ":") callLauncherFun("launcher.submitJob", args = c("--slave", "--no-save", "--no-restore", scriptArg), cluster = cluster, command = "R", container = container, name = scriptFile, tags = c(jobTag), applyConfigSettings = TRUE) } #' Interact with (Control) a Workbench Job #' #' Interact with a Workbench job. #' #' #' @param jobId The job id. #' #' @param operation The operation to execute. The operation should be one of #' \code{c("suspend", "resume", "stop", "kill", "cancel")}. Note that different #' launcher plugins support different subsets of these operations -- consult #' your launcher plugin documentation to see which operations are supported. #' #' @family job-launcher functionality #' @export launcherControlJob <- function(jobId, operation = c("suspend", "resume", "stop", "kill", "cancel")) { callLauncherFun("launcher.controlJob", jobId = jobId, operation = operation) } rstudioapi/R/document-methods.R0000644000176200001440000001265314276505471016262 0ustar liggesusers#' Create a Document Position #' #' Creates a \code{document_position}, which can be used to indicate e.g. the #' row + column location of the cursor in a document. #' #' #' @aliases document_position is.document_position as.document_position #' @param row The row (using 1-based indexing). #' @param column The column (using 1-based indexing). #' @param x An object coercable to \code{document_position}. #' @export document_position document_position <- function(row, column) { structure(c(row = as.numeric(row), column = as.numeric(column)), class = "document_position") } #' @rdname document_position #' @export is.document_position <- function(x) { inherits(x, "document_position") } #' @name document_position #' @export as.document_position <- function(x) { UseMethod("as.document_position") } #' @export as.document_position.document_position <- function(x) { x } #' @export as.document_position.default <- function(x) { if (length(x) != 2 || !is.numeric(x)) stop("'x' should be a numeric vector of length 2", call. = FALSE) document_position(row = x[[1]], column = x[[2]]) } #' @export format.document_position <- function(x, ...) { paste("[", paste(x, collapse = ", "), "]", sep = "") } #' @export print.document_position <- function(x, ...) { cat("Document Position: ", format(x), "\n", sep = "") } #' Create a Range #' #' A \code{document_range} is a pair of \code{\link{document_position}} #' objects, with each position indicating the \code{start} and \code{end} of #' the range, respectively. #' #' #' @aliases document_range is.document_range as.document_range #' @param start A \code{\link{document_position}} indicating the start of the #' range. #' @param end A \code{\link{document_position}} indicating the end of the #' range. #' @param x An object coercable to \code{document_range}. #' @return An \code{list} with class \code{document_range} and fields: #' #' \tabular{ll}{ \code{start:}\tab The start position.\cr \code{end:}\tab The #' end position.\cr } #' @export document_range document_range <- function(start, end = NULL) { # Allow users to write e.g. 'document_range(c(1, 2, 3, 4))'; # ie, ignore using the 'end' argument if (is.null(end)) { if (length(start) != 4 || !is.numeric(start)) stop("invalid range specification", call. = FALSE) end <- start[3:4] start <- start[1:2] } structure(list(start = as.document_position(start), end = as.document_position(end)), class = "document_range") } #' @name document_range #' @export is.document_range <- function(x) { inherits(x, "document_range") } #' @name document_range #' @export as.document_range <- function(x) { UseMethod("as.document_range") } #' @export as.document_range.document_range <- function(x) { x } #' @export as.document_range.default <- function(x) { document_range(x) } #' @export format.document_range <- function(x, ...) { startPos <- as.document_position(x$start) endPos <- as.document_position(x$end) paste(format(startPos, ...), "--", format(endPos, ...)) } #' @export print.document_range <- function(x, ...) { cat("Document Range:", "\n- Start: ", format(x$start), "\n- End: ", format(x$end), "\n", sep = "") } as.document_selection <- function(x) { invalidMsg <- "'x' should be a list of {range, text} pairs" if (!is.list(x)) stop(invalidMsg, call. = FALSE) result <- lapply(x, function(el) { named <- all(c("range", "text") %in% names(el)) if (!named) stop(invalidMsg, call. = FALSE) Encoding(el$text) <- "UTF-8" list( range = as.document_range(el$range), text = el$text ) }) structure(result, class = "document_selection") } formatSelection <- function(x) { vapply(x, FUN.VALUE = character(1), function(el) { rng <- format(el$range) txt <- formatText(el$text) paste(rng, ": '", txt, "'", sep = "") }) } #' @export print.document_selection <- function(x, ...) { cat("Document Selection:", sep = "") formatted <- formatSelection(x) lapply(formatted, function(el) { cat("\n- ", el, sep = "") }) cat("\n", sep = "") } #' @export print.document_context <- function(x, ...) { cat("Document Context: ", "\n- id: '", x$id, "'", "\n- path: '", x$path, "'", "\n- contents: <", length(x$contents), " rows>", "\n", sep = "") print(x$selection) } #' Extract the Primary Selection #' #' By default, functions returning a document context will return a list of #' selections, including both the 'primary' selection and also 'other' #' selections (e.g. to handle the case where a user might have multiple cursors #' active). Use \code{primary_selection()} to extract the primary selection. #' #' #' @param x A document context, or a selection. #' @param ... Optional arguments (currently ignored). #' @export primary_selection primary_selection <- function(x, ...) { UseMethod("primary_selection") } #' @export primary_selection.document_context <- function(x, ...) { primary_selection(x$selection) } #' @export primary_selection.document_selection <- function(x, ...) { x[[1]] } getDocumentContext <- function(fn, id = NULL) { context <- if (is.null(id)) callFun(fn) else callFun(fn, id) if (is.null(context)) return(NULL) Encoding(context$path) <- "UTF-8" Encoding(context$contents) <- "UTF-8" context$selection <- as.document_selection(context$selection) structure(context, class = "document_context") } rstudioapi/R/tutorial.R0000644000176200001440000000012414147112135014620 0ustar liggesusers tutorialLaunchBrowser <- function(url) { callFun("tutorialLaunchBrowser", url) } rstudioapi/R/chunk.R0000644000176200001440000000204614147112135014072 0ustar liggesusers#' Register and Unregister a Chunk Callback #' #' Register a callback function to be executed after a chunk within an R #' Markdown document is run. #' #' @section Chunk Callbacks: #' #' The `callback` argument should be a function accepting two parameters: #' #' - `chunkName`: The chunk label, #' - `chunkCode`: The code within the chunk. #' #' The function should return an \R list of HTML outputs, to be displayed after #' that chunk has been executed. #' #' @param id A unique identifier. #' #' @param callback A callback function. See **Chunk Callbacks** for more details. #' #' @return For `registerChunkCallback()`, a unique identifier. That identifier #' can be passed to `unreigsterChunkCallback()` to de-register a #' previously-registered callback. #' #' @name chunk-callbacks NULL #' @name chunk-callbacks #' @export registerChunkCallback <- function(callback) { callFun("registerChunkCallback", callback) } #' @name chunk-callbacks #' @export unregisterChunkCallback <- function(id = NULL) { callFun("unregisterChunkCallback", id) } rstudioapi/R/auth.R0000644000176200001440000000131614502355251013725 0ustar liggesusers#' OAuth2 Tokens for Delegated Azure Resources #' #' When Workbench is using Azure Active Directory for sign-in, this function can #' return an OAuth2 token for a service Workbench users have delegated access #' to. This requires configuring delegated permissions in Azure itself. #' #' @param resource The name of an Azure resource or service, normally a URL. #' #' @examples #' \dontrun{ #' getDelegatedAzureToken("https://storage.azure.com") #' } #' @export getDelegatedAzureToken <- function(resource) { version <- versionInfo() if (is.null(version$edition)) { stop("Delegated Azure Credentials are not available in the open-source edition of RStudio.") } callFun("getDelegatedAzureToken", resource) } rstudioapi/R/commands.R0000644000176200001440000001267314502355251014575 0ustar liggesusers#' Execute Command #' #' Executes an arbitrary RStudio command. #' #' Most menu commands and many buttons in RStudio can be invoked from the API #' using this method. #' #' The \code{quiet} command governs the behavior of the function when the #' command does not exist. By default, an error is shown if you attempt to #' invoke a non-existent command. You should set this to \code{TRUE} when #' invoking a command that may not be available if you don't want your users to #' see an error. #' #' The command is run asynchronously, so no status is returned. #' #' See the [RStudio Server Professional Administration #' Guide](https://docs.posit.co/ide/server-pro/reference/rstudio_ide_commands.html) #' for a list of supported command IDs. #' #' @param commandId The ID of the command to execute. #' @param quiet Whether to show an error if the command does not exist. #' @note The \code{executeCommand} function was introduced in RStudio 1.2.1261. #' @seealso \code{\link{registerCommandCallback}} to be notified of command #' executions. #' @export executeCommand executeCommand <- function(commandId, quiet = FALSE) { response <- callFun("executeCommand", commandId = commandId, quiet = quiet) invisible(response) } #' Register Command Callback #' #' Registers a callback to be executed when an RStudio command is invoked. #' #' RStudio commands can be invoked from menus, toolbars, keyboard shortcuts, #' and the Command Palette, as well as the RStudio API. The callback will #' be executed whenever the command is invoked, regardless of how the #' invocation was triggered. #' #' See the RStudio Server Professional Administration Guide appendix for a list #' of supported command IDs. #' #' @details The callback is executed *after* the command has been run, but as #' some commands initiate asynchronous processes, there is no guarantee that #' the command has finished its work when the callback is invoked. #' #' If you're having trouble figuring out the ID of a command you want to listen #' for, it can be helpful to discover it by listening to the full command stream; #' see the example in \code{\link{registerCommandStreamCallback}} for details. #' #' Note that no error will be raised if you use a command ID that does not exist. #' @param commandId The ID of the command to listen for. #' @param callback A function to execute when the command is invoked. #' @returns A handle representing the registration. Pass this handle #' to \code{\link{unregisterCommandCallback}} to unregister the callback. #' @note The \code{registerCommandCallback} function was introduced in RStudio 1.4.1589. #' @seealso \code{\link{unregisterCommandCallback}} to unregister the callback, and #' \code{\link{registerCommandStreamCallback}} to be notified whenever *any* command #' is executed. #' @examples #' #' \dontrun{ #' # Set up a callback to display an encouraging dialog whenever #' # the user knits a document #' handle <- rstudioapi::registerCommandCallback( #' "knitDocument", #' function() { #' rstudioapi::showDialog( #' "Achievement", #' "Congratulations, you have knitted a document. Well done." #' ) #' }) #' #' # Knit the document interactively and observe the dialog #' #' # Later: Unregister the callback #' rstudioapi::unregisterCommandCallback(handle) #' } #' #' @export registerCommandCallback registerCommandCallback <- function(commandId, callback) { callFun("registerCommandCallback", commandId = commandId, commandCallback = callback) } #' Unregister Command Callback #' #' Removes a previously registered command callback. #' #' @param handle The registration handle to remove. #' @returns `NULL`, invisibly. #' @note The \code{unregisterCommandCallback} function was introduced in RStudio 1.4.1589. #' @export unregisterCommandCallback unregisterCommandCallback <- function(handle) { callFun("unregisterCommandCallback", handle = handle) } #' Register Command Stream Callback #' #' Registers a callback to be executed whenever any RStudio command is invoked. #' #' The callback function will be given a single argument with the ID of the #' command that was invoked. See the RStudio Server Professional Administration #' Guide appendix for a list of command IDs. #' #' Note that there is a small performance penalty incurred across the IDE when #' a command stream listener is present. If you only need to listen to a few #' specific commands, it is recommended to set up callbacks for them individually #' using \code{\link{registerCommandCallback}}. #' #' @param callback A function to execute when the command is invoked. #' @returns A handle representing the registration. Pass this handle #' to \code{\link{unregisterCommandCallback}} to unregister the callback. #' @note The \code{registerCommandStreamCallback} function was introduced in RStudio 1.4.1589. #' @seealso \code{\link{unregisterCommandCallback}} to unregister the callback, and #' \code{\link{registerCommandCallback}} to be notified whenever a *specific* command #' is executed. #' @examples #' #' \dontrun{ #' # Set up a callback to print the ID of commands executed to the console. #' handle <- rstudioapi::registerCommandStreamCallback(function(id) { #' message("Command executed: ", id) #' }) #' #' # Later: Unregister the callback #' rstudioapi::unregisterCommandCallback(handle) #' } #' @export registerCommandStreamCallback registerCommandStreamCallback <- function(callback) { callFun("registerCommandCallback", commandId = "*", commandCallback = callback) } rstudioapi/R/themes.R0000644000176200001440000001333114147112135014246 0ustar liggesusers#' Retrieve Themes #' #' Retrieves a list with information about the current color theme used by #' RStudio. #' #' A list is returned with the following elements: \describe{ \item{editor}{The #' name of the current editor theme, such as \code{Textmate}.} #' \item{global}{The name of the current global theme. One of \code{Modern}, #' \code{Classic}, or \code{Sky}.} \item{dark}{\code{TRUE} if the editor theme #' is dark, \code{FALSE} otherwise.} \item{foreground}{The current editor #' theme's default text foreground color, formatted as a CSS-compatible color #' string, such as \code{rgb(1, 22, 39)}. Supported since RStudio 1.2.1214.} #' \item{background}{The current editor theme's default text background color, #' formatted as a CSS-compatible color string. Supported since RStudio #' 1.2.1214.} } #' #' @export getThemeInfo getThemeInfo <- function() { callFun("getThemeInfo") } #' Add a Custom Editor Theme #' #' Adds a custom editor theme to RStudio and returns the name of the newly #' added theme. #' #' #' @param themePath A full or relative path or URL to an \code{rstheme} or #' \code{tmtheme} to be added. #' @param apply Whether to immediately apply the newly added theme. Setting #' this to \code{TRUE} has the same impact as running \code{{ #' rstudioapi::addTheme(); rstudioapi::applyTheme() #' }}.\cr Default: \code{FALSE}. #' @param force Whether to force the operation and overwrite an existing file #' with the same name.\cr Default: \code{FALSE}. #' @param globally Whether to install this theme for the current user or all #' users. If set to \code{TRUE} this will attempt to install the theme for all #' users, which may require administrator privileges.\cr Default: \code{FALSE}. #' @note The \code{addTheme} function was introduced in RStudio 1.2.879. #' @export addTheme addTheme <- function(themePath, apply = FALSE, force = FALSE, globally = FALSE) { path <- themePath # Ensure path looks like something we can use ext <- tolower(tools::file_ext(path)) if (!identical(ext, "rstheme") && !identical(ext, "tmtheme")) { stop("Invalid path ", path, ". ", "Please supply a path or URL to an .rstheme or .tmtheme file to add.") } # If the path appears to be a URL, download it. if (grepl("^https?:", themePath)) { # Give the downloaded filename the same name and extension as the original. path <- file.path(tempdir(), utils::URLdecode(basename(themePath))) if (file.exists(path)) { # It's unlikely that the theme file will exist in the temp dir, but move it out # of the way if it does. unlink(path) } # Perform the download utils::download.file(themePath, path) } if (identical(ext, "tmtheme")) { # needs conversion first convertTheme(path, add = TRUE, apply = apply, force = force, globally = globally) } else if (identical(ext, "rstheme")) { # no conversion necessary callFun("addTheme", path, apply, force, globally) } } #' Apply an Editor Theme to RStudio #' #' Applies the specified editor theme to RStudio. #' #' #' @param name The unique name of the theme to apply. #' @note The \code{applyTheme} function was introduced in RStudio 1.2.879. #' @export applyTheme applyTheme <- function(name) { callFun("applyTheme", name) } #' Convert a tmTheme to an RStudio Theme #' #' Converts a \code{tmTheme} to an \code{rstheme} and optionally adds and #' applies it to RStudio and returns the name of the theme. #' #' #' @param themePath A full or relative path to the \code{tmTheme} file to be #' converted. #' @param add Whether to add the newly converted theme to RStudio. Setting this #' to true will have the same impact as running \code{{ #' rstudioapi::convertTheme(, outputLocation = #' ); rstudioapi::addTheme() }}.\cr #' Default: \code{TRUE}. #' @param outputLocation A full or relative path where a copy of the converted #' theme will be saved. If this value is \code{NULL}, no copy will be saved.\cr #' Default: \code{NULL}. #' @param apply Whether to immediately apply the newly added theme. This #' paramater cannot be set to \code{TRUE} if \code{add} is set to \code{FALSE}. #' Setting this and \code{add} to \code{TRUE} has the same impact as running #' \code{{ rstudioapi::convertTheme(, outputLocation = #' ); rstudioapi::addTheme(); #' rstudioapi::applyTheme() }}.\cr Default: \code{FALSE}. #' @param force Whether to force the operation and overwrite an existing file #' with the same name.\cr Default: \code{FALSE}. #' @param globally Whether to install this theme for the current user or all #' users. If set to \code{TRUE} this will attempt to install the theme for all #' users, which may require administrator privileges. Only applies when #' \code{add} is \code{TRUE}. \cr Default: \code{FALSE}. #' @note The \code{convertTheme} function was introduced in RStudio 1.2.879. #' @export convertTheme convertTheme <- function(themePath, add = TRUE, outputLocation = NULL, apply = FALSE, force = FALSE, globally = FALSE) { callFun("convertTheme", themePath, add, outputLocation, apply, force, globally) } #' Get Theme List #' #' Retrieves a list of the names of all the editor themes installed for #' RStudio. #' #' #' @note The \code{getThemes} function was introduced in RStudio 1.2.879. #' @export getThemes getThemes <- function() { callFun("getThemes") } #' Remove a custom theme from RStudio. #' #' Remove a custom theme from RStudio. #' #' #' @param name The unique name of the theme to remove. #' @note The \code{removeTheme} function was introduced in RStudio 1.2.879. #' @export removeTheme removeTheme <- function(name) { callFun("removeTheme", name) } rstudioapi/R/launcher.R0000644000176200001440000000135714147112135014567 0ustar liggesusers callLauncherFun <- function(fname, ...) { verifyAvailable() if (hasFun(fname)) return(callFun(fname, ...)) if (!exists("RStudio.Version", envir = globalenv())) stop("RStudio is not available.", call. = FALSE) RStudio.Version <- get("RStudio.Version", envir = globalenv()) version <- RStudio.Version() if (is.null(version$edition)) { fmt <- "Launcher API '%s' is not available in the open-source edition of RStudio." stop(sprintf(fmt, fname)) } if (identical(version$mode, "desktop")) { fmt <- "Launcher API '%s' is not yet available in the Desktop edition of RStudio." stop(sprintf(fmt, fname)) } fmt <- "Launcher API '%s' is not available in this version of RStudio." stop(sprintf(fmt, fname)) } rstudioapi/R/utils.R0000644000176200001440000000047514147112135014126 0ustar liggesusers `%||%` <- function(x, y) { if (is.null(x)) y else x } renderTemplate <- function(template, data) { rendered <- template for (i in seq_along(data)) { key <- names(data)[[i]] val <- data[[i]] fkey <- sprintf("${%s}", key) rendered <- gsub(fkey, val, rendered, fixed = TRUE) } rendered } rstudioapi/R/stubs.R0000644000176200001440000004172214560722317014136 0ustar liggesusers#' RStudio version information #' #' Query information about the currently running instance of RStudio. #' #' @return #' #' An \R list with the following elements: #' #' \tabular{ll}{ #' \code{version} \tab The version of RStudio. \cr #' \code{mode} \tab `"desktop"` for RStudio Desktop, or `"server"` for RStudio Server. \cr #' \code{citation} \tab Information on how RStudio can be cited in academic publications. \cr #' } #' #' @note The \code{versionInfo} function was added in version 0.97.124 of #' RStudio. #' #' @examples #' #' \dontrun{ #' info <- rstudioapi::versionInfo() #' #' # check what version of RStudio is in use #' if (info$version >= "1.4") { #' # code specific to versions of RStudio 1.4 and newer #' } #' #' # check whether RStudio Desktop or RStudio Server is being used #' if (info$mode == "desktop") { #' # code specific to RStudio Desktop #' } #' #' # Get the citation #' info$citation #' #' } #' #' @export versionInfo <- function() { callFun("versionInfo") } #' Preview an Rd topic in the Help pane #' #' Preview an Rd topic in the Help pane. #' #' @param rdFile The path to an `.Rd` file. #' #' @note The \code{previewRd} function was added in version 0.98.191 of #' RStudio. #' #' @examples #' #' \dontrun{ #' rstudioapi::previewRd("~/MyPackage/man/foo.Rd") #' } #' #' @export previewRd previewRd <- function(rdFile) { callFun("previewRd", rdFile) } #' View local web content within RStudio #' #' View local web content within RStudio. Content can be served from static #' files in the R session temporary directory, or via a web application running #' on localhost. #' #' RStudio also sets the global \code{viewer} option to the #' \code{rstudioapi::viewer} function so that it can be invoked in a front-end #' independent manner. #' #' Applications are displayed within the Viewer pane. The application URL must #' either be served from localhost or be a path to a file within the R session #' temporary directory. If the URL doesn't conform to these requirements it is #' displayed within a standard browser window. #' #' The \code{height} parameter specifies a desired height, however it's #' possible the Viewer pane will end up smaller if the request can't be #' fulfilled (RStudio ensures that the pane paired with the Viewer maintains a #' minimum height). A height of 400 pixels or lower is likely to succeed in a #' large proportion of configurations. #' #' A very large height (e.g. 2000 pixels) will allocate the maximum allowable #' space for the Viewer (while still preserving some view of the pane above or #' below it). The value \code{"maximize"} will force the Viewer to full height. #' Note that this value should only be specified in cases where maximum #' vertical space is essential, as it will result in one of the user's other #' panes being hidden. #' #' @param url Application URL. This can be either a localhost URL or a path to a #' file within the R session temporary directory (i.e. a path returned by #' [tempfile()]). #' #' @param height Desired height. Specifies a desired height for the Viewer pane #' (the default is \code{NULL} which makes no change to the height of the #' pane). This value can be numeric or the string \code{"maximize"} in which #' case the Viewer will expand to fill all vertical space. See details below #' for a discussion of constraints imposed on the height. #' #' @note The \code{viewer} function was added in version 0.98.423 of RStudio. #' The ability to specify \code{maximize} for the \code{height} parameter was #' introduced in version 0.99.1001 of RStudio. #' #' @section Viewer Detection: #' #' When a page is displayed within the Viewer it's possible that the user will #' choose to pop it out into a standalone browser window. When rendering inside #' a standard browser you may want to make different choices about how content #' is laid out or scaled. Web pages can detect that they are running inside the #' Viewer pane by looking for the \code{viewer_pane} query parameter, which is #' automatically injected into URLs when they are shown in the Viewer. For #' example, the following URL: #' #' \preformatted{ http://localhost:8100 } #' #' When rendered in the Viewer pane is transformed to: #' #' \preformatted{ http://localhost:8100?viewer_pane=1 } #' #' To provide a good user experience it's strongly recommended that callers #' take advantage of this to automatically scale their content to the current #' size of the Viewer pane. For example, re-rendering a JavaScript plot with #' new dimensions when the size of the pane changes. #' @examples #' #' \dontrun{ #' #' # run an application inside the IDE #' rstudioapi::viewer("http://localhost:8100") #' #' # run an application and request a height of 500 pixels #' rstudioapi::viewer("http://localhost:8100", height = 500) #' #' # use 'viewer' option if set, or `utils::browseURL()` if unset #' viewer <- getOption("viewer", default = utils::browseURL) #' viewer("http://localhost:8100") #' #' # generate a temporary html file and display it #' dir <- tempfile() #' dir.create(dir) #' htmlFile <- file.path(dir, "index.html") #' # (code to write some content to the file) #' rstudioapi::viewer(htmlFile) #' #' } #' #' #' @export viewer viewer <- function(url, height = NULL) { callFun("viewer", url, height = height) } #' Display source markers #' #' Display user navigable source markers in a pane within RStudio. #' #' The \code{markers} argument can contains either a list of marker lists or a #' data frame with the appropriate marker columns. The fields in a marker are #' as follows (all are required): #' #' \tabular{ll}{ #' \code{type} \tab The marker type ("error", "warning", "info", "style", or "usage"). \cr #' \code{file} \tab The path to the associated source file. \cr #' \code{line} \tab The line number for the associated marker. \cr #' \code{column} \tab The column number for the associated marker. \cr #' \code{message} \tab A message associated with the marker at this location. \cr #' } #' #' Note the marker \code{message} can contain ANSI SGR codes for formatting. #' The \code{cli} package can format text for style and color. #' #' @param name The name of marker set. If there is a market set with this name #' already being shown, those markers will be replaced. #' #' @param markers An \R list, or data.frame, of source markers. See **details** #' for more details on the expected format. #' #' @param basePath Optional. If all source files are within a base path, then #' specifying that path here will result in file names being displayed as #' relative paths. Note that in this case markers still need to specify source #' file names as full paths. #' #' @param autoSelect Auto-select a marker after displaying the marker set? #' #' @note The \code{sourceMarkers} function was added in version 0.99.225 of #' RStudio. #' #' @export sourceMarkers <- function(name, markers, basePath = NULL, autoSelect = c("none", "first", "error")) { callFun("sourceMarkers", name, markers, basePath, autoSelect) } #' Navigate to file #' #' Open a file in RStudio, optionally at a specified location. #' #' The \code{navigateToFile} opens a file in RStudio. If the file is already #' open, its tab or window is activated. #' #' Once the file is open, the cursor is moved to the specified location. If the #' \code{file} argument is empty (the default), then the file is the file #' currently in view if one exists. If the \code{line} and \code{column} #' arguments are both equal to \code{-1L} (the default), then the cursor #' position in the document that is opened will be preserved. Alternatively, #' \code{moveCursor} can be set to `FALSE` to preserve the cursor position. #' #' Note that if your intent is to navigate to a particular function within a #' file, you can also cause RStudio to navigate there by invoking #' \code{\link[utils]{View}} on the function, which has the advantage of #' falling back on deparsing if the file is not available. #' #' @param file The file to be opened. #' #' @param line The line number where the cursor should be placed. When `-1L` #' (the default), the cursor will not be moved. #' #' @param column The column number where the cursour should be placed. When #' `-1L` (the default), the cursor will not be moved. #' #' @param moveCursor Boolean; should the cursor be moved to the requested #' (`line`, `column`) position? Set this to `FALSE` to preserve the existing #' cursor position in the document. #' #' @note The \code{navigateToFile} function was added in version 0.99.719 of #' RStudio. #' #' @export navigateToFile <- function(file = character(0), line = -1L, column = -1L, moveCursor = TRUE) { callFun("navigateToFile", file, as.integer(line), as.integer(column), as.logical(moveCursor)) } #' Ask the user for a password interactively #' #' Ask the user for a password interactively. #' #' RStudio also sets the global \code{askpass} option to the #' \code{rstudioapi::askForPassword} function so that it can be invoked in a #' front-end independent manner. #' #' @param prompt The prompt to be shown to the user. #' #' @note The \code{askForPassword} function was added in version 0.99.853 of #' RStudio. #' #' @examples #' #' \dontrun{ #' rstudioapi::askForPassword("Please enter your password") #' } #' #' @export askForPassword askForPassword <- function(prompt = "Please enter your password") { callFun("askForPassword", prompt) } #' Retrieve path to active RStudio project #' #' Get the path to the active RStudio project (if any). If the path contains #' non-ASCII characters, it will be UTF-8 encoded. #' #' @return The path to the current project, or \code{NULL} if no project is #' currently open. #' #' @note The \code{getActiveProject} function was added in version 0.99.854 of #' RStudio. #' #' @export getActiveProject <- function() { path <- callFun("getActiveProject") # path is NULL iff there is no open project if (is.null(path)) return(path) # ... otherwise path is UTF-8 encoded Encoding(path) <- "UTF-8" path } #' Save active RStudio plot image #' #' Save the plot currently displayed in the Plots pane as an image. #' #' @param file The target file path. #' #' @param format The Image format. #' Must be one of ("png", "jpeg", "bmp", "tiff", "emf", "svg", or "eps"). #' #' @param width The image width, in pixels. #' #' @param height The image height, in pixels. #' #' @note The \code{savePlotAsImage} function was introduced in RStudio 1.1.57. #' #' @export savePlotAsImage savePlotAsImage <- function(file, format = c("png", "jpeg", "bmp", "tiff", "emf", "svg", "eps"), width, height) { format <- match.arg(format) callFun("savePlotAsImage", file, format, width, height) } #' Send code to the R console #' #' Send code to the R console, and optionally execute it. #' #' @param code The \R code to be executed, as a character vector. #' #' @param execute Boolean; should the code be executed after being submitted #' to the console? If `FALSE`, `code` is submitted to the console but is #' not executed. #' #' @param echo Boolean; echo the code in the console as it is executed? #' #' @param focus Boolean; focus the console after sending code? #' #' @param animate Boolean; should the submitted code be animated, as if someone was typing it? #' #' @note The \code{sendToConsole} function was added in version 0.99.787 of #' RStudio. #' #' @examples #' #' \dontrun{ #' rstudioapi::sendToConsole(".Platform", execute = FALSE, animate = TRUE) #' } #' #' #' @export sendToConsole <- function(code, execute = TRUE, echo = TRUE, focus = TRUE, animate = FALSE) { callFun("sendToConsole", code = code, echo = echo, execute = execute, focus = focus, animate = animate) } #' Persistent keys and values #' #' Store persistent keys and values. Storage is per-project; if there is #' no project currently active, then a global store is used. #' #' @param name The key name. #' @param value The key value. #' @return The stored value as a character vector (\code{NULL} if no value #' of the specified name is available). #' #' @note The \code{setPersistentValue} and \code{getPersistentValue} functions #' were added in version 1.1.57 of RStudio. #' #' @name persistent-values #' @export setPersistentValue <- function(name, value) { callFun("setPersistentValue", name, value) } #' @rdname persistent-values #' @export getPersistentValue <- function(name) { callFun("getPersistentValue", name) } #' Check if console supports ANSI color escapes. #' #' Check if the RStudio console supports ANSI color escapes. #' #' #' @return `TRUE` if ANSI color escapes are supported; `FALSE` otherwise. #' #' @note The \code{hasColorConsole} function was added in version 1.1.216 of #' RStudio. #' #' @examples #' #' \dontrun{ #' if (rstudioapi::hasColorConsole()) { #' message("RStudio console supports ANSI color sequences.") #' } #' #' } #' #' #' @export hasColorConsole hasColorConsole <- function() { callFun("getConsoleHasColor") } #' Restart the R Session #' #' Restart the RStudio session. #' #' #' @param command A command (as a string) to be run after restarting. #' @param clean Boolean; when `FALSE`, the current \R session (including #' loaded packages and data objects) will be saved and restored in the #' new session. #' #' @note The \code{restartSession} function was added in version 1.1.281 of #' RStudio. Support for the `clean` argument was added for version 2024.04 #' release of RStudio; it is silently ignored in older versions of RStudio. #' #' @export restartSession <- function(command = "", clean = FALSE) { callFun("restartSession", command, clean) } #' Select a file / folder #' #' Prompt the user for the path to a file or folder, using the system file #' dialogs with RStudio Desktop, and RStudio's own dialogs with RStudio Server. #' #' When the selected file resolves within the user's home directory, #' RStudio will return an aliased path -- that is, prefixed with \code{~/}. #' #' @param caption The window title. #' @param label The label to use for the 'Accept' / 'OK' button. #' @param path The initial working directory, from which the file dialog #' should begin browsing. Defaults to the current RStudio #' project directory. #' @param filter A glob filter, to be used when attempting to open a file with a #' particular extension. For example, to scope the dialog to \R files, one could use #' \code{R Files (*.R)} here. #' @param existing Boolean; should the file dialog limit itself to existing #' files on the filesystem, or allow the user to select the path to a new file? #' #' @note The \code{selectFile} and \code{selectDirectory} functions were #' added in version 1.1.287 of RStudio. #' #' @name file-dialogs NULL #' @name file-dialogs #' @export selectFile <- function(caption = "Select File", label = "Select", path = getActiveProject(), filter = "All Files (*)", existing = TRUE) { out <- callFun("selectFile", caption, label, path, filter, existing) if (is.character(out)) Encoding(out) <- "UTF-8" out } #' @name file-dialogs #' @export selectDirectory <- function(caption = "Select Directory", label = "Select", path = getActiveProject()) { callFun("selectDirectory", caption, label, path) } #' Open a project in RStudio #' #' Initialize and open RStudio projects. #' #' Calling \code{openProject()} without arguments effectively re-opens the #' currently open project in RStudio. When switching projects, users will #' be prompted to save any unsaved files; alternatively, you can explicitly #' save any open documents using [documentSaveAll()]. #' #' @param path Either the path to an existing \code{.Rproj} file, or a path #' to a directory in which a new project should be initialized and opened. #' #' @param newSession Boolean; should the project be opened in a new session, #' or should the current RStudio session switch to that project? Note that #' \code{TRUE} values are only supported with RStudio Desktop and RStudio #' Server Pro. #' #' @note The \code{openProject} and \code{initializeProject} functions were #' added in version 1.1.287 of RStudio. #' #' @name projects NULL #' @name projects #' @export openProject <- function(path = NULL, newSession = FALSE) { callFun("openProject", path, newSession) } #' @name projects #' @export initializeProject <- function(path = getwd()) { callFun("initializeProject", path) } #' Set ghost text #' #' Set ghost text in the current document. The ghost text will be inserted at #' the current cursor position. Ghost text can be inserted into the document #' by pressing Tab, and will be automatically dismissed if the user navigates #' the cursor away. #' #' @param text The ghost text to set. #' #' @export setGhostText <- function(text) { callFun("setGhostText", text) } rstudioapi/R/prefs.R0000644000176200001440000000666114147112135014110 0ustar liggesusers#' Read Preference #' #' Reads a user preference, useful to remember preferences across different R #' sessions for the same user. #' #' User preferences can have arbitrary names and values. You must write the #' preference with \code{\link{writePreference}} before it can be read #' (otherwise its default value will be returned). #' #' @param name The name of the preference. #' @param default The default value to use when the preference is not #' available. #' @note The \code{readPreference} function was added in version 1.1.67 of #' RStudio. #' @seealso \code{\link{readRStudioPreference}}, which reads RStudio IDE #' preferences. #' @export readPreference readPreference <- function(name, default) { callFun("readPreference", name, default) } #' Write Preference #' #' Writes a user preference, useful to remember preferences across different R #' sessions for the same user. #' #' #' @param name The name of the preference. #' @param value The value of the preference. #' @note The \code{writePreference} function was added in version 1.1.67 of #' RStudio. #' @seealso \code{\link{writeRStudioPreference}}, which changes RStudio IDE #' preferences. #' @export writePreference writePreference <- function(name, value) { callFun("writePreference", name, value) } #' Write RStudio Preference #' #' Writes an internal RStudio IDE preference for the current user. #' #' RStudio IDE internal preferences include the values displayed in RStudio's #' Global Options dialog as well as a number of additional settings. Set them #' carefully; inappropriate values can cause unexpected behavior. See the #' RStudio Server Professional Administration Guide appendix for your version #' of RStudio for a full list of preference names and values. #' #' @param name The name of the preference. #' @param value The value of the preference. #' @note The \code{writeRStudioPreference} function was added in version #' 1.3.387 of RStudio. #' @seealso \code{\link{writePreference}}, which can be used to store arbitrary #' user (non-RStudio) preferences. #' #' \code{\link{readRStudioPreference}}, which reads internal RStudio IDE #' preferences. #' @examples #' #' \dontrun{ #' # Hide RStudio's toolbar. #' rstudioapi::writeRStudioPreference("toolbar_visible", FALSE) #' } #' #' #' @export writeRStudioPreference writeRStudioPreference <- function(name, value) { callFun("writeRStudioPreference", name, value) } #' Read RStudio Preference #' #' Reads an internal RStudio IDE preference for the current user. #' #' RStudio IDE internal preferences include the values displayed in RStudio's #' Global Options dialog as well as a number of additional settings. #' #' @param name The name of the preference. #' @param default The default value of the preference, returned if the #' preference is not found. #' @note The \code{readRStudioPreference} function was added in version 1.3.387 #' of RStudio. #' @seealso \code{\link{readPreference}}, which can be used to read arbitrary #' user (non-RStudio) preferences set with \code{\link{writePreference}}. #' #' \code{link{writeRStudioPreference}}, which can be used to write internal #' RStudio IDE preferences. #' @examples #' #' \dontrun{ #' # Get indentation settings #' spaces <- rstudioapi::readRStudioPreference("num_spaces_for_tab", FALSE) #' message("Using ", spaces, " per tab.") #' } #' #' #' @export readRStudioPreference readRStudioPreference <- function(name, default) { callFun("readRStudioPreference", name, default) } rstudioapi/R/urls.R0000644000176200001440000000171414147112135013750 0ustar liggesusers#' Translate Local URL #' #' Translates a local URL into an externally accessible URL on RStudio Server. #' #' On RStudio Server, URLs which refer to the local host network address (such #' as \code{http://localhost:1234/} and \code{http://127.0.0.1:5678/}) must be #' translated in order to be externally accessible from a browser. This method #' performs the required translation, and returns the translated URL, which #' RStudio Server uses to proxy HTTP requests. #' #' Returns an unmodified URL on RStudio Desktop, and when the URL does not #' refer to a local address. #' #' @param url The fully qualified URL to translate; for example, #' \code{http://localhost:1234/service/page.html}. #' @param absolute Whether to return a relative path URL (the default) or an #' absolute URL. #' @return The translated URL. #' @export translateLocalUrl translateLocalUrl <- function(url, absolute = FALSE) { callFun("translateLocalUrl", url = url, absolute = absolute) } rstudioapi/R/selections.R0000644000176200001440000000121014147112135015122 0ustar liggesusers #' Manipulate User Selections in the RStudio IDE #' #' These functions allow users of the `rstudioapi` package to read and write #' the user's current selection within the RStudio IDE. #' #' @param id The document ID. When `NULL` (the default), the active, or #' most-recently edited, document will be used. #' #' @param value The text contents to set for the selection. #' #' @name selections NULL #' @name selections #' @export selectionGet <- function(id = NULL) { callFun("selectionGet", id = id) } #' @name selections #' @export selectionSet <- function(value = NULL, id = NULL) { callFun("selectionSet", value = value, id = id) } rstudioapi/R/code.R0000644000176200001440000001172614706010411013674 0ustar liggesusers#' Check if RStudio is running #' #' Check if RStudio is running. #' #' @aliases isAvailable verifyAvailable #' #' @param version_needed An optional version specification. If supplied, ensures #' that RStudio is at least that version. #' #' @param child_ok Boolean; check if the current R process is a child process of #' the main RStudio session? This can be useful for e.g. RStudio Jobs, where #' you'd like to communicate back with the main R session from a child process #' through \code{rstudioapi}. #' #' @return \code{isAvailable} a boolean; \code{verifyAvailable} an error message #' if RStudio is not running #' #' @examples #' #' rstudioapi::isAvailable() #' \dontrun{rstudioapi::verifyAvailable()} #' #' @export isAvailable <- function(version_needed = NULL, child_ok = FALSE) { if (child_ok && isJob()) return(callRemote(sys.call(), parent.frame())) identical(.Platform$GUI, "RStudio") && version_ok(version_needed) } version_ok <- function(version = NULL) { if (is.null(version)) return(TRUE) getVersion() >= version } #' @rdname isAvailable #' @export verifyAvailable <- function(version_needed = NULL) { if (!isAvailable()) stop("RStudio not running", call. = FALSE) if (!version_ok(version_needed)) { stop("Need at least version ", version_needed, " of RStudio. ", "Currently running ", getVersion(), call. = FALSE) } invisible(TRUE) } #' Determine the version of RStudio #' #' Use `getVersion()` to determine the current version of RStudio. #' This can be useful for \R packages which need to gate certain functionality #' based on the version of RStudio currently available. #' #' @returns A `"numeric_version"` object, giving the version of RStudio in use. #' #' @export getVersion <- function() { # use API if available if (hasFun("getVersion")) return(callFun("getVersion")) # use fallback if not verifyAvailable() base <- .BaseNamespaceEnv version <- base$.Call("rs_rstudioVersion", PACKAGE = "(embedding)") package_version(version) } #' Report whether RStudio Desktop or RStudio Server is in use #' #' Use `getMode()` if you need to differentiate between server #' and desktop installations of RStudio. #' #' @returns "desktop" for RStudio Desktop installations, and #' "server" for RStudio Server / RStudio Workbench installations. #' #' @export getMode <- function() { # use API if available if (hasFun("getMode")) return(callFun("getMode")) # use fallback if not verifyAvailable() rstudio <- as.environment("tools:rstudio") if (rstudio$.rs.isDesktop()) "desktop" else "server" } #' Call an RStudio API function #' #' This function will return an error if RStudio is not running, or the #' function is not available. If you want to fall back to different behavior, #' use \code{\link{hasFun}}. #' #' #' @param fname name of the RStudio function to call. #' @param ... Other arguments passed on to the function #' @examples #' #' if (rstudioapi::isAvailable()) { #' rstudioapi::callFun("versionInfo") #' } #' #' @export callFun callFun <- function(fname, ...) { if (isJob()) return(callRemote(sys.call(), parent.frame())) verifyAvailable() # get reference to RStudio function f <- tryCatch(findFun(fname, mode = "function"), error = identity) if (inherits(f, "error")) stop("Function ", fname, " not found in RStudio", call. = FALSE) # drop arguments that aren't accepted by RStudio # (ensure backwards-compatibility with older versions of RStudio) args <- list(...) if (!"..." %in% names(formals(f))) if (length(args) > length(formals(f))) length(args) <- length(formals(f)) # invoke the function do.call(f, args) } #' Exists/get for RStudio functions #' #' These are specialized versions of \code{\link[base]{get}} and #' \code{\link[base]{exists}} that look in the rstudio package namespace. If #' RStudio is not running, \code{hasFun} will return \code{FALSE}. #' #' #' @aliases hasFun findFun #' @param name name of object to look for #' @param version_needed An optional version specification. If supplied, #' ensures that RStudio is at least that version. This is useful if function #' behavior has changed over time. #' @param ... other arguments passed on to \code{\link[base]{exists}} and #' \code{\link[base]{get}} #' @examples #' #' rstudioapi::hasFun("viewer") #' #' @export hasFun hasFun <- function(name, version_needed = NULL, ...) { if (!isAvailable(version_needed)) return(FALSE) if (usingTools()) return(exists(toolsName(name), toolsEnv(), ...)) exists(name, envir = asNamespace("rstudio"), ...) } #' @export #' @rdname hasFun findFun <- function(name, version_needed = NULL, ...) { verifyAvailable(version_needed) if (usingTools()) get(toolsName(name), toolsEnv(), ...) else get(name, envir = asNamespace("rstudio"), ...) } usingTools <- function() { exists(toolsName("versionInfo"), envir = toolsEnv()) } toolsName <- function(name) { paste(".rs.api.", name, sep="") } toolsEnv <- function() { as.environment(match("tools:rstudio", search())) } rstudioapi/R/dependencies.R0000644000176200001440000000151614147112135015411 0ustar liggesusers#' Get RStudio Package Dependencies #' #' Gets a list of the all the R packages that RStudio depends on in some way. #' #' The data frame of package dependencies contains the following columns: #' \describe{ \item{name}{The name of the R package.} \item{version}{The #' required minimum version of the R package.} \item{location}{Where RStudio #' expects the package to be, \code{cran} for a CRAN-like repository or #' \code{embedded} for development packages embedded in RStudio itself.} #' \item{source}{Whether the package should be installed from source.} } #' #' @return A data frame containing a row per R package. #' @note The \code{getRStudioPackageDependencies} function was introduced in #' RStudio 1.3.525. #' @export getRStudioPackageDependencies getRStudioPackageDependencies <- function() { callFun("getPackageDependencies") } rstudioapi/R/dictionaries.R0000644000176200001440000000133314502355251015440 0ustar liggesusers #' Interact with RStudio's Dictionaries #' #' Interact with the [hunspell](https://hunspell.github.io/) dictionaries #' used by RStudio for spell checking. #' #' `dictionariesPath()` gives a path to the dictionaries installed and #' distributed with RStudio. #' #' `userDictionariesPath()` gives the path where users can provide their #' own custom `hunspell` dictionaries. #' #' @note The `dictionariesPath()` and `userDictionariesPath()` functions were #' introduced with RStudio 1.2.1202. #' #' @name dictionaries NULL #' @name dictionaries #' @export dictionariesPath <- function() { callFun("dictionariesPath") } #' @name dictionaries #' @export userDictionariesPath <- function() { callFun("userDictionariesPath") } rstudioapi/R/dialogs.R0000644000176200001440000000763314703770712014424 0ustar liggesusers#' Show Dialog Box #' #' Shows a dialog box with a given title and contents. #' #' @param title The title to display in the dialog box. #' #' @param message A character vector with the contents to display in the main #' dialog area. Contents can contain the following HTML tags: "p", "em", #' "strong", "b" and "i". #' #' @param url An optional URL to display under the \code{message}. #' #' @param timeout A timeout (in seconds). When set, if the user takes #' longer than this timeout to provide a response, the request will be aborted. #' #' @note The \code{showDialog} function was added in version 1.1.67 of RStudio. #' #' @examples #' if (rstudioapi::isAvailable()) { #' rstudioapi::showDialog("Example Dialog", "This is an example dialog.") #' } #' #' @export showDialog <- function(title, message, url = "", timeout = 60) { opts <- options(rstudioapi.remote.timeout = timeout) on.exit(options(opts), add = TRUE) callFun("showDialog", title, message, url) } #' Updates a Dialog Box #' #' Updates specific properties from the current dialog box. #' #' Currently, the only dialog with support for this action is the New #' Connection dialog in which the code preview can be updated through this API. #' #' \preformatted{ updateDialog(code = "con <- NULL") } #' #' @param ... Named parameters and values to update a dialog box. #' @note The \code{updateDialog} function was added in version 1.1.67 of #' RStudio. #' @export updateDialog updateDialog <- function(...) { callFun("updateDialog", ...) } #' Show Prompt Dialog Box #' #' Shows a dialog box with a prompt field. #' #' #' @param title The title to display in the dialog box. #' #' @param message A character vector with the contents to display in the main #' dialog area. #' #' @param default An optional character vector that fills the prompt field with #' a default value. #' #' @param timeout A timeout (in seconds). When set, if the user takes #' longer than this timeout to provide a response, the request will be aborted. #' #' @note The \code{showPrompt} function was added in version 1.1.67 of RStudio. #' #' @export showPrompt showPrompt <- function(title, message, default = NULL, timeout = 60) { opts <- options(rstudioapi.remote.timeout = timeout) on.exit(options(opts), add = TRUE) callFun("showPrompt", title, message, default) } #' Show Question Dialog Box #' #' Shows a dialog box asking a question. #' #' @param title The title to display in the dialog box. #' #' @param message A character vector with the contents to display in the main #' dialog area. #' #' @param ok And optional character vector that overrides the caption for the #' OK button. #' #' @param cancel An optional character vector that overrides the caption for #' the Cancel button. #' #' @param timeout A timeout (in seconds). When set, if the user takes #' longer than this timeout to provide a response, the request will be aborted. #' #' @note The \code{showQuestion} function was added in version 1.1.67 of #' RStudio. #' #' @export showQuestion showQuestion <- function(title, message, ok = NULL, cancel = NULL, timeout = 60) { opts <- options(rstudioapi.remote.timeout = timeout) on.exit(options(opts), add = TRUE) callFun("showQuestion", title, message, ok, cancel) } #' Prompt user for secret #' #' Request a secret from the user. If the `keyring` package is installed, it #' will be used to cache requested secrets. #' #' #' @param name The name of the secret. #' #' @param message A character vector with the contents to display in the main #' dialog area. #' #' @param title The title to display in the dialog box. #' #' @note The \code{askForSecret} function was added in version 1.1.419 of #' RStudio. #' #' @export askForSecret <- function( name, message = paste(name, ":", sep = ""), title = paste(name, "Secret")) { if (hasFun("askForSecret") || isJob()) { callFun("askForSecret", name, title, message) } else { askForPassword(message) } } rstudioapi/vignettes/0000755000176200001440000000000014706010530014441 5ustar liggesusersrstudioapi/vignettes/terminal.Rmd0000644000176200001440000001103414502355251016725 0ustar liggesusers--- title: "Interacting with Terminals" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Interacting with Terminals} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include=FALSE} knitr::opts_chunk$set(eval = FALSE) ``` The `rstudioapi` package provides a collection of functions that can be used to interact with the RStudio terminal tab. There are two primary approaches to using these functions. 1. Use `terminalExecute()` to run a specific process with the output shown in a new terminal buffer, without blocking the current R session. 2. Create, query, and manipulate interactive terminals. This might be used to develop custom terminal behavior via an [RStudio addin](https://rstudio.github.io/rstudioaddins/). ## TerminalExecute Scenario ```{r} # Start a command with results displayed in a terminal buffer termId <- rstudioapi::terminalExecute("ping rstudio.com") # If viewing the result in the terminal buffer is sufficient, # then no need to do anything else. The command will continue # running and displaying its results without blocking the R session. # To obtain the results programmatically, wait for it to finish. while (is.null(rstudioapi::terminalExitCode(termId))) { Sys.sleep(0.1) } result <- rstudioapi::terminalBuffer(termId) # Delete the buffer and close the session in the IDE rstudioapi::terminalKill(termId) ``` ## Interative Terminal Scenario Several concepts are important to understand to make full use of these functions. ### Terminal Identifier Each terminal session has a unique **terminal identifier**, a required argument for most of the functions. A terminal identifier is generated and returned when a terminal is created via `terminalCreate()` or `terminalExecute()`, and identifiers of existing terminals can be obtained via `terminalList()` or `terminalVisible()`. ### Terminal Session A **terminal session** is an instance of a terminal that can be displayed in the RStudio terminal tab. A terminal session consists of: * a unique terminal identifier * a unique caption shown in the RStudio terminal dropdown (e.g. "Terminal 1") * a shell process (e.g. bash) running as a child process of the R session * zero or more processes running as children of the shell (e.g. commands) * an xterm-compatible terminal emulator in the terminal tab * a buffer of output shown in the terminal emulator (can be cleared via `terminalClear()`) ### Busy Terminal A terminal session with child processes running (excluding the shell), is considered **busy** and this is reflected in the IDE UI and can be queried with `terminalBusy()`. ### Terminal States In the most common situation, a terminal session has all the above features; however, it is possible for terminals to be in other states. **No shell process or child processes**: This happens if the associated R session has been closed (or suspended in the case of an inactive RStudio Server session). The `terminalRunning()` function returns `TRUE` if a terminal is in this state. If a terminal is not running, it can be started via interacting with it in the RStudio IDE, or via `terminalActivate()`. ```{r} # start an interactive terminal using the shell selected in # RStudio global options myTerm <- rstudioapi::terminalCreate() # .... # sometime later # .... if (!rstudioapi::terminalRunning(myTerm)) { # start the terminal shell back up, but don't bring to front rstudioapi::terminalActivate(myTerm, show = FALSE) # wait for it to start while (!rstudioapi::terminalRunning(myTerm)) { Sys.sleep(0.1) } # send a new command rstudioapi::terminalSend(myTerm, "echo Hello\n") } ``` **Running but not loaded in the IDE**: On RStudio Server, the web browser can be closed but the R session and any associated terminal sessions keep running. If the web browser is reconnected, each terminal will be redisplayed in the IDE when it is selected. The `rstudioapi` functions may be used on a terminal in this state; for example, the buffer may still be fetched with `terminalBuffer()` even if the terminal isn't loaded in the IDE (so long as the R session is still alive). **Terminated but still visible**: Normally the terminal emulator for a given terminal session will close when the shell exits. If the option **Close Terminal When Shell Exits** is turned off, then the terminal buffer will remain loaded in the RStudio IDE until closed by the user or `terminalKill()`. Terminals started with `terminalExecute()` will always remain loaded when they finish running. To test a terminal for this state, `terminalExitCode()` will return a non-NULL value. rstudioapi/vignettes/introduction.Rmd0000644000176200001440000000140114147112135017625 0ustar liggesusers--- title: "Introduction to rstudioapi" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Introduction to rstudioapi} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- The `rstudioapi` package provides an interface for interacting with the RStudio IDE with R code. Using `rstudioapi`, you can: - Examine, manipulate, and save the contents of documents currently open in RStudio, - Create, open, or re-open RStudio projects, - Prompt the user with different kinds of dialogs (e.g. for selecting a file or folder, or requesting a password from the user), - Interact with RStudio terminals, - Interact with the R session associated with the current RStudio instance. Please see the other articles for more detailed information. rstudioapi/vignettes/projects.Rmd0000644000176200001440000000120214147112135016734 0ustar liggesusers--- title: "Interacting with RStudio Projects" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Interacting with RStudio Projects} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include=FALSE} knitr::opts_chunk$set(eval = FALSE) ``` Users can create and open RStudio projects using the `rstudioapi` package. ```{r} # open a project in another directory rstudioapi::openProject("~/projects/t-sne-gene-expression-2017") # re-open the current project rstudioapi::openProject() # initialize an RStudio project (without opening it) rstudioapi::initializeProject("~/scratch/testbed") ``` rstudioapi/vignettes/visual-mode.Rmd0000644000176200001440000000474614147112135017350 0ustar liggesusers--- title: "Interfacing with RStudio in Visual Mode" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Interfacing with RStudio in Visual Mode} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ``` ```{r setup} library(rstudioapi) ``` RStudio v1.4 includes a new [visual editing mode](https://rstudio.github.io/visual-markdown-editing/#/), which provides a [WYSIWYM](https://en.wikipedia.org/wiki/WYSIWYM)-style editing interface for R Markdown documents. This vignette describes how `rstudioapi` can be used to interface with the RStudio visual mode editor. Most of the pre-existing `rstudioapi` functions used for interacting with a document (e.g. `rstudioapi::getSourceEditorContext()`) consume and / or produce objects which describe the position of the current selection in terms of row + column offsets into the document. Unfortunately, this abstraction does not neatly map into visual editing mode, as there is no notion of a "global" cursor position -- rather, a cursor might be placed into a particular cell, and could have an offset somewhere into that cell. If you are an [RStudio Addin](https://rstudio.github.io/rstudioaddins/) author, then you may want to ensure your addins are visual-mode-aware, so that they can function regardless of whether the user has enabled visual mode. To that end, we've introduced a small set of functions, which are more narrow in scope but can function in both source and visual mode: - `rstudioapi::documentId()`: Retrieve the ID associated with the document currently open and being edited in the RStudio IDE. - `rstudioapi::documentPath()`: Retrieve the path on disk for a file currently open in the RStudio IDE. - `rstudioapi::selectionGet()`: Get the contents of the user's selection. - `rstudioapi::selectionSet()`: Set the contents of the user's selection. In addition, the `rstudioapi::insertText()` function will function in both source and visual mode, as long as only the `text` argument is supplied. Using this, you can build addins that modify the user's selected text. For example, a function that uses `rstudioapi` to reformat the user's current selection might look like this: ```{r eval=FALSE} reformat <- function() { id <- rstudioapi::documentId(allowConsole = TRUE) selection <- rstudioapi::selectionGet(id = id) formatted <- styler::style_text(text = selection$value) rstudioapi::selectionSet(value = formatted, id = id) } ``` rstudioapi/vignettes/r-session.Rmd0000644000176200001440000000466214147112135017042 0ustar liggesusers--- title: "Interacting with the R Session" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Interact with the R Session} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include=FALSE} knitr::opts_chunk$set(eval = FALSE) ``` ## Detecting RStudio R code may need to determine whether it's being run within an RStudio session, versus a plain R session or something similar. ```{r eval=FALSE} # check that RStudio is available via rstudioapi -- note that this must # be checked prior to calling any other rstudioapi APIs! if (rstudioapi::isAvailable()) { # determine more information via info <- rstudioapi::versionInfo() # check for desktop mode info$mode == "desktop" # check for server mode info$mode == "server" # check the version of RStudio in use info$version >= "1.4" } # check whether RStudio is running without relying on rstudioapi .Platform$GUI == "RStudio" # NOTE: may be unreliable in .Rprofile commandArgs()[[1]] == "RStudio" ``` A note: the `RSTUDIO` environment variable will be set both within the main RStudio session, but also within child processes launched by RStudio. If you need to specifically detect if your code is running within the main RStudio session, we recommend using an alternate mechanism. ## Session Interaction The `rstudioapi` package allows you to interact with the running R session in a couple useful ways: you can send code to the R console, or restart the R session. ```{r} # restart R, then run some code after rstudioapi::restartSession(command = "print('Welcome back!')") # send some code to the console and execute it immediately rstudioapi::sendToConsole("1 + 1", execute = TRUE) ``` ## Running at Startup Typically, code that you want to run at the start of an R session is placed into an `.Rprofile` file (see [Initialization at the Start of a Session](https://stat.ethz.ch/R-manual/R-devel/library/base/html/Startup.html) for details). However, RStudio's API hooks are not available until RStudio has fully started up, so most `rstudioapi` methods will not work inside `.Rprofile`. If you want to invoke `rstudioapi` methods on session startup, use the `rstudio.sessionInit` hook. For example, to print the RStudio version to the R console when the session begins: ```{r} setHook("rstudio.sessionInit", function(newSession) { if (newSession) message("Welcome to RStudio ", rstudioapi::getVersion()) }, action = "append") ``` rstudioapi/vignettes/document-manipulation.Rmd0000644000176200001440000000407414147112135021431 0ustar liggesusers--- title: "Document Manipulation" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Document Manipulation} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup} knitr::opts_chunk$set(eval = FALSE) ``` The `rstudioapi` package provides a small family of functions that can be used to interact with documents open in an RStudio session. For example, the following code could be used to insert a 'last modified' comment at the start of a document: ```{r} # construct the text to be inserted fmt <- "# This document was last modified on %s.\n" text <- sprintf(fmt, Sys.Date()) # specify a range where this text should be inserted; here, # we use the first line; that is, the 'range' between the start # of the first row, and the start of the second row range <- rstudioapi::document_range(c(1, 0), c(2, 0)) rstudioapi::insertText(range, text) ``` By default, these APIs target the editor instance either currently focused by the user, or when no such editor is currently focused, the last focused editor. If you need to target a specific editor instance (for example, you want to write code that inserts text into the console), you can use `getConsoleEditorContext()` to get the `id` for the console editor: ```{r} # get console editor id context <- rstudioapi::getConsoleEditorContext() id <- context$id # send some R code to the console rstudioapi::insertText(text = "print(1 + 1)", id = id) # see also: `getActiveEditorContext()`, `getSourceEditorContext()` ``` You can also modify the cursor position through the use of the `setCursorPosition()` and `setSelectionRanges()` APIs. ```{r} # put the cursor at the end of the document -- note that here, # `Inf` is automatically truncated to the actual length of the # document rstudioapi::setCursorPosition(Inf) # select the first 10 even lines in the document ranges <- lapply(seq(2, by = 2, length.out = 10), function(start) { rstudioapi::document_range( c(start, 0), c(start, Inf) ) }) rstudioapi::setSelectionRanges(ranges) ``` See the `?"rstudio-documents"` help page for more details. rstudioapi/vignettes/dialogs.Rmd0000644000176200001440000000316614147112135016540 0ustar liggesusers--- title: "File Dialogs" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{File Dialogs} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include=FALSE} knitr::opts_chunk$set(eval = FALSE) ``` Using the `rstudioapi` package, you can request input from the user with various dialogs. The `selectFile()` and `selectDirectory()` APIs allow you to request the name of an existing or non-existing path on the system. ```{r} # request the path to an existing .csv file on disk path <- rstudioapi::selectFile(caption = "Select CSV File", filter = "CSV Files (*.csv)", existing = TRUE) # now, you could read the data using e.g. 'readr::read_csv()' data <- readr::read_csv(path) # request a file path (e.g. where you would like to save a new file) target <- rstudioapi::selectFile(caption = "Save File", label = "Save", existing = FALSE) # save data to the path provided by the user saveRDS(data, file = target) ``` Use `rstudioapi::askForPassword()` to request a password, or other credentials, from a user. ```{r} token <- rstudioapi::askForPassword( prompt = "Please provide your GitHub access token." ) ``` Use `rstudioapi::showDialog()` to display an informative dialog to the user. This dialog is used to report some kind of status or information to the user; it does not request any input. ```{r} rstudioapi::showDialog(title = "Hello, world!", message = "You're awesome!", url = "http://www.example.com") ``` rstudioapi/NAMESPACE0000644000176200001440000000657014703772430013673 0ustar liggesusers# Generated by roxygen2: do not edit by hand S3method(as.document_position,default) S3method(as.document_position,document_position) S3method(as.document_range,default) S3method(as.document_range,document_range) S3method(format,document_position) S3method(format,document_range) S3method(primary_selection,document_context) S3method(primary_selection,document_selection) S3method(print,document_context) S3method(print,document_position) S3method(print,document_range) S3method(print,document_selection) export(addTheme) export(applyTheme) export(as.document_position) export(as.document_range) export(askForPassword) export(askForSecret) export(bugReport) export(buildToolsCheck) export(buildToolsExec) export(buildToolsInstall) export(callFun) export(convertTheme) export(createProjectTemplate) export(dictionariesPath) export(documentClose) export(documentId) export(documentNew) export(documentOpen) export(documentPath) export(documentSave) export(documentSaveAll) export(document_position) export(document_range) export(executeCommand) export(filesPaneNavigate) export(findFun) export(getActiveDocumentContext) export(getActiveProject) export(getConsoleEditorContext) export(getDelegatedAzureToken) export(getMode) export(getPersistentValue) export(getRStudioPackageDependencies) export(getSourceEditorContext) export(getThemeInfo) export(getThemes) export(getVersion) export(hasColorConsole) export(hasFun) export(highlightUi) export(initializeProject) export(insertText) export(is.document_position) export(is.document_range) export(isAvailable) export(isBackgroundJob) export(isJob) export(isWorkbenchJob) export(jobAdd) export(jobAddOutput) export(jobAddProgress) export(jobGetState) export(jobList) export(jobRemove) export(jobRunScript) export(jobSetProgress) export(jobSetState) export(jobSetStatus) export(launcherAvailable) export(launcherConfig) export(launcherContainer) export(launcherControlJob) export(launcherGetInfo) export(launcherGetJob) export(launcherGetJobs) export(launcherHostMount) export(launcherNfsMount) export(launcherPlacementConstraint) export(launcherResourceLimit) export(launcherSubmitJob) export(launcherSubmitR) export(modifyRange) export(navigateToFile) export(openProject) export(previewRd) export(previewSql) export(primary_selection) export(readPreference) export(readRStudioPreference) export(registerChunkCallback) export(registerCommandCallback) export(registerCommandStreamCallback) export(removeTheme) export(restartSession) export(savePlotAsImage) export(selectDirectory) export(selectFile) export(selectionGet) export(selectionSet) export(sendToConsole) export(setCursorPosition) export(setDocumentContents) export(setGhostText) export(setPersistentValue) export(setSelectionRanges) export(showDialog) export(showPrompt) export(showQuestion) export(sourceMarkers) export(systemUsername) export(terminalActivate) export(terminalBuffer) export(terminalBusy) export(terminalClear) export(terminalContext) export(terminalCreate) export(terminalExecute) export(terminalExitCode) export(terminalKill) export(terminalList) export(terminalRunning) export(terminalSend) export(terminalVisible) export(translateLocalUrl) export(unregisterChunkCallback) export(unregisterCommandCallback) export(updateDialog) export(userDictionariesPath) export(userIdentity) export(verifyAvailable) export(versionInfo) export(viewer) export(writePreference) export(writeRStudioPreference) importFrom(utils,capture.output) rstudioapi/LICENSE0000644000176200001440000000004514147112135013440 0ustar liggesusersYEAR: 2015 COPYRIGHT HOLDER: RStudio rstudioapi/NEWS.md0000644000176200001440000001134014706010461013531 0ustar liggesusers# rstudioapi 0.17.1 * Ensure a more appropriate error message is emitted for calls to `rstudioapi::getVersion()` and `rstudioapi::getMode()` outside of RStudio. # rstudioapi 0.17.0 * Added `getMode()`, which can be used to differentiate between Desktop and Server installations of RStudio. (#280) # rstudioapi 0.16.0 * `restartSession()` gains the `clean` argument, for RStudio 2024.04 and newer. * Added `setGhostText()` for setting ghost text in the current editor. # rstudioapi 0.15.0 * Added `getDelegatedAzureToken` for Posit Workbench users needing to expose OAuth2 tokens for Azure services that have already had permissions configured # rstudioapi 0.14 * `documentPath()` now marks the encoding of file paths as UTF-8. (#257) * `getSourceEditorContext()` gains the `id` argument, to be used to request the editor context for a document with an already-known ID. (#251) * Added `documentOpen()`, for opening a document in RStudio and optionally navigating the cursor to a particular point in the file. The method is synchronous and returns the document ID upon completion. * Fixed an issue where `rstudioapi::askForSecret()` would erroneously fall back to using `rstudioapi::askForPassword()` during Knit. * Added `registerCommandCallback`, `registerCommandStreamCallback`, and `unregisterCommandCallback`, used to execute a callback after an IDE command is executed. # rstudioapi 0.13 * Fixed an issue where `rstudioapi::insertText()` would fail. (#208) # rstudioapi 0.12 * Fixed an issue where remote `rstudioapi` calls would erroneously use a previous response in some cases. * Allow `navigateToFile` to accept an empty file. This file will default to the file currently in view in the active column. * Added `registerChunkExecCallback` and `unregisterChunkExecCallback`, used to execute a callback after a chunk is ran. # rstudioapi 0.11 * `rstudioapi::launcherResourceLimit()` now properly delegates the type and memory arguments. (#164) * `rstudioapi` gains the function `highlightUi()`, used to highlight UI elements in newer versions of RStudio. * Paths returned from `selectFile()` are now properly marked with UTF-8 encoding. * It is now possible for `rstudioapi` to communicate with a parent RStudio session, for R sessions launched as RStudio jobs. Use `rstudioapi::isAvailable(child_ok = TRUE)` to assert that it's okay to check that `rstudioapi` is available and is running within an RStudio job. * Added `bugReport()`, a helper function for reporting RStudio bugs on the GitHub issue tracker with an issue template pre-populated with some helpful diagnostic information. * Added `userIdentity` and `systemUsername`, used to retrieve information about the current user. # rstudioapi 0.10 * Added the parameters `echo` and `focus` to `sendToConsole()`. # rstudioapi 0.9 * Added functions for displaying jobs in RStudio's Jobs pane: `jobAdd()`, `jobRemove()`, etc. * Added `translateLocalUrl()`, for translating localhost URLs to externally addressable ones on RStudio Server. # rstudioapi 0.8 * Added functions for installing + using build tools: `buildToolsCheck()`, `buildToolsInstall()`, `buildToolsExec()` * Added functions for installing + using themes: `addTheme()`, `applyTheme()`, `convertTheme()`, `getThemes()`, `getThemeInfo()`. * Added `previewSql()`, for previewing output from executing a SQL query. * Added `askForSecret()`, for prompting the user to enter a password or otherwise privileged information. * Fixed an issue where `getActiveProject()` failed for non-ASCII paths. (#86) # rstudioapi 0.7 * Added methods for prompting the user for file paths: `selectFile()`, `selectDirectory()`. * `askForPassword()` gains a default prompt (#41) * Add `createProjectTemplate()` function * Add `setPersistentValue()` / `getPersistentValue()` functions * Add methods for interacting with Terminal tab: `terminalActivate()`, `terminalClear()`, `terminalCreate()`, `terminalList()`, `terminalBuffer()`, `terminalContext()`, `terminalVisible()`, `terminalBusy()`, `terminalRunning()`, `terminalKill()`, `terminalSend()`, `terminalExecute()`, and `terminalExitCode()`. # rstudioapi 0.6 * Add sendToConsole function * Add APIs for setting cursor position in document # rstudioapi 0.5 * Add askForPassword function * Add getActiveProject function # rstudioapi 0.4 * Add API methods for interacting with a document open in RStudio: 'insertText()', 'modifyRange()' and 'getActiveDocumentContext()'. # rstudioapi 0.3 * Add stub and documentation for sourceMarker function # rstudioapi 0.2 * Compatibility with calling conventions for RStudio v0.99 * Stubs and documentation for versionInfo, previewRd, and viewer functions # rstudioapi 0.1 * Initial release to CRAN rstudioapi/inst/0000755000176200001440000000000014706010530013406 5ustar liggesusersrstudioapi/inst/resources/0000755000176200001440000000000014703770710015432 5ustar liggesusersrstudioapi/inst/resources/bug-report.md0000644000176200001440000000321014703770710020036 0ustar liggesusers ### System details RStudio Edition : ${RSTUDIO_EDITION} RStudio Version : ${RSTUDIO_VERSION} OS Version : ${OS_VERSION} R Version : ${R_VERSION} ### Steps to reproduce the problem ### Describe the problem in detail ### Describe the behavior you expected - [ ] I have read the guide for [submitting good bug reports](https://github.com/rstudio/rstudio/wiki/Writing-Good-Bug-Reports). - [ ] I have installed the latest version of RStudio, and confirmed that the issue still persists. - [ ] If I am reporting an RStudio crash, I have included a [diagnostics report](https://support.posit.co/hc/en-us/articles/200321257-Running-a-Diagnostics-Report). - [ ] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue. rstudioapi/inst/doc/0000755000176200001440000000000014706010530014153 5ustar liggesusersrstudioapi/inst/doc/r-session.R0000644000176200001440000000256014706010527016231 0ustar liggesusers## ----setup, include=FALSE----------------------------------------------------- knitr::opts_chunk$set(eval = FALSE) ## ----eval=FALSE--------------------------------------------------------------- # # check that RStudio is available via rstudioapi -- note that this must # # be checked prior to calling any other rstudioapi APIs! # if (rstudioapi::isAvailable()) { # # # determine more information via # info <- rstudioapi::versionInfo() # # # check for desktop mode # info$mode == "desktop" # # # check for server mode # info$mode == "server" # # # check the version of RStudio in use # info$version >= "1.4" # # } # # # check whether RStudio is running without relying on rstudioapi # .Platform$GUI == "RStudio" # NOTE: may be unreliable in .Rprofile # commandArgs()[[1]] == "RStudio" ## ----------------------------------------------------------------------------- # # restart R, then run some code after # rstudioapi::restartSession(command = "print('Welcome back!')") # # # send some code to the console and execute it immediately # rstudioapi::sendToConsole("1 + 1", execute = TRUE) ## ----------------------------------------------------------------------------- # setHook("rstudio.sessionInit", function(newSession) { # if (newSession) # message("Welcome to RStudio ", rstudioapi::getVersion()) # }, action = "append") rstudioapi/inst/doc/visual-mode.html0000644000176200001440000002722414706010530017275 0ustar liggesusers Interfacing with RStudio in Visual Mode

Interfacing with RStudio in Visual Mode

library(rstudioapi)

RStudio v1.4 includes a new visual editing mode, which provides a WYSIWYM-style editing interface for R Markdown documents. This vignette describes how rstudioapi can be used to interface with the RStudio visual mode editor.

Most of the pre-existing rstudioapi functions used for interacting with a document (e.g. rstudioapi::getSourceEditorContext()) consume and / or produce objects which describe the position of the current selection in terms of row + column offsets into the document. Unfortunately, this abstraction does not neatly map into visual editing mode, as there is no notion of a “global†cursor position – rather, a cursor might be placed into a particular cell, and could have an offset somewhere into that cell.

If you are an RStudio Addin author, then you may want to ensure your addins are visual-mode-aware, so that they can function regardless of whether the user has enabled visual mode. To that end, we’ve introduced a small set of functions, which are more narrow in scope but can function in both source and visual mode:

  • rstudioapi::documentId(): Retrieve the ID associated with the document currently open and being edited in the RStudio IDE.
  • rstudioapi::documentPath(): Retrieve the path on disk for a file currently open in the RStudio IDE.
  • rstudioapi::selectionGet(): Get the contents of the user’s selection.
  • rstudioapi::selectionSet(): Set the contents of the user’s selection.

In addition, the rstudioapi::insertText() function will function in both source and visual mode, as long as only the text argument is supplied.

Using this, you can build addins that modify the user’s selected text. For example, a function that uses rstudioapi to reformat the user’s current selection might look like this:

reformat <- function() {
  id <- rstudioapi::documentId(allowConsole = TRUE)
  selection <- rstudioapi::selectionGet(id = id)
  formatted <- styler::style_text(text = selection$value)
  rstudioapi::selectionSet(value = formatted, id = id)
}
rstudioapi/inst/doc/r-session.html0000644000176200001440000003377614706010527017011 0ustar liggesusers Interacting with the R Session

Interacting with the R Session

Detecting RStudio

R code may need to determine whether it’s being run within an RStudio session, versus a plain R session or something similar.

# check that RStudio is available via rstudioapi -- note that this must
# be checked prior to calling any other rstudioapi APIs!
if (rstudioapi::isAvailable()) {

  # determine more information via 
  info <- rstudioapi::versionInfo()
  
  # check for desktop mode
  info$mode == "desktop"
  
  # check for server mode
  info$mode == "server"
  
  # check the version of RStudio in use
  info$version >= "1.4"
  
}

# check whether RStudio is running without relying on rstudioapi
.Platform$GUI == "RStudio"  # NOTE: may be unreliable in .Rprofile
commandArgs()[[1]] == "RStudio"

A note: the RSTUDIO environment variable will be set both within the main RStudio session, but also within child processes launched by RStudio. If you need to specifically detect if your code is running within the main RStudio session, we recommend using an alternate mechanism.

Session Interaction

The rstudioapi package allows you to interact with the running R session in a couple useful ways: you can send code to the R console, or restart the R session.

# restart R, then run some code after
rstudioapi::restartSession(command = "print('Welcome back!')")

# send some code to the console and execute it immediately
rstudioapi::sendToConsole("1 + 1", execute = TRUE)

Running at Startup

Typically, code that you want to run at the start of an R session is placed into an .Rprofile file (see Initialization at the Start of a Session for details). However, RStudio’s API hooks are not available until RStudio has fully started up, so most rstudioapi methods will not work inside .Rprofile.

If you want to invoke rstudioapi methods on session startup, use the rstudio.sessionInit hook. For example, to print the RStudio version to the R console when the session begins:

setHook("rstudio.sessionInit", function(newSession) {
  if (newSession)
    message("Welcome to RStudio ", rstudioapi::getVersion())
}, action = "append")
rstudioapi/inst/doc/projects.html0000644000176200001440000002257314706010527016711 0ustar liggesusers Interacting with RStudio Projects

Interacting with RStudio Projects

Users can create and open RStudio projects using the rstudioapi package.

# open a project in another directory
rstudioapi::openProject("~/projects/t-sne-gene-expression-2017")

# re-open the current project
rstudioapi::openProject()

# initialize an RStudio project (without opening it)
rstudioapi::initializeProject("~/scratch/testbed")
rstudioapi/inst/doc/terminal.Rmd0000644000176200001440000001103414502355251016437 0ustar liggesusers--- title: "Interacting with Terminals" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Interacting with Terminals} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include=FALSE} knitr::opts_chunk$set(eval = FALSE) ``` The `rstudioapi` package provides a collection of functions that can be used to interact with the RStudio terminal tab. There are two primary approaches to using these functions. 1. Use `terminalExecute()` to run a specific process with the output shown in a new terminal buffer, without blocking the current R session. 2. Create, query, and manipulate interactive terminals. This might be used to develop custom terminal behavior via an [RStudio addin](https://rstudio.github.io/rstudioaddins/). ## TerminalExecute Scenario ```{r} # Start a command with results displayed in a terminal buffer termId <- rstudioapi::terminalExecute("ping rstudio.com") # If viewing the result in the terminal buffer is sufficient, # then no need to do anything else. The command will continue # running and displaying its results without blocking the R session. # To obtain the results programmatically, wait for it to finish. while (is.null(rstudioapi::terminalExitCode(termId))) { Sys.sleep(0.1) } result <- rstudioapi::terminalBuffer(termId) # Delete the buffer and close the session in the IDE rstudioapi::terminalKill(termId) ``` ## Interative Terminal Scenario Several concepts are important to understand to make full use of these functions. ### Terminal Identifier Each terminal session has a unique **terminal identifier**, a required argument for most of the functions. A terminal identifier is generated and returned when a terminal is created via `terminalCreate()` or `terminalExecute()`, and identifiers of existing terminals can be obtained via `terminalList()` or `terminalVisible()`. ### Terminal Session A **terminal session** is an instance of a terminal that can be displayed in the RStudio terminal tab. A terminal session consists of: * a unique terminal identifier * a unique caption shown in the RStudio terminal dropdown (e.g. "Terminal 1") * a shell process (e.g. bash) running as a child process of the R session * zero or more processes running as children of the shell (e.g. commands) * an xterm-compatible terminal emulator in the terminal tab * a buffer of output shown in the terminal emulator (can be cleared via `terminalClear()`) ### Busy Terminal A terminal session with child processes running (excluding the shell), is considered **busy** and this is reflected in the IDE UI and can be queried with `terminalBusy()`. ### Terminal States In the most common situation, a terminal session has all the above features; however, it is possible for terminals to be in other states. **No shell process or child processes**: This happens if the associated R session has been closed (or suspended in the case of an inactive RStudio Server session). The `terminalRunning()` function returns `TRUE` if a terminal is in this state. If a terminal is not running, it can be started via interacting with it in the RStudio IDE, or via `terminalActivate()`. ```{r} # start an interactive terminal using the shell selected in # RStudio global options myTerm <- rstudioapi::terminalCreate() # .... # sometime later # .... if (!rstudioapi::terminalRunning(myTerm)) { # start the terminal shell back up, but don't bring to front rstudioapi::terminalActivate(myTerm, show = FALSE) # wait for it to start while (!rstudioapi::terminalRunning(myTerm)) { Sys.sleep(0.1) } # send a new command rstudioapi::terminalSend(myTerm, "echo Hello\n") } ``` **Running but not loaded in the IDE**: On RStudio Server, the web browser can be closed but the R session and any associated terminal sessions keep running. If the web browser is reconnected, each terminal will be redisplayed in the IDE when it is selected. The `rstudioapi` functions may be used on a terminal in this state; for example, the buffer may still be fetched with `terminalBuffer()` even if the terminal isn't loaded in the IDE (so long as the R session is still alive). **Terminated but still visible**: Normally the terminal emulator for a given terminal session will close when the shell exits. If the option **Close Terminal When Shell Exits** is turned off, then the terminal buffer will remain loaded in the RStudio IDE until closed by the user or `terminalKill()`. Terminals started with `terminalExecute()` will always remain loaded when they finish running. To test a terminal for this state, `terminalExitCode()` will return a non-NULL value. rstudioapi/inst/doc/terminal.R0000644000176200001440000000267214706010527016126 0ustar liggesusers## ----setup, include=FALSE----------------------------------------------------- knitr::opts_chunk$set(eval = FALSE) ## ----------------------------------------------------------------------------- # # Start a command with results displayed in a terminal buffer # termId <- rstudioapi::terminalExecute("ping rstudio.com") # # # If viewing the result in the terminal buffer is sufficient, # # then no need to do anything else. The command will continue # # running and displaying its results without blocking the R session. # # # To obtain the results programmatically, wait for it to finish. # while (is.null(rstudioapi::terminalExitCode(termId))) { # Sys.sleep(0.1) # } # # result <- rstudioapi::terminalBuffer(termId) # # # Delete the buffer and close the session in the IDE # rstudioapi::terminalKill(termId) ## ----------------------------------------------------------------------------- # # start an interactive terminal using the shell selected in # # RStudio global options # myTerm <- rstudioapi::terminalCreate() # # # .... # # sometime later # # .... # if (!rstudioapi::terminalRunning(myTerm)) { # # start the terminal shell back up, but don't bring to front # rstudioapi::terminalActivate(myTerm, show = FALSE) # # # wait for it to start # while (!rstudioapi::terminalRunning(myTerm)) { # Sys.sleep(0.1) # } # # # send a new command # rstudioapi::terminalSend(myTerm, "echo Hello\n") # } rstudioapi/inst/doc/introduction.Rmd0000644000176200001440000000140114147112135017337 0ustar liggesusers--- title: "Introduction to rstudioapi" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Introduction to rstudioapi} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- The `rstudioapi` package provides an interface for interacting with the RStudio IDE with R code. Using `rstudioapi`, you can: - Examine, manipulate, and save the contents of documents currently open in RStudio, - Create, open, or re-open RStudio projects, - Prompt the user with different kinds of dialogs (e.g. for selecting a file or folder, or requesting a password from the user), - Interact with RStudio terminals, - Interact with the R session associated with the current RStudio instance. Please see the other articles for more detailed information. rstudioapi/inst/doc/document-manipulation.html0000644000176200001440000003351214706010526021366 0ustar liggesusers Document Manipulation

Document Manipulation

knitr::opts_chunk$set(eval = FALSE)

The rstudioapi package provides a small family of functions that can be used to interact with documents open in an RStudio session. For example, the following code could be used to insert a ‘last modified’ comment at the start of a document:

# construct the text to be inserted
fmt <- "# This document was last modified on %s.\n"
text <- sprintf(fmt, Sys.Date())

# specify a range where this text should be inserted; here,
# we use the first line; that is, the 'range' between the start
# of the first row, and the start of the second row
range <- rstudioapi::document_range(c(1, 0), c(2, 0))
rstudioapi::insertText(range, text)

By default, these APIs target the editor instance either currently focused by the user, or when no such editor is currently focused, the last focused editor. If you need to target a specific editor instance (for example, you want to write code that inserts text into the console), you can use getConsoleEditorContext() to get the id for the console editor:

# get console editor id
context <- rstudioapi::getConsoleEditorContext()
id <- context$id

# send some R code to the console
rstudioapi::insertText(text = "print(1 + 1)", id = id)

# see also: `getActiveEditorContext()`, `getSourceEditorContext()`

You can also modify the cursor position through the use of the setCursorPosition() and setSelectionRanges() APIs.

# put the cursor at the end of the document -- note that here,
# `Inf` is automatically truncated to the actual length of the
# document
rstudioapi::setCursorPosition(Inf)

# select the first 10 even lines in the document
ranges <- lapply(seq(2, by = 2, length.out = 10), function(start) {
  rstudioapi::document_range(
    c(start, 0),
    c(start, Inf)
  )
})
rstudioapi::setSelectionRanges(ranges)

See the ?"rstudio-documents" help page for more details.

rstudioapi/inst/doc/projects.Rmd0000644000176200001440000000120214147112135016446 0ustar liggesusers--- title: "Interacting with RStudio Projects" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Interacting with RStudio Projects} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include=FALSE} knitr::opts_chunk$set(eval = FALSE) ``` Users can create and open RStudio projects using the `rstudioapi` package. ```{r} # open a project in another directory rstudioapi::openProject("~/projects/t-sne-gene-expression-2017") # re-open the current project rstudioapi::openProject() # initialize an RStudio project (without opening it) rstudioapi::initializeProject("~/scratch/testbed") ``` rstudioapi/inst/doc/document-manipulation.R0000644000176200001440000000272314706010526020623 0ustar liggesusers## ----setup-------------------------------------------------------------------- knitr::opts_chunk$set(eval = FALSE) ## ----------------------------------------------------------------------------- # # construct the text to be inserted # fmt <- "# This document was last modified on %s.\n" # text <- sprintf(fmt, Sys.Date()) # # # specify a range where this text should be inserted; here, # # we use the first line; that is, the 'range' between the start # # of the first row, and the start of the second row # range <- rstudioapi::document_range(c(1, 0), c(2, 0)) # rstudioapi::insertText(range, text) ## ----------------------------------------------------------------------------- # # get console editor id # context <- rstudioapi::getConsoleEditorContext() # id <- context$id # # # send some R code to the console # rstudioapi::insertText(text = "print(1 + 1)", id = id) # # # see also: `getActiveEditorContext()`, `getSourceEditorContext()` ## ----------------------------------------------------------------------------- # # put the cursor at the end of the document -- note that here, # # `Inf` is automatically truncated to the actual length of the # # document # rstudioapi::setCursorPosition(Inf) # # # select the first 10 even lines in the document # ranges <- lapply(seq(2, by = 2, length.out = 10), function(start) { # rstudioapi::document_range( # c(start, 0), # c(start, Inf) # ) # }) # rstudioapi::setSelectionRanges(ranges) rstudioapi/inst/doc/visual-mode.Rmd0000644000176200001440000000474614147112135017062 0ustar liggesusers--- title: "Interfacing with RStudio in Visual Mode" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Interfacing with RStudio in Visual Mode} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ``` ```{r setup} library(rstudioapi) ``` RStudio v1.4 includes a new [visual editing mode](https://rstudio.github.io/visual-markdown-editing/#/), which provides a [WYSIWYM](https://en.wikipedia.org/wiki/WYSIWYM)-style editing interface for R Markdown documents. This vignette describes how `rstudioapi` can be used to interface with the RStudio visual mode editor. Most of the pre-existing `rstudioapi` functions used for interacting with a document (e.g. `rstudioapi::getSourceEditorContext()`) consume and / or produce objects which describe the position of the current selection in terms of row + column offsets into the document. Unfortunately, this abstraction does not neatly map into visual editing mode, as there is no notion of a "global" cursor position -- rather, a cursor might be placed into a particular cell, and could have an offset somewhere into that cell. If you are an [RStudio Addin](https://rstudio.github.io/rstudioaddins/) author, then you may want to ensure your addins are visual-mode-aware, so that they can function regardless of whether the user has enabled visual mode. To that end, we've introduced a small set of functions, which are more narrow in scope but can function in both source and visual mode: - `rstudioapi::documentId()`: Retrieve the ID associated with the document currently open and being edited in the RStudio IDE. - `rstudioapi::documentPath()`: Retrieve the path on disk for a file currently open in the RStudio IDE. - `rstudioapi::selectionGet()`: Get the contents of the user's selection. - `rstudioapi::selectionSet()`: Set the contents of the user's selection. In addition, the `rstudioapi::insertText()` function will function in both source and visual mode, as long as only the `text` argument is supplied. Using this, you can build addins that modify the user's selected text. For example, a function that uses `rstudioapi` to reformat the user's current selection might look like this: ```{r eval=FALSE} reformat <- function() { id <- rstudioapi::documentId(allowConsole = TRUE) selection <- rstudioapi::selectionGet(id = id) formatted <- styler::style_text(text = selection$value) rstudioapi::selectionSet(value = formatted, id = id) } ``` rstudioapi/inst/doc/projects.R0000644000176200001440000000075114706010526016137 0ustar liggesusers## ----setup, include=FALSE----------------------------------------------------- knitr::opts_chunk$set(eval = FALSE) ## ----------------------------------------------------------------------------- # # open a project in another directory # rstudioapi::openProject("~/projects/t-sne-gene-expression-2017") # # # re-open the current project # rstudioapi::openProject() # # # initialize an RStudio project (without opening it) # rstudioapi::initializeProject("~/scratch/testbed") rstudioapi/inst/doc/terminal.html0000644000176200001440000004136314706010527016671 0ustar liggesusers Interacting with Terminals

Interacting with Terminals

The rstudioapi package provides a collection of functions that can be used to interact with the RStudio terminal tab.

There are two primary approaches to using these functions.

  1. Use terminalExecute() to run a specific process with the output shown in a new terminal buffer, without blocking the current R session.

  2. Create, query, and manipulate interactive terminals. This might be used to develop custom terminal behavior via an RStudio addin.

TerminalExecute Scenario

# Start a command with results displayed in a terminal buffer
termId <- rstudioapi::terminalExecute("ping rstudio.com")

# If viewing the result in the terminal buffer is sufficient,
# then no need to do anything else. The command will continue
# running and displaying its results without blocking the R session.

# To obtain the results programmatically, wait for it to finish.
while (is.null(rstudioapi::terminalExitCode(termId))) {
  Sys.sleep(0.1)
}

result <- rstudioapi::terminalBuffer(termId)

# Delete the buffer and close the session in the IDE
rstudioapi::terminalKill(termId)

Interative Terminal Scenario

Several concepts are important to understand to make full use of these functions.

Terminal Identifier

Each terminal session has a unique terminal identifier, a required argument for most of the functions. A terminal identifier is generated and returned when a terminal is created via terminalCreate() or terminalExecute(), and identifiers of existing terminals can be obtained via terminalList() or terminalVisible().

Terminal Session

A terminal session is an instance of a terminal that can be displayed in the RStudio terminal tab. A terminal session consists of:

  • a unique terminal identifier
  • a unique caption shown in the RStudio terminal dropdown (e.g. “Terminal 1â€)
  • a shell process (e.g. bash) running as a child process of the R session
  • zero or more processes running as children of the shell (e.g. commands)
  • an xterm-compatible terminal emulator in the terminal tab
  • a buffer of output shown in the terminal emulator (can be cleared via terminalClear())

Busy Terminal

A terminal session with child processes running (excluding the shell), is considered busy and this is reflected in the IDE UI and can be queried with terminalBusy().

Terminal States

In the most common situation, a terminal session has all the above features; however, it is possible for terminals to be in other states.

No shell process or child processes: This happens if the associated R session has been closed (or suspended in the case of an inactive RStudio Server session).

The terminalRunning() function returns TRUE if a terminal is in this state.

If a terminal is not running, it can be started via interacting with it in the RStudio IDE, or via terminalActivate().

# start an interactive terminal using the shell selected in 
# RStudio global options
myTerm <- rstudioapi::terminalCreate()

# ....
# sometime later
# ....
if (!rstudioapi::terminalRunning(myTerm)) {
  # start the terminal shell back up, but don't bring to front
  rstudioapi::terminalActivate(myTerm, show = FALSE)
  
  # wait for it to start
  while (!rstudioapi::terminalRunning(myTerm)) {
    Sys.sleep(0.1)
  }
 
  # send a new command 
  rstudioapi::terminalSend(myTerm, "echo Hello\n") 
}

Running but not loaded in the IDE: On RStudio Server, the web browser can be closed but the R session and any associated terminal sessions keep running. If the web browser is reconnected, each terminal will be redisplayed in the IDE when it is selected. The rstudioapi functions may be used on a terminal in this state; for example, the buffer may still be fetched with terminalBuffer() even if the terminal isn’t loaded in the IDE (so long as the R session is still alive).

Terminated but still visible: Normally the terminal emulator for a given terminal session will close when the shell exits. If the option Close Terminal When Shell Exits is turned off, then the terminal buffer will remain loaded in the RStudio IDE until closed by the user or terminalKill(). Terminals started with terminalExecute() will always remain loaded when they finish running. To test a terminal for this state, terminalExitCode() will return a non-NULL value.

rstudioapi/inst/doc/visual-mode.R0000644000176200001440000000111214706010527016524 0ustar liggesusers## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----setup-------------------------------------------------------------------- library(rstudioapi) ## ----eval=FALSE--------------------------------------------------------------- # reformat <- function() { # id <- rstudioapi::documentId(allowConsole = TRUE) # selection <- rstudioapi::selectionGet(id = id) # formatted <- styler::style_text(text = selection$value) # rstudioapi::selectionSet(value = formatted, id = id) # } rstudioapi/inst/doc/r-session.Rmd0000644000176200001440000000466214147112135016554 0ustar liggesusers--- title: "Interacting with the R Session" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Interact with the R Session} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include=FALSE} knitr::opts_chunk$set(eval = FALSE) ``` ## Detecting RStudio R code may need to determine whether it's being run within an RStudio session, versus a plain R session or something similar. ```{r eval=FALSE} # check that RStudio is available via rstudioapi -- note that this must # be checked prior to calling any other rstudioapi APIs! if (rstudioapi::isAvailable()) { # determine more information via info <- rstudioapi::versionInfo() # check for desktop mode info$mode == "desktop" # check for server mode info$mode == "server" # check the version of RStudio in use info$version >= "1.4" } # check whether RStudio is running without relying on rstudioapi .Platform$GUI == "RStudio" # NOTE: may be unreliable in .Rprofile commandArgs()[[1]] == "RStudio" ``` A note: the `RSTUDIO` environment variable will be set both within the main RStudio session, but also within child processes launched by RStudio. If you need to specifically detect if your code is running within the main RStudio session, we recommend using an alternate mechanism. ## Session Interaction The `rstudioapi` package allows you to interact with the running R session in a couple useful ways: you can send code to the R console, or restart the R session. ```{r} # restart R, then run some code after rstudioapi::restartSession(command = "print('Welcome back!')") # send some code to the console and execute it immediately rstudioapi::sendToConsole("1 + 1", execute = TRUE) ``` ## Running at Startup Typically, code that you want to run at the start of an R session is placed into an `.Rprofile` file (see [Initialization at the Start of a Session](https://stat.ethz.ch/R-manual/R-devel/library/base/html/Startup.html) for details). However, RStudio's API hooks are not available until RStudio has fully started up, so most `rstudioapi` methods will not work inside `.Rprofile`. If you want to invoke `rstudioapi` methods on session startup, use the `rstudio.sessionInit` hook. For example, to print the RStudio version to the R console when the session begins: ```{r} setHook("rstudio.sessionInit", function(newSession) { if (newSession) message("Welcome to RStudio ", rstudioapi::getVersion()) }, action = "append") ``` rstudioapi/inst/doc/dialogs.html0000644000176200001440000003021314706010526016467 0ustar liggesusers File Dialogs

File Dialogs

Using the rstudioapi package, you can request input from the user with various dialogs.

The selectFile() and selectDirectory() APIs allow you to request the name of an existing or non-existing path on the system.

# request the path to an existing .csv file on disk
path <- rstudioapi::selectFile(caption = "Select CSV File",
                               filter = "CSV Files (*.csv)",
                               existing = TRUE)

# now, you could read the data using e.g. 'readr::read_csv()'
data <- readr::read_csv(path)

# request a file path (e.g. where you would like to save a new file)
target <- rstudioapi::selectFile(caption = "Save File",
                                 label = "Save",
                                 existing = FALSE)

# save data to the path provided by the user
saveRDS(data, file = target)

Use rstudioapi::askForPassword() to request a password, or other credentials, from a user.

token <- rstudioapi::askForPassword(
  prompt = "Please provide your GitHub access token."
)

Use rstudioapi::showDialog() to display an informative dialog to the user. This dialog is used to report some kind of status or information to the user; it does not request any input.

rstudioapi::showDialog(title = "Hello, world!",
                       message = "You're <b>awesome!</b>",
                       url = "http://www.example.com")
rstudioapi/inst/doc/document-manipulation.Rmd0000644000176200001440000000407414147112135021143 0ustar liggesusers--- title: "Document Manipulation" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Document Manipulation} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup} knitr::opts_chunk$set(eval = FALSE) ``` The `rstudioapi` package provides a small family of functions that can be used to interact with documents open in an RStudio session. For example, the following code could be used to insert a 'last modified' comment at the start of a document: ```{r} # construct the text to be inserted fmt <- "# This document was last modified on %s.\n" text <- sprintf(fmt, Sys.Date()) # specify a range where this text should be inserted; here, # we use the first line; that is, the 'range' between the start # of the first row, and the start of the second row range <- rstudioapi::document_range(c(1, 0), c(2, 0)) rstudioapi::insertText(range, text) ``` By default, these APIs target the editor instance either currently focused by the user, or when no such editor is currently focused, the last focused editor. If you need to target a specific editor instance (for example, you want to write code that inserts text into the console), you can use `getConsoleEditorContext()` to get the `id` for the console editor: ```{r} # get console editor id context <- rstudioapi::getConsoleEditorContext() id <- context$id # send some R code to the console rstudioapi::insertText(text = "print(1 + 1)", id = id) # see also: `getActiveEditorContext()`, `getSourceEditorContext()` ``` You can also modify the cursor position through the use of the `setCursorPosition()` and `setSelectionRanges()` APIs. ```{r} # put the cursor at the end of the document -- note that here, # `Inf` is automatically truncated to the actual length of the # document rstudioapi::setCursorPosition(Inf) # select the first 10 even lines in the document ranges <- lapply(seq(2, by = 2, length.out = 10), function(start) { rstudioapi::document_range( c(start, 0), c(start, Inf) ) }) rstudioapi::setSelectionRanges(ranges) ``` See the `?"rstudio-documents"` help page for more details. rstudioapi/inst/doc/introduction.html0000644000176200001440000001241214706010526017567 0ustar liggesusers Introduction to rstudioapi

Introduction to rstudioapi

The rstudioapi package provides an interface for interacting with the RStudio IDE with R code. Using rstudioapi, you can:

  • Examine, manipulate, and save the contents of documents currently open in RStudio,

  • Create, open, or re-open RStudio projects,

  • Prompt the user with different kinds of dialogs (e.g. for selecting a file or folder, or requesting a password from the user),

  • Interact with RStudio terminals,

  • Interact with the R session associated with the current RStudio instance.

Please see the other articles for more detailed information.

rstudioapi/inst/doc/dialogs.Rmd0000644000176200001440000000316614147112135016252 0ustar liggesusers--- title: "File Dialogs" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{File Dialogs} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include=FALSE} knitr::opts_chunk$set(eval = FALSE) ``` Using the `rstudioapi` package, you can request input from the user with various dialogs. The `selectFile()` and `selectDirectory()` APIs allow you to request the name of an existing or non-existing path on the system. ```{r} # request the path to an existing .csv file on disk path <- rstudioapi::selectFile(caption = "Select CSV File", filter = "CSV Files (*.csv)", existing = TRUE) # now, you could read the data using e.g. 'readr::read_csv()' data <- readr::read_csv(path) # request a file path (e.g. where you would like to save a new file) target <- rstudioapi::selectFile(caption = "Save File", label = "Save", existing = FALSE) # save data to the path provided by the user saveRDS(data, file = target) ``` Use `rstudioapi::askForPassword()` to request a password, or other credentials, from a user. ```{r} token <- rstudioapi::askForPassword( prompt = "Please provide your GitHub access token." ) ``` Use `rstudioapi::showDialog()` to display an informative dialog to the user. This dialog is used to report some kind of status or information to the user; it does not request any input. ```{r} rstudioapi::showDialog(title = "Hello, world!", message = "You're awesome!", url = "http://www.example.com") ``` rstudioapi/inst/doc/dialogs.R0000644000176200001440000000242114706010526015724 0ustar liggesusers## ----setup, include=FALSE----------------------------------------------------- knitr::opts_chunk$set(eval = FALSE) ## ----------------------------------------------------------------------------- # # request the path to an existing .csv file on disk # path <- rstudioapi::selectFile(caption = "Select CSV File", # filter = "CSV Files (*.csv)", # existing = TRUE) # # # now, you could read the data using e.g. 'readr::read_csv()' # data <- readr::read_csv(path) # # # request a file path (e.g. where you would like to save a new file) # target <- rstudioapi::selectFile(caption = "Save File", # label = "Save", # existing = FALSE) # # # save data to the path provided by the user # saveRDS(data, file = target) ## ----------------------------------------------------------------------------- # token <- rstudioapi::askForPassword( # prompt = "Please provide your GitHub access token." # ) ## ----------------------------------------------------------------------------- # rstudioapi::showDialog(title = "Hello, world!", # message = "You're awesome!", # url = "http://www.example.com") rstudioapi/build/0000755000176200001440000000000014706010530013530 5ustar liggesusersrstudioapi/build/vignette.rds0000644000176200001440000000062714706010530016074 0ustar liggesusers‹¥RÁN1-°‚ (†£^êÉ|ņÄÄxm¶jvÛMÛ•x󷽈ãn»tW½è¡ÓöÍkçMæ=õBM ÔlÁ±5‚І5„ÕAêÂ~B9‰åFO µÐ•Q–0aÆ <Íbb¸aÈ…Q’fQ ï§J>³ÈøŸ ÔX3­kDÃT‰=ìì…ëŒÄãDR–ÃUý) ±»­P<ó„Úäõ½'‰•6å’¤Ü2nÁ‚Øà7[¼Xæ<·}Xâ#,³ex—EW^µê_+Û¢ûä.g¬Iô­ø1ïÏ ÷zßn>[“Ä®ØÏòç• y‰A9"<=Ìȧ–CòÀ¡?¥¯Êí–v²Àå/f²id÷ÞÁ:Θžqé`§±bF¹–BúÃþÏ÷ABÊ;$aÚ&Û ¾|ì+nÊKkNí±áÚë„,e‚: ?°×Tp¯ê*¹›¸bXÍ7ûýþ½®(ЉvŠØ£ÄÉZÁ{¸}|>Y 6rstudioapi/man/0000755000176200001440000000000014703771642013223 5ustar liggesusersrstudioapi/man/writeRStudioPreference.Rd0000644000176200001440000000223014147112135020136 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/prefs.R \name{writeRStudioPreference} \alias{writeRStudioPreference} \title{Write RStudio Preference} \usage{ writeRStudioPreference(name, value) } \arguments{ \item{name}{The name of the preference.} \item{value}{The value of the preference.} } \description{ Writes an internal RStudio IDE preference for the current user. } \details{ RStudio IDE internal preferences include the values displayed in RStudio's Global Options dialog as well as a number of additional settings. Set them carefully; inappropriate values can cause unexpected behavior. See the RStudio Server Professional Administration Guide appendix for your version of RStudio for a full list of preference names and values. } \note{ The \code{writeRStudioPreference} function was added in version 1.3.387 of RStudio. } \examples{ \dontrun{ # Hide RStudio's toolbar. rstudioapi::writeRStudioPreference("toolbar_visible", FALSE) } } \seealso{ \code{\link{writePreference}}, which can be used to store arbitrary user (non-RStudio) preferences. \code{\link{readRStudioPreference}}, which reads internal RStudio IDE preferences. } rstudioapi/man/terminalRunning.Rd0000644000176200001440000000216714147112135016660 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/terminal.R \name{terminalRunning} \alias{terminalRunning} \title{Is Terminal Running} \usage{ terminalRunning(id) } \arguments{ \item{id}{The terminal id. The \code{id} is obtained from \code{\link{terminalList}()}, \code{\link{terminalVisible}()}, \code{\link{terminalCreate}()}, or \code{\link{terminalExecute}()}.} } \value{ a boolean } \description{ Does a terminal have a process associated with it? If the R session is restarted after a terminal has been created, the terminal will not restart its shell until it is displayed either via the user interface, or via \code{\link{terminalActivate}()}. } \note{ The \code{terminalRunning} function was added in version 1.1.350 of RStudio. } \examples{ \dontrun{ # termId has a handle to a previously created terminal # make sure it is still running before we send it a command if (!rstudioapi::terminalRunning(termId)) { rstudioapi::terminalActivate(termId)) # wait for it to start while (!rstudioapi::terminalRunning(termId)) { Sys.sleep(0.1) } terminalSend(termId, "echo Hello\n") } } } rstudioapi/man/jobAddOutput.Rd0000644000176200001440000000134014561520755016113 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/jobs.R \name{jobAddOutput} \alias{jobAddOutput} \title{Add Background Job Output} \usage{ jobAddOutput(job, output, error = FALSE) } \arguments{ \item{job}{The ID of the job that has emitted text.} \item{output}{The text output emitted by the job.} \item{error}{Whether the output represents an error.} } \description{ Adds text output to a background job. } \seealso{ Other jobs: \code{\link{jobAdd}()}, \code{\link{jobAddProgress}()}, \code{\link{jobGetState}()}, \code{\link{jobList}()}, \code{\link{jobRemove}()}, \code{\link{jobRunScript}()}, \code{\link{jobSetProgress}()}, \code{\link{jobSetState}()}, \code{\link{jobSetStatus}()} } \concept{jobs} rstudioapi/man/jobSetStatus.Rd0000644000176200001440000000123314561520755016142 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/jobs.R \name{jobSetStatus} \alias{jobSetStatus} \title{Set Background Job Status} \usage{ jobSetStatus(job, status) } \arguments{ \item{job}{The ID of the job to update.} \item{status}{Text describing job's new status.} } \description{ Update a background job's informational status text. } \seealso{ Other jobs: \code{\link{jobAdd}()}, \code{\link{jobAddOutput}()}, \code{\link{jobAddProgress}()}, \code{\link{jobGetState}()}, \code{\link{jobList}()}, \code{\link{jobRemove}()}, \code{\link{jobRunScript}()}, \code{\link{jobSetProgress}()}, \code{\link{jobSetState}()} } \concept{jobs} rstudioapi/man/launcherResourceLimit.Rd0000644000176200001440000000237014560722065020020 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/launcher-functions.R \name{launcherResourceLimit} \alias{launcherResourceLimit} \title{Define a Workbench Launcher Resource Limit} \usage{ launcherResourceLimit(type, value) } \arguments{ \item{type}{The resource limit type. Must be one of cpuCount, cpuFrequency, cpuSet, cpuTime, memory, memorySwap. Different launcher plugins may support different subsets of these resource limit types; please consult the plugin documentation to learn which limits are supported.} \item{value}{The formatted value of the requested limit.} } \description{ Define a launcher resource limit, suitable for use with the \code{resourceLimits} argument to \code{\link[=launcherSubmitJob]{launcherSubmitJob()}}. } \seealso{ Other job-launcher functionality: \code{\link{launcherAvailable}()}, \code{\link{launcherConfig}()}, \code{\link{launcherContainer}()}, \code{\link{launcherControlJob}()}, \code{\link{launcherGetInfo}()}, \code{\link{launcherGetJob}()}, \code{\link{launcherGetJobs}()}, \code{\link{launcherHostMount}()}, \code{\link{launcherNfsMount}()}, \code{\link{launcherPlacementConstraint}()}, \code{\link{launcherSubmitJob}()}, \code{\link{launcherSubmitR}()} } \concept{job-launcher functionality} rstudioapi/man/launcherPlacementConstraint.Rd0000644000176200001440000000221314560722065021203 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/launcher-functions.R \name{launcherPlacementConstraint} \alias{launcherPlacementConstraint} \title{Define a Workbench Launcher Placement Constraint} \usage{ launcherPlacementConstraint(name, value = NULL) } \arguments{ \item{name}{The name of this placement constraint.} \item{value}{The value of the constraint. A job will only be placed on a requested node if the requested placement constraint is present.} } \description{ Define a launcher placement constraint, suitable for use with the \code{placementConstraints} argument to \code{\link[=launcherSubmitJob]{launcherSubmitJob()}}. } \seealso{ Other job-launcher functionality: \code{\link{launcherAvailable}()}, \code{\link{launcherConfig}()}, \code{\link{launcherContainer}()}, \code{\link{launcherControlJob}()}, \code{\link{launcherGetInfo}()}, \code{\link{launcherGetJob}()}, \code{\link{launcherGetJobs}()}, \code{\link{launcherHostMount}()}, \code{\link{launcherNfsMount}()}, \code{\link{launcherResourceLimit}()}, \code{\link{launcherSubmitJob}()}, \code{\link{launcherSubmitR}()} } \concept{job-launcher functionality} rstudioapi/man/launcherAvailable.Rd0000644000176200001440000000163314560722065017113 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/launcher-functions.R \name{launcherAvailable} \alias{launcherAvailable} \title{Check if Workbench Launcher is Available} \usage{ launcherAvailable() } \description{ Check if the Workbench launcher is available and configured to support Workbench jobs; that is, jobs normally launched by the user through the RStudio IDE's user interface. } \seealso{ Other job-launcher functionality: \code{\link{launcherConfig}()}, \code{\link{launcherContainer}()}, \code{\link{launcherControlJob}()}, \code{\link{launcherGetInfo}()}, \code{\link{launcherGetJob}()}, \code{\link{launcherGetJobs}()}, \code{\link{launcherHostMount}()}, \code{\link{launcherNfsMount}()}, \code{\link{launcherPlacementConstraint}()}, \code{\link{launcherResourceLimit}()}, \code{\link{launcherSubmitJob}()}, \code{\link{launcherSubmitR}()} } \concept{job-launcher functionality} rstudioapi/man/launcherHostMount.Rd0000644000176200001440000000224314560722065017171 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/launcher-functions.R \name{launcherHostMount} \alias{launcherHostMount} \title{Define a Workbench Launcher Host Mount} \usage{ launcherHostMount(path, mountPath, readOnly = TRUE) } \arguments{ \item{path}{The host path to be mounted.} \item{mountPath}{The destination path for the mount in the container.} \item{readOnly}{Boolean; should the path be mounted read-only?} } \description{ Define a launcher host mount, suitable for use with the \code{mounts} argument to \code{\link[=launcherSubmitJob]{launcherSubmitJob()}}. This can be used to mount a path from the host into the generated container. } \seealso{ Other job-launcher functionality: \code{\link{launcherAvailable}()}, \code{\link{launcherConfig}()}, \code{\link{launcherContainer}()}, \code{\link{launcherControlJob}()}, \code{\link{launcherGetInfo}()}, \code{\link{launcherGetJob}()}, \code{\link{launcherGetJobs}()}, \code{\link{launcherNfsMount}()}, \code{\link{launcherPlacementConstraint}()}, \code{\link{launcherResourceLimit}()}, \code{\link{launcherSubmitJob}()}, \code{\link{launcherSubmitR}()} } \concept{job-launcher functionality} rstudioapi/man/getRStudioPackageDependencies.Rd0000644000176200001440000000163714147112135021361 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/dependencies.R \name{getRStudioPackageDependencies} \alias{getRStudioPackageDependencies} \title{Get RStudio Package Dependencies} \usage{ getRStudioPackageDependencies() } \value{ A data frame containing a row per R package. } \description{ Gets a list of the all the R packages that RStudio depends on in some way. } \details{ The data frame of package dependencies contains the following columns: \describe{ \item{name}{The name of the R package.} \item{version}{The required minimum version of the R package.} \item{location}{Where RStudio expects the package to be, \code{cran} for a CRAN-like repository or \code{embedded} for development packages embedded in RStudio itself.} \item{source}{Whether the package should be installed from source.} } } \note{ The \code{getRStudioPackageDependencies} function was introduced in RStudio 1.3.525. } rstudioapi/man/versionInfo.Rd0000644000176200001440000000176614147112135016011 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/stubs.R \name{versionInfo} \alias{versionInfo} \title{RStudio version information} \usage{ versionInfo() } \value{ An \R list with the following elements: \tabular{ll}{ \code{version} \tab The version of RStudio. \cr \code{mode} \tab \code{"desktop"} for RStudio Desktop, or \code{"server"} for RStudio Server. \cr \code{citation} \tab Information on how RStudio can be cited in academic publications. \cr } } \description{ Query information about the currently running instance of RStudio. } \note{ The \code{versionInfo} function was added in version 0.97.124 of RStudio. } \examples{ \dontrun{ info <- rstudioapi::versionInfo() # check what version of RStudio is in use if (info$version >= "1.4") { # code specific to versions of RStudio 1.4 and newer } # check whether RStudio Desktop or RStudio Server is being used if (info$mode == "desktop") { # code specific to RStudio Desktop } # Get the citation info$citation } } rstudioapi/man/askForSecret.Rd0000644000176200001440000000125114147112135016070 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/dialogs.R \name{askForSecret} \alias{askForSecret} \title{Prompt user for secret} \usage{ askForSecret( name, message = paste(name, ":", sep = ""), title = paste(name, "Secret") ) } \arguments{ \item{name}{The name of the secret.} \item{message}{A character vector with the contents to display in the main dialog area.} \item{title}{The title to display in the dialog box.} } \description{ Request a secret from the user. If the \code{keyring} package is installed, it will be used to cache requested secrets. } \note{ The \code{askForSecret} function was added in version 1.1.419 of RStudio. } rstudioapi/man/readRStudioPreference.Rd0000644000176200001440000000213114147112135017717 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/prefs.R \name{readRStudioPreference} \alias{readRStudioPreference} \title{Read RStudio Preference} \usage{ readRStudioPreference(name, default) } \arguments{ \item{name}{The name of the preference.} \item{default}{The default value of the preference, returned if the preference is not found.} } \description{ Reads an internal RStudio IDE preference for the current user. } \details{ RStudio IDE internal preferences include the values displayed in RStudio's Global Options dialog as well as a number of additional settings. } \note{ The \code{readRStudioPreference} function was added in version 1.3.387 of RStudio. } \examples{ \dontrun{ # Get indentation settings spaces <- rstudioapi::readRStudioPreference("num_spaces_for_tab", FALSE) message("Using ", spaces, " per tab.") } } \seealso{ \code{\link{readPreference}}, which can be used to read arbitrary user (non-RStudio) preferences set with \code{\link{writePreference}}. \code{link{writeRStudioPreference}}, which can be used to write internal RStudio IDE preferences. } rstudioapi/man/registerCommandStreamCallback.Rd0000644000176200001440000000311414147112135021411 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/commands.R \name{registerCommandStreamCallback} \alias{registerCommandStreamCallback} \title{Register Command Stream Callback} \usage{ registerCommandStreamCallback(callback) } \arguments{ \item{callback}{A function to execute when the command is invoked.} } \value{ A handle representing the registration. Pass this handle to \code{\link{unregisterCommandCallback}} to unregister the callback. } \description{ Registers a callback to be executed whenever any RStudio command is invoked. } \details{ The callback function will be given a single argument with the ID of the command that was invoked. See the RStudio Server Professional Administration Guide appendix for a list of command IDs. Note that there is a small performance penalty incurred across the IDE when a command stream listener is present. If you only need to listen to a few specific commands, it is recommended to set up callbacks for them individually using \code{\link{registerCommandCallback}}. } \note{ The \code{registerCommandStreamCallback} function was introduced in RStudio 1.4.1589. } \examples{ \dontrun{ # Set up a callback to print the ID of commands executed to the console. handle <- rstudioapi::registerCommandStreamCallback(function(id) { message("Command executed: ", id) }) # Later: Unregister the callback rstudioapi::unregisterCommandCallback(handle) } } \seealso{ \code{\link{unregisterCommandCallback}} to unregister the callback, and \code{\link{registerCommandCallback}} to be notified whenever a \emph{specific} command is executed. } rstudioapi/man/isJob.Rd0000644000176200001440000000174314560722065014561 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/remote.R \name{isJob} \alias{isJob} \alias{isBackgroundJob} \alias{isWorkbenchJob} \title{Detect RStudio Jobs} \usage{ isJob() isBackgroundJob() isWorkbenchJob() } \value{ Boolean; \code{TRUE} if this is an RStudio job. } \description{ Use this function to detect whether RStudio is running an R "job". These jobs are normally used for actions taken in the Jobs tab, as well as within the \R build pane. } \details{ \code{isWorkbenchJob()} is used to detect scripts which have been launched as Workbench jobs, and is only available in RStudio Workbench 2024.04 or newer. These jobs use the RStudio Launcher to run \R scripts on remote clusters, as opposed to \code{isBackgroundJob()}, which is used to detect background jobs which are run on the local machine. This function is primarily intended to be used by package authors, who need to customize the behavior of their methods when run within an RStudio job. } rstudioapi/man/applyTheme.Rd0000644000176200001440000000061414147112135015607 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/themes.R \name{applyTheme} \alias{applyTheme} \title{Apply an Editor Theme to RStudio} \usage{ applyTheme(name) } \arguments{ \item{name}{The unique name of the theme to apply.} } \description{ Applies the specified editor theme to RStudio. } \note{ The \code{applyTheme} function was introduced in RStudio 1.2.879. } rstudioapi/man/previewRd.Rd0000644000176200001440000000072114147112135015445 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/stubs.R \name{previewRd} \alias{previewRd} \title{Preview an Rd topic in the Help pane} \usage{ previewRd(rdFile) } \arguments{ \item{rdFile}{The path to an \code{.Rd} file.} } \description{ Preview an Rd topic in the Help pane. } \note{ The \code{previewRd} function was added in version 0.98.191 of RStudio. } \examples{ \dontrun{ rstudioapi::previewRd("~/MyPackage/man/foo.Rd") } } rstudioapi/man/convertTheme.Rd0000644000176200001440000000355614147112135016152 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/themes.R \name{convertTheme} \alias{convertTheme} \title{Convert a tmTheme to an RStudio Theme} \usage{ convertTheme( themePath, add = TRUE, outputLocation = NULL, apply = FALSE, force = FALSE, globally = FALSE ) } \arguments{ \item{themePath}{A full or relative path to the \code{tmTheme} file to be converted.} \item{add}{Whether to add the newly converted theme to RStudio. Setting this to true will have the same impact as running \code{{ rstudioapi::convertTheme(, outputLocation = ); rstudioapi::addTheme() }}.\cr Default: \code{TRUE}.} \item{outputLocation}{A full or relative path where a copy of the converted theme will be saved. If this value is \code{NULL}, no copy will be saved.\cr Default: \code{NULL}.} \item{apply}{Whether to immediately apply the newly added theme. This paramater cannot be set to \code{TRUE} if \code{add} is set to \code{FALSE}. Setting this and \code{add} to \code{TRUE} has the same impact as running \code{{ rstudioapi::convertTheme(, outputLocation = ); rstudioapi::addTheme(); rstudioapi::applyTheme() }}.\cr Default: \code{FALSE}.} \item{force}{Whether to force the operation and overwrite an existing file with the same name.\cr Default: \code{FALSE}.} \item{globally}{Whether to install this theme for the current user or all users. If set to \code{TRUE} this will attempt to install the theme for all users, which may require administrator privileges. Only applies when \code{add} is \code{TRUE}. \cr Default: \code{FALSE}.} } \description{ Converts a \code{tmTheme} to an \code{rstheme} and optionally adds and applies it to RStudio and returns the name of the theme. } \note{ The \code{convertTheme} function was introduced in RStudio 1.2.879. } rstudioapi/man/systemUsername.Rd0000644000176200001440000000037214147112135016524 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/user.R \name{systemUsername} \alias{systemUsername} \title{Get System Username} \usage{ systemUsername() } \description{ Returns the system username of the current user. } rstudioapi/man/getActiveProject.Rd0000644000176200001440000000102114147112135016732 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/stubs.R \name{getActiveProject} \alias{getActiveProject} \title{Retrieve path to active RStudio project} \usage{ getActiveProject() } \value{ The path to the current project, or \code{NULL} if no project is currently open. } \description{ Get the path to the active RStudio project (if any). If the path contains non-ASCII characters, it will be UTF-8 encoded. } \note{ The \code{getActiveProject} function was added in version 0.99.854 of RStudio. } rstudioapi/man/updateDialog.Rd0000644000176200001440000000116414147112135016102 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/dialogs.R \name{updateDialog} \alias{updateDialog} \title{Updates a Dialog Box} \usage{ updateDialog(...) } \arguments{ \item{...}{Named parameters and values to update a dialog box.} } \description{ Updates specific properties from the current dialog box. } \details{ Currently, the only dialog with support for this action is the New Connection dialog in which the code preview can be updated through this API. \preformatted{ updateDialog(code = "con <- NULL") } } \note{ The \code{updateDialog} function was added in version 1.1.67 of RStudio. } rstudioapi/man/jobSetProgress.Rd0000644000176200001440000000127114561520755016465 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/jobs.R \name{jobSetProgress} \alias{jobSetProgress} \title{Set Background Job Progress} \usage{ jobSetProgress(job, units) } \arguments{ \item{job}{The ID of the job to set progress for.} \item{units}{The integer number of total units of work completed so far.} } \description{ Updates the progress for a background job. } \seealso{ Other jobs: \code{\link{jobAdd}()}, \code{\link{jobAddOutput}()}, \code{\link{jobAddProgress}()}, \code{\link{jobGetState}()}, \code{\link{jobList}()}, \code{\link{jobRemove}()}, \code{\link{jobRunScript}()}, \code{\link{jobSetState}()}, \code{\link{jobSetStatus}()} } \concept{jobs} rstudioapi/man/callFun.Rd0000644000176200001440000000110114147112135015053 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/code.R \name{callFun} \alias{callFun} \title{Call an RStudio API function} \usage{ callFun(fname, ...) } \arguments{ \item{fname}{name of the RStudio function to call.} \item{...}{Other arguments passed on to the function} } \description{ This function will return an error if RStudio is not running, or the function is not available. If you want to fall back to different behavior, use \code{\link{hasFun}}. } \examples{ if (rstudioapi::isAvailable()) { rstudioapi::callFun("versionInfo") } } rstudioapi/man/terminalKill.Rd0000644000176200001440000000100714147112135016123 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/terminal.R \name{terminalKill} \alias{terminalKill} \title{Kill Terminal} \usage{ terminalKill(id) } \arguments{ \item{id}{The terminal id. The \code{id} is obtained from \code{\link{terminalList}()}, \code{\link{terminalVisible}()}, \code{\link{terminalCreate}()}, or \code{\link{terminalExecute}()}.} } \description{ Kill processes and close a terminal. } \note{ The \code{terminalKill} function was added in version 1.1.350 of RStudio. } rstudioapi/man/jobRunScript.Rd0000644000176200001440000000256614561520755016146 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/jobs.R \name{jobRunScript} \alias{jobRunScript} \title{Run R Script As Background Job} \usage{ jobRunScript( path, name = NULL, encoding = "unknown", workingDir = NULL, importEnv = FALSE, exportEnv = "" ) } \arguments{ \item{path}{The path to the R script to be run.} \item{name}{A name for the background job. When \code{NULL} (the default), the filename of the script is used as the job name.} \item{encoding}{The text encoding of the script, if known.} \item{workingDir}{The working directory in which to run the job. When \code{NULL} (the default), the parent directory of the R script is used.} \item{importEnv}{Whether to import the global environment into the job.} \item{exportEnv}{The name of the environment in which to export the R objects created by the job. Use \code{""} (the default) to skip export, \code{"R_GlobalEnv"}` to export to the global environment, or the name of an environment object to create an object with that name.} } \description{ Starts an R script as a background job. } \seealso{ Other jobs: \code{\link{jobAdd}()}, \code{\link{jobAddOutput}()}, \code{\link{jobAddProgress}()}, \code{\link{jobGetState}()}, \code{\link{jobList}()}, \code{\link{jobRemove}()}, \code{\link{jobSetProgress}()}, \code{\link{jobSetState}()}, \code{\link{jobSetStatus}()} } \concept{jobs} rstudioapi/man/hasColorConsole.Rd0000644000176200001440000000111214147112135016566 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/stubs.R \name{hasColorConsole} \alias{hasColorConsole} \title{Check if console supports ANSI color escapes.} \usage{ hasColorConsole() } \value{ \code{TRUE} if ANSI color escapes are supported; \code{FALSE} otherwise. } \description{ Check if the RStudio console supports ANSI color escapes. } \note{ The \code{hasColorConsole} function was added in version 1.1.216 of RStudio. } \examples{ \dontrun{ if (rstudioapi::hasColorConsole()) { message("RStudio console supports ANSI color sequences.") } } } rstudioapi/man/terminalList.Rd0000644000176200001440000000064014147112135016145 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/terminal.R \name{terminalList} \alias{terminalList} \title{Get All Terminal Ids} \usage{ terminalList() } \value{ The terminal identifiers as a character vector. } \description{ Return a character vector containing all the current terminal identifiers. } \note{ The \code{terminalList} function was added in version 1.1.350 of RStudio. } rstudioapi/man/showDialog.Rd0000644000176200001440000000165114703770712015612 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/dialogs.R \name{showDialog} \alias{showDialog} \title{Show Dialog Box} \usage{ showDialog(title, message, url = "", timeout = 60) } \arguments{ \item{title}{The title to display in the dialog box.} \item{message}{A character vector with the contents to display in the main dialog area. Contents can contain the following HTML tags: "p", "em", "strong", "b" and "i".} \item{url}{An optional URL to display under the \code{message}.} \item{timeout}{A timeout (in seconds). When set, if the user takes longer than this timeout to provide a response, the request will be aborted.} } \description{ Shows a dialog box with a given title and contents. } \note{ The \code{showDialog} function was added in version 1.1.67 of RStudio. } \examples{ if (rstudioapi::isAvailable()) { rstudioapi::showDialog("Example Dialog", "This is an example dialog.") } } rstudioapi/man/launcherNfsMount.Rd0000644000176200001440000000236514560722065017007 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/launcher-functions.R \name{launcherNfsMount} \alias{launcherNfsMount} \title{Define a Workbench Launcher NFS Mount} \usage{ launcherNfsMount(host, path, mountPath, readOnly = TRUE) } \arguments{ \item{host}{The host name, or IP address, of the NFS server.} \item{path}{The NFS path to be mounted.} \item{mountPath}{The destination path for the mount in the container.} \item{readOnly}{Boolean; should the path be mounted read-only?} } \description{ Define a launcher NFS mount, suitable for use with the \code{mounts} argument to \code{\link[=launcherSubmitJob]{launcherSubmitJob()}}. This can be used to mount a path from a networked filesystem into a newly generated container. } \seealso{ Other job-launcher functionality: \code{\link{launcherAvailable}()}, \code{\link{launcherConfig}()}, \code{\link{launcherContainer}()}, \code{\link{launcherControlJob}()}, \code{\link{launcherGetInfo}()}, \code{\link{launcherGetJob}()}, \code{\link{launcherGetJobs}()}, \code{\link{launcherHostMount}()}, \code{\link{launcherPlacementConstraint}()}, \code{\link{launcherResourceLimit}()}, \code{\link{launcherSubmitJob}()}, \code{\link{launcherSubmitR}()} } \concept{job-launcher functionality} rstudioapi/man/sourceMarkers.Rd0000644000176200001440000000330414170355571016334 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/stubs.R \name{sourceMarkers} \alias{sourceMarkers} \title{Display source markers} \usage{ sourceMarkers( name, markers, basePath = NULL, autoSelect = c("none", "first", "error") ) } \arguments{ \item{name}{The name of marker set. If there is a market set with this name already being shown, those markers will be replaced.} \item{markers}{An \R list, or data.frame, of source markers. See \strong{details} for more details on the expected format.} \item{basePath}{Optional. If all source files are within a base path, then specifying that path here will result in file names being displayed as relative paths. Note that in this case markers still need to specify source file names as full paths.} \item{autoSelect}{Auto-select a marker after displaying the marker set?} } \description{ Display user navigable source markers in a pane within RStudio. } \details{ The \code{markers} argument can contains either a list of marker lists or a data frame with the appropriate marker columns. The fields in a marker are as follows (all are required): \tabular{ll}{ \code{type} \tab The marker type ("error", "warning", "info", "style", or "usage"). \cr \code{file} \tab The path to the associated source file. \cr \code{line} \tab The line number for the associated marker. \cr \code{column} \tab The column number for the associated marker. \cr \code{message} \tab A message associated with the marker at this location. \cr } Note the marker \code{message} can contain ANSI SGR codes for formatting. The \code{cli} package can format text for style and color. } \note{ The \code{sourceMarkers} function was added in version 0.99.225 of RStudio. } rstudioapi/man/setGhostText.Rd0000644000176200001440000000074614560722065016162 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/stubs.R \name{setGhostText} \alias{setGhostText} \title{Set ghost text} \usage{ setGhostText(text) } \arguments{ \item{text}{The ghost text to set.} } \description{ Set ghost text in the current document. The ghost text will be inserted at the current cursor position. Ghost text can be inserted into the document by pressing Tab, and will be automatically dismissed if the user navigates the cursor away. } rstudioapi/man/getVersion.Rd0000644000176200001440000000074314703772430015637 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/code.R \name{getVersion} \alias{getVersion} \title{Determine the version of RStudio} \usage{ getVersion() } \value{ A \code{"numeric_version"} object, giving the version of RStudio in use. } \description{ Use \code{getVersion()} to determine the current version of RStudio. This can be useful for \R packages which need to gate certain functionality based on the version of RStudio currently available. } rstudioapi/man/getDelegatedAzureToken.Rd0000644000176200001440000000120514502355251020065 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/auth.R \name{getDelegatedAzureToken} \alias{getDelegatedAzureToken} \title{OAuth2 Tokens for Delegated Azure Resources} \usage{ getDelegatedAzureToken(resource) } \arguments{ \item{resource}{The name of an Azure resource or service, normally a URL.} } \description{ When Workbench is using Azure Active Directory for sign-in, this function can return an OAuth2 token for a service Workbench users have delegated access to. This requires configuring delegated permissions in Azure itself. } \examples{ \dontrun{ getDelegatedAzureToken("https://storage.azure.com") } } rstudioapi/man/jobAddProgress.Rd0000644000176200001440000000127614561520755016427 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/jobs.R \name{jobAddProgress} \alias{jobAddProgress} \title{Add Background Job Progress} \usage{ jobAddProgress(job, units) } \arguments{ \item{job}{The ID of the job to update progress for.} \item{units}{The integer number of new progress units completed.} } \description{ Adds incremental progress units to a background job. } \seealso{ Other jobs: \code{\link{jobAdd}()}, \code{\link{jobAddOutput}()}, \code{\link{jobGetState}()}, \code{\link{jobList}()}, \code{\link{jobRemove}()}, \code{\link{jobRunScript}()}, \code{\link{jobSetProgress}()}, \code{\link{jobSetState}()}, \code{\link{jobSetStatus}()} } \concept{jobs} rstudioapi/man/navigateToFile.Rd0000644000176200001440000000332614147112135016403 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/stubs.R \name{navigateToFile} \alias{navigateToFile} \title{Navigate to file} \usage{ navigateToFile( file = character(0), line = -1L, column = -1L, moveCursor = TRUE ) } \arguments{ \item{file}{The file to be opened.} \item{line}{The line number where the cursor should be placed. When \code{-1L} (the default), the cursor will not be moved.} \item{column}{The column number where the cursour should be placed. When \code{-1L} (the default), the cursor will not be moved.} \item{moveCursor}{Boolean; should the cursor be moved to the requested (\code{line}, \code{column}) position? Set this to \code{FALSE} to preserve the existing cursor position in the document.} } \description{ Open a file in RStudio, optionally at a specified location. } \details{ The \code{navigateToFile} opens a file in RStudio. If the file is already open, its tab or window is activated. Once the file is open, the cursor is moved to the specified location. If the \code{file} argument is empty (the default), then the file is the file currently in view if one exists. If the \code{line} and \code{column} arguments are both equal to \code{-1L} (the default), then the cursor position in the document that is opened will be preserved. Alternatively, \code{moveCursor} can be set to \code{FALSE} to preserve the cursor position. Note that if your intent is to navigate to a particular function within a file, you can also cause RStudio to navigate there by invoking \code{\link[utils]{View}} on the function, which has the advantage of falling back on deparsing if the file is not available. } \note{ The \code{navigateToFile} function was added in version 0.99.719 of RStudio. } rstudioapi/man/launcherGetJobs.Rd0000644000176200001440000000264214277745603016601 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/launcher-functions.R \name{launcherGetJobs} \alias{launcherGetJobs} \title{Retrieve Workbench Job Information} \usage{ launcherGetJobs( statuses = NULL, fields = NULL, tags = NULL, includeSessions = FALSE ) } \arguments{ \item{statuses}{Return only jobs whose status matches one of \code{statuses}. Valid statuses are: Pending, Running, Suspended, Failed, Finished, Killed, Canceled. When \code{NULL}, all jobs are returned.} \item{fields}{Return a subset of fields associated with each job object. When \code{NULL}, all fields associated with a particular job are returned.} \item{tags}{An optional set of tags. Only jobs that have been assigned one of these requested tags will be returned.} \item{includeSessions}{Boolean; include jobs which are also operating as RStudio R sessions?} } \description{ Retrieve information on Workbench jobs. } \seealso{ Other job-launcher functionality: \code{\link{launcherAvailable}()}, \code{\link{launcherConfig}()}, \code{\link{launcherContainer}()}, \code{\link{launcherControlJob}()}, \code{\link{launcherGetInfo}()}, \code{\link{launcherGetJob}()}, \code{\link{launcherHostMount}()}, \code{\link{launcherNfsMount}()}, \code{\link{launcherPlacementConstraint}()}, \code{\link{launcherResourceLimit}()}, \code{\link{launcherSubmitJob}()}, \code{\link{launcherSubmitR}()} } \concept{job-launcher functionality} rstudioapi/man/rstudio-documents.Rd0000644000176200001440000001145314276505702017203 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/document-api.R \name{rstudio-documents} \alias{rstudio-documents} \alias{insertText} \alias{modifyRange} \alias{setDocumentContents} \alias{setCursorPosition} \alias{setSelectionRanges} \alias{documentId} \alias{documentPath} \alias{documentSave} \alias{documentSaveAll} \alias{documentNew} \alias{documentOpen} \alias{documentClose} \title{Interact with Documents open in RStudio} \usage{ insertText(location = NULL, text = NULL, id = NULL) modifyRange(location = NULL, text = NULL, id = NULL) setDocumentContents(text, id = NULL) setCursorPosition(position, id = NULL) setSelectionRanges(ranges, id = NULL) documentId(allowConsole = TRUE) documentPath(id = NULL) documentSave(id = NULL) documentSaveAll() documentNew( text, type = c("r", "rmarkdown", "sql"), position = document_position(0, 0), execute = FALSE ) documentOpen(path, line = -1L, col = -1L, moveCursor = TRUE) documentClose(id = NULL, save = TRUE) } \arguments{ \item{location}{An object specifying the positions, or ranges, wherein text should be inserted. See \bold{Details} for more information.} \item{text}{A character vector, indicating what text should be inserted at each aforementioned range. This should either be length one (in which case, this text is applied to each range specified); otherwise, it should be the same length as the \code{ranges} list.} \item{id}{The document id. When \code{NULL} or blank, the requested operation will apply to the currently open, or last focused, RStudio document.} \item{position}{The cursor position, typically created through \code{\link{document_position}()}.} \item{ranges}{A list of one or more ranges, typically created through \code{\link{document_range}()}.} \item{allowConsole}{Allow the pseudo-id \verb{#console} to be returned, if the \R console is currently focused? Set this to \code{FALSE} if you'd always like to target the currently-active or last-active editor in the Source pane.} \item{type}{The type of document to be created.} \item{execute}{Should the code be executed after the document is created?} \item{path}{The path to the document.} \item{line}{The line in the document to navigate to.} \item{col}{The column in the document to navigate to.} \item{moveCursor}{Boolean; move the cursor to the requested location after opening the document?} \item{save}{Whether to commit unsaved changes to the document before closing it.} } \description{ Use these functions to interact with documents open in RStudio. } \details{ \code{location} should be a (list of) \code{\link{document_position}} or \code{\link{document_range}} object(s), or numeric vectors coercable to such objects. To operate on the current selection in a document, call \code{insertText()} with only a text argument, e.g. \preformatted{ insertText("# Hello\\n") insertText(text = "# Hello\\n") } Otherwise, specify a (list of) positions or ranges, as in: \preformatted{ # insert text at the start of the document insertText(c(1, 1), "# Hello\\n") # insert text at the end of the document insertText(Inf, "# Hello\\n") # comment out the first 5 rows pos <- Map(c, 1:5, 1) insertText(pos, "# ") # uncomment the first 5 rows, undoing the previous action rng <- Map(c, Map(c, 1:5, 1), Map(c, 1:5, 3)) modifyRange(rng, "") } \code{modifyRange} is a synonym for \code{insertText}, but makes its intent clearer when working with ranges, as performing text insertion with a range will replace the text previously existing in that range with new text. For clarity, prefer using \code{insertText} when working with \code{\link{document_position}}s, and \code{modifyRange} when working with \code{\link{document_range}}s. \code{documentClose} accepts an ID of an open document rather than a path. You can retrieve the ID of the active document using the \code{documentId()} function. Closing is always done non-interactively; that is, no prompts are given to the user. If the user has made changes to the document but not saved them, then the \code{save} parameter governs the behavior: when \code{TRUE}, unsaved changes are committed, and when \code{FALSE} they are discarded. } \note{ The \code{insertText}, \code{modifyRange} and \code{setDocumentContents} functions were added with version 0.99.796 of RStudio. The \code{setCursorPosition} and \code{setSelectionRanges} functions were added with version 0.99.1111 of RStudio. The \code{documentSave} and \code{documentSaveAll} functions were added with version 1.1.287 of RStudio. The \code{documentId} and \code{documentPath} functions were added with version 1.4.843 of RStudio. The \code{documentNew} function was introduced in RStudio 1.2.640. The \code{documentOpen} function was introduced in RStudio 1.4.1106. The \code{documentClose} function was introduced in RStudio 1.2.1255 } rstudioapi/man/getMode.Rd0000644000176200001440000000067414703772430015101 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/code.R \name{getMode} \alias{getMode} \title{Report whether RStudio Desktop or RStudio Server is in use} \usage{ getMode() } \value{ "desktop" for RStudio Desktop installations, and "server" for RStudio Server / RStudio Workbench installations. } \description{ Use \code{getMode()} if you need to differentiate between server and desktop installations of RStudio. } rstudioapi/man/registerCommandCallback.Rd0000644000176200001440000000425114147112135020240 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/commands.R \name{registerCommandCallback} \alias{registerCommandCallback} \title{Register Command Callback} \usage{ registerCommandCallback(commandId, callback) } \arguments{ \item{commandId}{The ID of the command to listen for.} \item{callback}{A function to execute when the command is invoked.} } \value{ A handle representing the registration. Pass this handle to \code{\link{unregisterCommandCallback}} to unregister the callback. } \description{ Registers a callback to be executed when an RStudio command is invoked. } \details{ RStudio commands can be invoked from menus, toolbars, keyboard shortcuts, and the Command Palette, as well as the RStudio API. The callback will be executed whenever the command is invoked, regardless of how the invocation was triggered. See the RStudio Server Professional Administration Guide appendix for a list of supported command IDs. The callback is executed \emph{after} the command has been run, but as some commands initiate asynchronous processes, there is no guarantee that the command has finished its work when the callback is invoked. If you're having trouble figuring out the ID of a command you want to listen for, it can be helpful to discover it by listening to the full command stream; see the example in \code{\link{registerCommandStreamCallback}} for details. Note that no error will be raised if you use a command ID that does not exist. } \note{ The \code{registerCommandCallback} function was introduced in RStudio 1.4.1589. } \examples{ \dontrun{ # Set up a callback to display an encouraging dialog whenever # the user knits a document handle <- rstudioapi::registerCommandCallback( "knitDocument", function() { rstudioapi::showDialog( "Achievement", "Congratulations, you have knitted a document. Well done." ) }) # Knit the document interactively and observe the dialog # Later: Unregister the callback rstudioapi::unregisterCommandCallback(handle) } } \seealso{ \code{\link{unregisterCommandCallback}} to unregister the callback, and \code{\link{registerCommandStreamCallback}} to be notified whenever \emph{any} command is executed. } rstudioapi/man/build-tools.Rd0000644000176200001440000000267014276505702015751 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/build-tools.R \name{build-tools} \alias{build-tools} \alias{buildToolsCheck} \alias{buildToolsInstall} \alias{buildToolsExec} \title{Build Tools} \usage{ buildToolsCheck() buildToolsInstall(action) buildToolsExec(expr) } \arguments{ \item{action}{The action (as a string) being taken that will require installation of build tools.} \item{expr}{An \R expression (unquoted) to be executed with build tools available and on the \code{PATH}.} } \description{ Check, install, and use build tools as required. } \details{ These functions are intended to be used together -- one should first check whether build tools are available, and when not, prompt for installation. For example: \if{html}{\out{
}}\preformatted{compile_model <- function(...) \{ if (rstudioapi::isAvailable()) \{ if (!rstudioapi::buildToolsCheck()) rstudioapi::buildToolsInstall("Model compilation") rstudioapi::buildToolsExec(\{ # code requiring build tools here \}) \} \} }\if{html}{\out{
}} The \code{action} parameter is used to communicate (with a prompt) the operation being performed that requires build tool installation. Setting it to \code{NULL} or the empty string will suppress that prompt. } \note{ The \code{buildToolsCheck()}, \code{buildToolsInstall()}, and \code{buildToolsExec()} functions were added with version 1.2.962 of RStudio. } rstudioapi/man/terminalExitCode.Rd0000644000176200001440000000120514147112135016734 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/terminal.R \name{terminalExitCode} \alias{terminalExitCode} \title{Terminal Exit Code} \usage{ terminalExitCode(id) } \arguments{ \item{id}{The terminal id. The \code{id} is obtained from \code{\link{terminalList}()}, \code{\link{terminalVisible}()}, ,\code{\link{terminalCreate}()}, or \code{\link{terminalExecute}()}.} } \value{ The exit code as an integer vector, or NULL if process still running. } \description{ Get exit code of terminal process, or NULL if still running. } \note{ The \code{terminalExitCode} function was added in version 1.1.350 of RStudio. } rstudioapi/man/file-dialogs.Rd0000644000176200001440000000270014147112135016034 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/stubs.R \name{file-dialogs} \alias{file-dialogs} \alias{selectFile} \alias{selectDirectory} \title{Select a file / folder} \usage{ selectFile( caption = "Select File", label = "Select", path = getActiveProject(), filter = "All Files (*)", existing = TRUE ) selectDirectory( caption = "Select Directory", label = "Select", path = getActiveProject() ) } \arguments{ \item{caption}{The window title.} \item{label}{The label to use for the 'Accept' / 'OK' button.} \item{path}{The initial working directory, from which the file dialog should begin browsing. Defaults to the current RStudio project directory.} \item{filter}{A glob filter, to be used when attempting to open a file with a particular extension. For example, to scope the dialog to \R files, one could use \code{R Files (*.R)} here.} \item{existing}{Boolean; should the file dialog limit itself to existing files on the filesystem, or allow the user to select the path to a new file?} } \description{ Prompt the user for the path to a file or folder, using the system file dialogs with RStudio Desktop, and RStudio's own dialogs with RStudio Server. } \details{ When the selected file resolves within the user's home directory, RStudio will return an aliased path -- that is, prefixed with \code{~/}. } \note{ The \code{selectFile} and \code{selectDirectory} functions were added in version 1.1.287 of RStudio. } rstudioapi/man/bugReport.Rd0000644000176200001440000000056514147112135015455 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/bug-report.R \name{bugReport} \alias{bugReport} \title{File an RStudio Bug Report} \usage{ bugReport() } \description{ A utility function to assist with the filing of an RStudio bug report. This function will pre-populate a template with information useful in understanding your reported bug. } rstudioapi/man/terminalVisible.Rd0000644000176200001440000000057214147112135016633 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/terminal.R \name{terminalVisible} \alias{terminalVisible} \title{Get Visible Terminal} \usage{ terminalVisible() } \value{ Terminal identifier selected in the client, if any. } \description{ Get Visible Terminal } \note{ The \code{terminalVisible} function was added in version 1.1.350 of RStudio. } rstudioapi/man/viewer.Rd0000644000176200001440000000732414147112135015005 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/stubs.R \name{viewer} \alias{viewer} \title{View local web content within RStudio} \usage{ viewer(url, height = NULL) } \arguments{ \item{url}{Application URL. This can be either a localhost URL or a path to a file within the R session temporary directory (i.e. a path returned by \code{\link[=tempfile]{tempfile()}}).} \item{height}{Desired height. Specifies a desired height for the Viewer pane (the default is \code{NULL} which makes no change to the height of the pane). This value can be numeric or the string \code{"maximize"} in which case the Viewer will expand to fill all vertical space. See details below for a discussion of constraints imposed on the height.} } \description{ View local web content within RStudio. Content can be served from static files in the R session temporary directory, or via a web application running on localhost. } \details{ RStudio also sets the global \code{viewer} option to the \code{rstudioapi::viewer} function so that it can be invoked in a front-end independent manner. Applications are displayed within the Viewer pane. The application URL must either be served from localhost or be a path to a file within the R session temporary directory. If the URL doesn't conform to these requirements it is displayed within a standard browser window. The \code{height} parameter specifies a desired height, however it's possible the Viewer pane will end up smaller if the request can't be fulfilled (RStudio ensures that the pane paired with the Viewer maintains a minimum height). A height of 400 pixels or lower is likely to succeed in a large proportion of configurations. A very large height (e.g. 2000 pixels) will allocate the maximum allowable space for the Viewer (while still preserving some view of the pane above or below it). The value \code{"maximize"} will force the Viewer to full height. Note that this value should only be specified in cases where maximum vertical space is essential, as it will result in one of the user's other panes being hidden. } \note{ The \code{viewer} function was added in version 0.98.423 of RStudio. The ability to specify \code{maximize} for the \code{height} parameter was introduced in version 0.99.1001 of RStudio. } \section{Viewer Detection}{ When a page is displayed within the Viewer it's possible that the user will choose to pop it out into a standalone browser window. When rendering inside a standard browser you may want to make different choices about how content is laid out or scaled. Web pages can detect that they are running inside the Viewer pane by looking for the \code{viewer_pane} query parameter, which is automatically injected into URLs when they are shown in the Viewer. For example, the following URL: \preformatted{ http://localhost:8100 } When rendered in the Viewer pane is transformed to: \preformatted{ http://localhost:8100?viewer_pane=1 } To provide a good user experience it's strongly recommended that callers take advantage of this to automatically scale their content to the current size of the Viewer pane. For example, re-rendering a JavaScript plot with new dimensions when the size of the pane changes. } \examples{ \dontrun{ # run an application inside the IDE rstudioapi::viewer("http://localhost:8100") # run an application and request a height of 500 pixels rstudioapi::viewer("http://localhost:8100", height = 500) # use 'viewer' option if set, or `utils::browseURL()` if unset viewer <- getOption("viewer", default = utils::browseURL) viewer("http://localhost:8100") # generate a temporary html file and display it dir <- tempfile() dir.create(dir) htmlFile <- file.path(dir, "index.html") # (code to write some content to the file) rstudioapi::viewer(htmlFile) } } rstudioapi/man/launcherGetInfo.Rd0000644000176200001440000000155414560722065016570 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/launcher-functions.R \name{launcherGetInfo} \alias{launcherGetInfo} \title{Retrieve Workbench Launcher Information} \usage{ launcherGetInfo() } \description{ Retrieve information about the Workbench launcher, as well as the different clusters that the launcher has been configured to use. } \seealso{ Other job-launcher functionality: \code{\link{launcherAvailable}()}, \code{\link{launcherConfig}()}, \code{\link{launcherContainer}()}, \code{\link{launcherControlJob}()}, \code{\link{launcherGetJob}()}, \code{\link{launcherGetJobs}()}, \code{\link{launcherHostMount}()}, \code{\link{launcherNfsMount}()}, \code{\link{launcherPlacementConstraint}()}, \code{\link{launcherResourceLimit}()}, \code{\link{launcherSubmitJob}()}, \code{\link{launcherSubmitR}()} } \concept{job-launcher functionality} rstudioapi/man/restartSession.Rd0000644000176200001440000000132614560722321016533 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/stubs.R \name{restartSession} \alias{restartSession} \title{Restart the R Session} \usage{ restartSession(command = "", clean = FALSE) } \arguments{ \item{command}{A command (as a string) to be run after restarting.} \item{clean}{Boolean; when \code{FALSE}, the current \R session (including loaded packages and data objects) will be saved and restored in the new session.} } \description{ Restart the RStudio session. } \note{ The \code{restartSession} function was added in version 1.1.281 of RStudio. Support for the \code{clean} argument was added for version 2024.04 release of RStudio; it is silently ignored in older versions of RStudio. } rstudioapi/man/jobAdd.Rd0000644000176200001440000000437014561520755014700 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/jobs.R \name{jobAdd} \alias{jobAdd} \title{Add a Job} \usage{ jobAdd( name, status = "", progressUnits = 0L, actions = NULL, running = FALSE, autoRemove = TRUE, show = TRUE ) } \arguments{ \item{name}{The background job's name.} \item{status}{The initial status text for the job; optional.} \item{progressUnits}{The integer number of units of work in the job; for example, \code{100L} if the job's progress is expressed in percentages. Use \code{0L} if the number of units of work is unknown.} \item{actions}{A list of actions that can be performed on the job (see Actions).} \item{running}{Whether the job is currently running.} \item{autoRemove}{Whether to remove the job from the Background Jobs pane when it's complete.} \item{show}{Whether to show the job in the Jobs pane.} } \value{ An ID representing the newly added job, used as a handle to provide further updates of the job's status. } \description{ Inform RStudio's Background Jobs pane that a job has been added. } \section{Actions}{ The \code{actions} parameter is a named list of functions that the user can invoke on the job; for example: \code{actions = list(stop = function(id) { ... })}. The function will be passed a parameter named \code{id} with the job ID that invoked it. There are three special action names: \describe{ \item{stop}{If there is an action named \code{stop}, then the job will have a Stop button in in the Jobs pane, and pressing that button will invoke the \code{stop} action.} \item{info}{If there is an action named \code{info}, then the job will have an informational link in the Background Jobs pane rather than an output display, and clicking the link will invoke the \code{info} action.} \item{replay}{If there is an action named \code{replay}, then the job will have a Replay button that displays when the job has finished running. Clicking the button will invoke the \code{replay} action.}} } \seealso{ Other jobs: \code{\link{jobAddOutput}()}, \code{\link{jobAddProgress}()}, \code{\link{jobGetState}()}, \code{\link{jobList}()}, \code{\link{jobRemove}()}, \code{\link{jobRunScript}()}, \code{\link{jobSetProgress}()}, \code{\link{jobSetState}()}, \code{\link{jobSetStatus}()} } \concept{jobs} rstudioapi/man/terminalBusy.Rd0000644000176200001440000000201014147112135016145 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/terminal.R \name{terminalBusy} \alias{terminalBusy} \title{Is Terminal Busy} \usage{ terminalBusy(id) } \arguments{ \item{id}{The terminal id. The \code{id} is obtained from \code{\link{terminalList}()}, \code{\link{terminalVisible}()}, \code{\link{terminalCreate}()}, or \code{\link{terminalExecute}()}.} } \value{ a boolean } \description{ Are terminals reporting that they are busy? } \details{ This feature is only supported on RStudio Desktop for Mac and Linux, and RStudio Server. It always returns \code{FALSE} on RStudio Desktop for Microsoft Windows. } \note{ The \code{terminalBusy} function was added in version 1.1.350 of RStudio. } \examples{ \dontrun{ # create a hidden terminal and run a lengthy command termId <- rstudioapi::terminalCreate(show = FALSE) rstudioapi::terminalSend(termId, "sleep 5\n") # wait until a busy terminal is finished while (rstudioapi::terminalBusy(termId)) { Sys.sleep(0.1) } print("Terminal available") } } rstudioapi/man/removeTheme.Rd0000644000176200001440000000061114147112135015754 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/themes.R \name{removeTheme} \alias{removeTheme} \title{Remove a custom theme from RStudio.} \usage{ removeTheme(name) } \arguments{ \item{name}{The unique name of the theme to remove.} } \description{ Remove a custom theme from RStudio. } \note{ The \code{removeTheme} function was introduced in RStudio 1.2.879. } rstudioapi/man/showQuestion.Rd0000644000176200001440000000154014703770712016217 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/dialogs.R \name{showQuestion} \alias{showQuestion} \title{Show Question Dialog Box} \usage{ showQuestion(title, message, ok = NULL, cancel = NULL, timeout = 60) } \arguments{ \item{title}{The title to display in the dialog box.} \item{message}{A character vector with the contents to display in the main dialog area.} \item{ok}{And optional character vector that overrides the caption for the OK button.} \item{cancel}{An optional character vector that overrides the caption for the Cancel button.} \item{timeout}{A timeout (in seconds). When set, if the user takes longer than this timeout to provide a response, the request will be aborted.} } \description{ Shows a dialog box asking a question. } \note{ The \code{showQuestion} function was added in version 1.1.67 of RStudio. } rstudioapi/man/terminalSend.Rd0000644000176200001440000000130314147112135016120 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/terminal.R \name{terminalSend} \alias{terminalSend} \title{Send Text to a Terminal} \usage{ terminalSend(id, text) } \arguments{ \item{id}{The terminal id. The \code{id} is obtained from \code{\link{terminalList}()}, \code{\link{terminalVisible}()}, \code{\link{terminalCreate}()}, or \code{\link{terminalExecute}()}.} \item{text}{Character vector containing text to be inserted.} } \description{ Send text to an existing terminal. } \note{ The \code{terminalSend} function was added in version 1.1.350 of RStudio. } \examples{ \dontrun{ termId <- rstudioapi::terminalCreate() rstudioapi::terminalSend(termId, 'ls -l\n') } } rstudioapi/man/terminalExecute.Rd0000644000176200001440000000213014147112135016630 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/terminal.R \name{terminalExecute} \alias{terminalExecute} \title{Execute Command} \usage{ terminalExecute(command, workingDir = NULL, env = character(), show = TRUE) } \arguments{ \item{command}{System command to be invoked, as a character string.} \item{workingDir}{Working directory for command} \item{env}{Vector of name=value strings to set environment variables} \item{show}{If FALSE, terminal won't be brought to front} } \value{ The terminal identifier as a character vector (\code{NULL} if unable to create the terminal). } \description{ Execute a command, showing results in the terminal pane. } \note{ The \code{terminalExecute} function was added in version 1.1.350 of RStudio. } \examples{ \dontrun{ termId <- rstudioapi::terminalExecute( command = 'echo $HELLO && echo $WORLD', workingDir = '/usr/local', env = c('HELLO=WORLD', 'WORLD=EARTH'), show = FALSE) while (is.null(rstudioapi::terminalExitCode(termId))) { Sys.sleep(0.1) } result <- terminalBuffer(termId) terminalKill(termId) print(result) } } rstudioapi/man/launcherControlJob.Rd0000644000176200001440000000225414560722065017306 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/launcher-functions.R \name{launcherControlJob} \alias{launcherControlJob} \title{Interact with (Control) a Workbench Job} \usage{ launcherControlJob( jobId, operation = c("suspend", "resume", "stop", "kill", "cancel") ) } \arguments{ \item{jobId}{The job id.} \item{operation}{The operation to execute. The operation should be one of \code{c("suspend", "resume", "stop", "kill", "cancel")}. Note that different launcher plugins support different subsets of these operations -- consult your launcher plugin documentation to see which operations are supported.} } \description{ Interact with a Workbench job. } \seealso{ Other job-launcher functionality: \code{\link{launcherAvailable}()}, \code{\link{launcherConfig}()}, \code{\link{launcherContainer}()}, \code{\link{launcherGetInfo}()}, \code{\link{launcherGetJob}()}, \code{\link{launcherGetJobs}()}, \code{\link{launcherHostMount}()}, \code{\link{launcherNfsMount}()}, \code{\link{launcherPlacementConstraint}()}, \code{\link{launcherResourceLimit}()}, \code{\link{launcherSubmitJob}()}, \code{\link{launcherSubmitR}()} } \concept{job-launcher functionality} rstudioapi/man/savePlotAsImage.Rd0000644000176200001440000000126614147112135016527 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/stubs.R \name{savePlotAsImage} \alias{savePlotAsImage} \title{Save active RStudio plot image} \usage{ savePlotAsImage( file, format = c("png", "jpeg", "bmp", "tiff", "emf", "svg", "eps"), width, height ) } \arguments{ \item{file}{The target file path.} \item{format}{The Image format. Must be one of ("png", "jpeg", "bmp", "tiff", "emf", "svg", or "eps").} \item{width}{The image width, in pixels.} \item{height}{The image height, in pixels.} } \description{ Save the plot currently displayed in the Plots pane as an image. } \note{ The \code{savePlotAsImage} function was introduced in RStudio 1.1.57. } rstudioapi/man/unregisterCommandCallback.Rd0000644000176200001440000000075314147112135020606 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/commands.R \name{unregisterCommandCallback} \alias{unregisterCommandCallback} \title{Unregister Command Callback} \usage{ unregisterCommandCallback(handle) } \arguments{ \item{handle}{The registration handle to remove.} } \value{ \code{NULL}, invisibly. } \description{ Removes a previously registered command callback. } \note{ The \code{unregisterCommandCallback} function was introduced in RStudio 1.4.1589. } rstudioapi/man/terminalActivate.Rd0000644000176200001440000000207714147112135017000 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/terminal.R \name{terminalActivate} \alias{terminalActivate} \title{Activate Terminal} \usage{ terminalActivate(id = NULL, show = TRUE) } \arguments{ \item{id}{The terminal id. The \code{id} is obtained from \code{\link{terminalList}()}, \code{\link{terminalVisible}()}, \code{\link{terminalCreate}()}, or \code{\link{terminalExecute}()}. If NULL, the terminal tab will be selected but no specific terminal will be chosen.} \item{show}{If TRUE, bring the terminal to front in RStudio.} } \description{ Ensure terminal is running and optionally bring to front in RStudio. } \note{ The \code{terminalActivate} function was added in version 1.1.350 of RStudio. } \examples{ \dontrun{ # create a hidden terminal and run a lengthy command termId = rstudioapi::terminalCreate(show = FALSE) rstudioapi::terminalSend(termId, "sleep 5\n") # wait until a busy terminal is finished while (rstudioapi::terminalBusy(termId)) { Sys.sleep(0.1) } print("Terminal available")#' rstudioapi::terminalActivate(termId) } } rstudioapi/man/figures/0000755000176200001440000000000014147112135014653 5ustar liggesusersrstudioapi/man/figures/logo.svg0000644000176200001440000011335214147112135016341 0ustar liggesusers image/svg+xml rstudioapi/man/figures/logo.png0000644000176200001440000005245414147112135016333 0ustar liggesusers‰PNG  IHDRñ·ýq‡sBIT|dˆ pHYsÄÄ•+tEXtSoftwarewww.inkscape.org›î< IDATxœìwxuþÇ_3[Ó{#Bïé Ò±`»ç©w*êÞywþ8ï¼³žíÎ^,Ø¥#Hé½…„HéÙ:óû#"ÆÝMv6;iÌëy||ÈÎì÷³3óžoûÊ<ÑáwÃ.@47—Á‹AºûAø+¬äÔ´‰?ΰ1º{ëÏ{}eû1O/1p4_ñ|¹N„—-vë“üpY•¶](h"n¦qËf‚ð2ÐYÉya2wOtpÝEvtÀ{]’`éÏ/3RV­ø‘:-Èòc– S?ÔB}C±ø"¨ኡî¿ÔF¸{/ÈvM¥Þ]gäÃMzì 3\ °]€´Gåh"V@ÈøÅÑ6Yÿ7|ÞÅÉ£³ìtU=Ô.É)xv©‘ G]"ÐB}B±7 Þa0•Ü‹ ?„*95%ZâþÉv.í{áí¬lÉÖñÌbÙ…Šç 5‚ÀsÌO±n‚E Û:šˆ›à§yï @%çenùUˆà…H3CsYþ«eôùjØÖQÐDìãø•=YþÈS•œ÷sˆà4;QÁÚ:Í9šò¸V–˜«…<ºGñ¯¹"Òd”ÿCÿ4ËFßäŽ?ïõ•f‡<ÚÅ?Tož\¤†míMÄçhã!‚ -äÑh`ž°|’,ñ>„Þ:ÖÎmãì˜ *×±;`ÑÿýÎàKÈãQDá!ëÚ)KU0­]qA‹Ø×AA€Kú8yxzë„v4Š+^[càËíz$å3‘ >äñÂq ìhÈyz±½9Š—ó/èÇ LÄóDóØasdg@ˆSræ¹Á+‡:;€«d[å\ÈãóK ä—+»ÐjÈã#†K‡;%ñE¥!‚=\3ÜÑæC;ZÈ£÷txŒ_–ä”…ù"øèLIQ¾Í{+**9‘“‹Ýf'9©ññŠ+/øŒÝáàäÉS—”IZçôz_Â}£  ˆÜ¼3ŒÒR“ Säèvþ{´Ç&é¸"nfˆà#3íŒêæûˆlɲլ]÷ÑaQˆ‚@iåY2º¥sÓ³1›MÃsüDï½÷ :ž c 5Ö’“Ûo¿ŽôΩª¶m±XX°ð ²²Ž‰$K”T”1qÜ(¦O¿ØçïÝq¼~K*S yt¡ŠXŒãV\%À³€¢'Ö_!‚6ná»UÜm fC½`²Ä㇈îÁ·]ïû—7AEE%ÿü÷‹ôIíM\Äùíî²"œ:Ä_ÿ<×ç^ÑÞyç#J ËéÖ P-v+;îâÒÉã3z¸ÏßÝÌÇ3üݲ~ëÛ0¯C­Jv¨%Ä•ƒMãVl` ¬áªá?\Ç£›'`Y–Y¼dýÓûþ,` Ò'½GgQ\\â{MðýÚMtŠìÔ@Àq‘±tŠLàûu?¨ÖvaQ ™G50€Ù`¢Z_/Y…ìCÚÌsˆ"ÌääÛ?Ôqûx‡RŸôN2¼a7|KÀØ•ùlD¤Cˆ8pÌŠÓ¸åoˆ’´ ­äÜá]œ|ö€…ǯðOŒ¯ÝæÀf·àúe:A$<$”Â¢Òæ7äÂÂR‚BÜ~Jaz‹e¥e„‡6ð9‚ƒ±ÙìX­Ê½:~M¨æN±ñÅÜ:ÆõP6å‘a¨$H›Ìã–/ ý]J³i´oÿTEÐ)ÊG€»Pð{R¢ë«¾õ«_c|&AT×Õ¸|&É2•5UDGEø­½_“œ’@EM¥ÛÏ*몉‰ŽR­íø„8ʫʑÜô¶µ–Zôz&?®¤ÆÈ¼r«•7ïT|®–tŽC¡Êc»±iܲ™¦àâÃò‹(ˆñ 4ÊÜs±/´¨ã;aÂhœ<„Ýaÿùo²,s(çS“U]¥1l0gJò)«<Ûàï¥eœ.>Íø £Tk;"<ŒôôTŸ:Ò`ØlwØÙwâ“/ˆ ‚sùˆ®NÝoåÑvB•É1H–ù?“l9j»ìf¿ÖB´»…­úAé`Š’óZ2DP–d>ûr Û·ï&6<(RZy–ø„hî¸ýFTmÿðá£|0!¡šÌÔZ-TÕVrë-×Ò£G†ªm×ÔÔòλQXP\¿:-I•3lè@®š=Cÿ’憆< {QškY;m½*ÆykEk5Üš!‚¿æ\ÈãÒÝz”»w·nÈcË‹xðâ@sˆþYæ@‘×Cz¬Ì#3m\”Ñê#J3BmÀëV‡í¯-òØ‚"öCˆà(;ºVŸhttÎ…<þg™‘ÒvòØ"’0LX9XtJ/! ÈqW¯“¹|ˆ³ÃVÔhÛœ«ò¸`£›ÂÁŸ;Y| nÃäÍêX× -õ³"Á)Êó€;Ql1¢«“Gf^U5Ú69ÅÏ-5²Þ‡*|.8õ¨ÛtÉ)5lµDÜ{‘ÑzVEP£#ÑŒ*µ‚À³jUyô»ˆª"ø"®ä¼P3Ü>ÞÆœ1Š36hh´§À×;t¼¼ÊH¹kÈxS¨RåÑo"6Ž]ÒStÿ¡ ‡jhø‹f†<®“Da®¿B›/âó!‚¿õ¡CÒ<:ÓN÷mÞ«Ñ>i !¾‹xðƒ9¸ø6_BãÃeî»T Ôè84;ä1ˆY>ͧd>IÈ<~ÅŲ,½àkˆàíã˜ôÚÐY£cq.äñ«õT[KËçGE-5?DÐNBxË ­6;EÅeTV×И]DDâšHH’ÌñœÓ ²5&ÄÇ®^çæb±Ú(;[A€ÙDD¶Ó_””•SWç¹3  h‘ëPR)ðj †¢"ÂT·ë`žÈÓ‹ìÉQ¼%eÞ3 Ž¿T­›Ùd’ò&Dì{ˆ`L¨Ì=-"¸cÏaž{m!¹gŠèÓ§݈G§ón±!//µß¯!.*”ןû3&cÃt ï~¼˜UvsÙåW4ø{ee%o¾ù¾yƒ •“ß5…,˼ùá×¼µàk @ïÞ}ˆÿùóÚÚZ233Ù¶u I Ѽø‡ˆŽ oE‹ýƒÕfgú séÕ§#FŒl4ŸÓédÆõžÉå«÷ŸuûÂö7çCä—+kO€2Yžh*äÑãSnž°lœ.5ékán¼®edÐÃõ#¼p“•©’ª Wµuþòï×xcþW 4”éÓg––Nhh(¢‚7Ghh(}ûöãБ£¬ü~³&mð0|üÕ*¢âIHHhpžÉdâÈáCŒÒ—sI7…,Ëüñ‰WXÿã^æÌ¹‰ž={Üð– 4h0E%e¼üæ&Bx˜ûDóí…E߬æxn1“'Oi2“¦(Ф¥¥±{Ï¢#Cèš–¬º}‚]âd®æÀ ƒ¹:ÞJ˜¢¯1_­O¿1Ûyrá1w¹<éã—%Ç-Ÿ/KÂZ ¿ƒÇõpò̓u<:ÓFº5ÃÈÉ+àò[þH~I5¿½ûúõë§H¸¿FEfÌœÅé‚2¾\º¶Ág‡Óãwët:‡ÏíúƒWÞ^Ä¡£§˜sÓÍ„†6>çE‘1cÆ2bä(î|èIªkj[ÈJuølñªèœÁC†ñÙ·ß«d‘{ŒpÏÅvÿ¡Žƒ ;7¹'+Lã–-6^ââDuþɼ8Ð<~ù\Ÿ#,¬y+—YYÇyï½éߥ/Ñaõµj,5|¿z#u S'Oð‡™8NÖoÞÉ]¿½»ÁßËËËyû­·¸¨woÆŽOYEß.]Bqñ0F:_o.$$„Ω©¬ß¼‹™—Žñ‹M+V­åÇÍ;ÕkA?•+©(åÝ÷>á®ßÜHFWE.õ"˲Ïk.þɲ̛o~H]••‹MÀ 7€,s²ðÏ¿ð:yìBC®?œ«ò8®Wo®1ðÑf=§×?¨“ oÇŽ¸]TšÛê\Ý›?Lo¼îÍ7߬ 1ªãS~~=ôúuéCQa)û÷RÒ,O½ü>¡¡ >Bñ¹-É‚¾ ozŸŸ dbpÆ@¾ûn߆˜'só "äWÇÊ˹dð`¦IçøxuïÎCW_Û6Qõ«¶“’SØsà¨_쩬¬â»ÕëÜuÀψ‹¢oZ/,üÒ/í´Eöí?LIQýÒûÔ @èŸJ§È¾ýv¥ÇsCÍð‡év¾~Ъ8zOäá^¯¥ÅH¼z›Åë t'rr‰pÝ•ˆ ‹ádNž"cwí;Âʵ[™Ýàï2p$÷(C÷oÖ6`[¦gÏn”SUÛpºâ”œdÎfÌeS@W wðíCµLíßø»Ñ×â´Ÿs[ :ì¬l:°™äèdÌTTWWrš®¿‚ÈHï#^}ÿ FŒ¥zYLqõU³xáÅ7Ù–¹“øðXô:=%¥œ­-çþûîDÔ}ÇO˜ÀG òï… èš˜@ie¹E%\}Í5~ÛŽs‡ Üõ››xéå·(«*':,‡ÃAAy!¦#×\u™jm·6‘á\Ýå|üÉW$Ç$F¥ŽSÅyôï׃aC}su ª×áò½ž{QUÇ67Üp%™G±{ÏÊJÊHï™Ìœ‘Wéõwœ8u†ÓùÅ\yu÷¦n#˜LFýãïØº}7G2³±X¬ чѣ‡û¼µ¦ƒÁÀÍ·ÜBvv6ùùùtëÜ…Y=zèŸa|c$ÄÇ2ïñ‡ÙøÃ6ŽËÁbbòÈñ 2Я[km‘Áƒú‘š’Äæ·“—{†¨¤&͸–îݺ¨Ú®ê”îݺ4ëG|¹t-}û6Ï«5DÃ1bø Öi_ÈÈÈ #CÝ¢âî0›Í\2i,—Ljñ¦[èèHf͜ܢm¶ye¬Þ°nÝÛO/¬¡ÑÒ´i—œ¥¸ä,‰‰ê.ih´gÚ´ˆ÷Ê"%%©Ý,hih´mzÓîÐÑ“DÇ4Æ|âÄ víÜA—® 0 ÙmÖÖÖòÙ¢Oå;-3z̸V™_jh4E›ñÉÜ|""\W²m6ûöíe×Î :®š9‘·>üšØØX:uêÔ¬6ׯ[Ë€ÞéÜtÕùlÏ¿þµµí;dO£ãÒ¦E|º ˜~Ó~þwii);wì`ßþ} Ø›§þrÃ×B¤&Å3ïÙ·¹éæ[÷-cÅÁƒ9v,›ÿ>ùRƒ¨žðPÏóõNøÚp_£õhÓ"®®©Ål6sôèQvíÚAA~×̺˜=z+ ¿Jnwéø””Vðß÷æ3sæ,:wîìu;N§“mÛ¶±cûV>xežKX^BlÙ§]CלN'egˉ‹ñ~ß[CÃß´iÛlv>þh!‰ ±ÜvÝt¦]< £_ásÜ0{2)Iqüå߯DRR2¦&|­kª«ÉÊ:Jïîi|üÆ“¤&¹˜Ïž9‘ëûWdYn૜æ4ƒûõ V󊆆¿iÓ"ž2a“Æ£oï”FÀÚ/_çÇû8œu’Ò³DJ ÄöNâ‘{®¢W·4G¥§&²àÕ¿³bíêêÎ×Ã=p ³gNôÚ6 5hÓ"~èž}:OF ëϨaŠR„5JFz 銟hh´mzŸXCC£iÚtOÜ–¯ÙLr§8ÂB϶[X\À=[Â, ¿Ó!E,Ë2þí?$%&4(»âI†¾=Ò5k´[:¤ˆ':Ž;Éc=JN¶ò|_­Ñ`Àé”$IQ”›Ýno‘Ж¢CΉmv;/s0ëõzlv»Êi¨( š±X,Mü jkk ñº¨I›§cŠØf÷:‘ºN§ÃjkÝ ¾“œOqq±¢sŠŠŠHKiž{n[¢cŠØî@oð.)˜^¯Ç®õÄí–ÁýzpêÔ)Eçäåå1¸_ljQï˜"VØkÃéöËä #8|ÈëR¾H’Ä‘#‡¸d|ÛÎ]®„Ž)b»½Nˆµát»eHÿžõ"ÙÙÙ^àÀRã隦^ÖÏ–¦ãŠXÁ–6œn¿‚Àcsocõw«°ÙÏŸ]WWǺµßóçûoi!ëZ†Ž)b›Ãëã:»]ë‰Û3ã.Äèaýøúë/=–™µÙl|¶hWLÏ€>ÝÜÓ^é˜"¶ÛÑë,lµr}aæóÄ£w‘šÅüÞo°Ð%Ë2ÇŽãÝwÞfØ€nüñÞ9­h¥:¨êìa³ÛY¾ò{öî>@Eeq±1Lš8šÁƒý˜à»ÝNÁœX WTTòÕ×ËÉÊ>Ín'%©—ÍšLJJÇ™‹yâÔ©Ó|óí NåÁh0‘‘ΗM!,¬ñèÍA§Óñâ?â«¥ëxõýÏ©ª®%<<ŒÒÒ³ÄÆDðØ73yÂHÕÚ?ÇŽ{ùþûM€}™2eB£!´ÍE5;ž}îUô²î‰=H3SQ]ÁW_­ '÷4W^®^a4›Íû9nýœØ¿".))ã™çþGrLƒº @/ê(*/á•ÿ½ËM7Φ_¿¶_ŽÆWöí;ȇ ¿ {R7F÷Crrºø Oþû%ýãò¾ò‡/\1}•  K{* GtòËŠ°9\§J'‹N1 ¿zë ª‰øâIc °ûØ>Ê«+°Ú­–ñãá팺h¨ª«´zƒ£›jõ×ë-†5Å7\Éñ“Í˦º®†Zk§ŠrÙ•µ‡›ç\­jyÑÖD§×qÓœ«Ø™½‡SE¹ÔY먮­&37‹9Ü<窱#0 €¾}û2tèPz÷îÝ"a‡I‰uѶÙFaYV»•òê vÛ‡h„É—ŒW­mÕ^‹:½Ž?<|«V­g×î}TTVÃ5×Îd€Ê«³6»£AVʦðw8bTdýË\¾ùf%{³÷c·9HIîÄü†¤Ä¿µÓéÛ§'sï¿“o¿]ÅÖÌ0ûL IDATŒzºg¤sÛÝ×â9wGà²YSHMIbÍ÷9sˆ°ÐP êÇ¥—ŒE§`z§UÇ6z½žiÓ&1mZËÖ¸´Ù슂Äë{bÿ.|„†„pS õG`` ×]#vIÏ=‰ÅÚxº¶A‡±Õ®lNÜÖ{⯗¯çù_s㜛 sò'¢(2}ÆLœ‚ßýé$©e4|§CŠXiO¬uØÛèœøxÎiž|ñ]®¹ö:Õ|A˜9sùEå¼ñá—-Ò¦†ïtLÛ½O”m×cËétrßcÏ1~üDbcc[´mQ¹ìò+xïã%ì;”Õ¢m7O‹rR^¬ë"¶+ì‰E]ÛÜ'^ôíjD‘AƒµJû¡¡¡Lœ8‰'žǯ™OÔÂétòê{Ÿ“Ò9­ÁßSÓÒxåÏÚÅoð…)b›Â9q}Oܶ†Óµu^~ëS&LlÙà‘_Ó¯_?Ê+kùnýÖVµÃ^yg6 6¬Áßnj˙¢³Ì_´¬•,S—)bûO¥M½¥¾¨ZÛZ‰]¼r‰‰I$$´nè¢ Œ3–7æÕªv4Å®}GøèËU̘9Ë%kŒ(Š\vÙåü÷EÉ:Ù:ªHDZ‚ PŠhmcÃéϾýž¾ýÔMíë-œÎ/æØI×l%mªêZ|üE¦M›Nˆ‡˜åˆˆ&]| üõ?n묃ŠXùÂV[ñéü"N. k×®­m Pß“õéÓ—oWnlmSÜò·§ß sZz“Þkýû÷'<2š§^z¿e k!:¨ˆ•÷Ämiak×¾#tîÜYQbwTUUñÅŸ“™™Ùl›:§¥±eçf¿Y÷ÃNöÈbÒ¤‹½:~Ê”©¬Z¿Ýû›MÚ SÄŽöÝïÜ—I|BóŠ`gffòÎÛo1°ggÖ¯]ÍòåËšU8.11‘̬“³Y¶«•ØØ¯Ó1™Íf¢¢"±v !u‡±CáÂV[ë‰3³sˆ‹‹óé\»ÝΊåËX·v5¯?û'þòàm,^ðbÂL¼óÎÛøô½f³™`òÎùt¾ZÄFGR]U­èœÊÊ*bc"U²¨åép">7V’×Zׯö‰Ë+«|J³ZTTÄûï¿KH€È·óŸc`ßú9bpP Ïÿ}.¾o´õëÖù´gDYE¥âóÔ$6:’ŠJe6UTT­n9™–¤Ã‰Øf·+Îmìïl—Í¥²ª†€€¯—e™;wòÑÂÜÇÕü÷ß$4$Øå¸)/âëùÏQ^ZÀÇ-¤ªªJ‘]TT(ëõÔ&6&‚ŠŠJ¯_J6› ™à @•-k9:žˆzkÁ¹9qÛrö𖺺:>ùø#N;Âï>ÍåSÇ5z|§¸h¾þ.7˜wÞy›cÇŽyÝ–€€¬v9… ÌÔÕÕyu|ee%Ñ*ukiT'>t8“Ý»PZZNrr'FJLL´jíÙìôe9~ë+#ú·'–$‰·ìàÈ‘cØl6ÒÓS3f^ô°ÁAX,BC›.Z\\ŒÃfá«wŸ÷¾°º(rß×Ìòµ;éÒ¥‹WçÕÕÕÚtîèÚº:6lØÂ‰§0ôèÞ•‘ FÔé3¢£Â©ªª"0°éÞµªªŠXE\TT›·“›{†¨¨p ìKÏžê5Wµ'ž¿` >ü’ªÂZÂtaäfåóô³¯²}ç^ÕÚôµ'öçpÚbµòÔÓ¯°võf¤0;Ø·óO<ñòó›^X  ¡¦¦Æëö-ä#,$Ô…ª®©&"¬qŸ9SÀO<ÏÝ™˜H5ðýšxêéW°X­Šmô†ØèH*½œWUU¥ŠÛwìá™ç^åTÖÂtaTÖ2ÿÃÏùpºÕ Uñ–-;ÉÊ<Áè>#éœJ\d,Ý’»2¢Ç>ýôJËΪҮÍnGïeñsÔ/lùo8½hÑ73Cº "9&‘„¨xú¦õ&£SÞxk!’§Â[?Ñ»[šÏ«ÈjaµZ©¨¬"9Ñóª¹$I¼ùö2»Ò§s/¢âIŽIdh·A3‹>ûFÛâc¢¼žßWUU‘ç—–žåÓEß2¢çPº'gKç„TF÷½ˆ£™ÇÙ²u—ßÛ<‡j"Þ°i+‰. ÁÁ$Dűk·:IÙlv»âªƒz½‡ŸRÖJ’ÄÎÝû葜áòYbL'œv'9M¸/öíÕ•â¢B¿Øã/òóóÉHOi´Ç?y*§C"1Úu»{bWvîÚ§JH`B\ÕÕÞ‰¸¶¦†øXÿo/íÚµ—N‘ñ4ÜUÐ "‰]Ù´I½ÕDìt81x¸á‘ºZï"”¢Ôåü;œ®gЉîm0X,–F¿cø Þd;Ö¦b`ËfÔ°Æ}¹v§ÇQþ§º½jÔ Ž‹‰¤ÖËéGMM5±Ñþ±ÃéôXuĤ7R[×ø=oª‰¸K×T Ë‹]þ.Ë2ÅŤ¥¥¨Ò®ÍæPT`Î-lùçá2èõÄDGQtÖõ·[lÊ*Î’œœØèwtŠ!¥SÇ÷‹MÍE–e:ÄŒKF7z\rJ"UXl®lÑÙb"Â#0™ü_26:‚šï¶¾ª««TÙ#îÜ9…ÒÊ·[]ùg‹èÒ%ÕïmžC5O<‘‚²BNäçü¼-asØÙ{|?ñ 1ôQ©>±ÃáÀ`P>'ö×pàºk.ç@Î!Š~ñ«ª«fgÖ¦LžHppÓŽWΘÀ¾½{üfSs8vìáaÁd¤7^WÙl21åÒ ìÌÚMuíyQž-æÀɃ̹a¶*öÅÆDRYéÝpºÞÑÃÿ=qî]‰eÏñýتQ,Ë2Ç NRPVÀe3'û½Ís¨¶ÅÌÃßÍG}ÅÊm«1›ÍX,FƬSyT)Ád2âPØ«Úl6Ìfÿ¥gíÚµ3¿¹ãF>úäkvgïà7 Ë—̨͚‹†5ýÀU3'ñ¿w?£°°ÐgLñãæMüþ6ï*<^rÉ8ƒøæÛU‚€Ýa',4”»îœC×®U±ÏÛÕiY–)¯¨$F…žX~sç¾Y¼œ5›×` ÎRGZçT~øn¯^ܾ¢ê>qLtÜ'6›ŠÊ*¢¢"TÛ+çhæa&ª¢U¾¡Óéxúo¿cÍêÕ”––¶hÛ²,³tÉb¦Nɰ½[´m_ˆùÉk«1ªªÔYÔjm:œˆnºz*;¶oój±*77—Šòr&ŽÒ–)§gFÞw3Ÿ|ü‘¢ÑEsù~Ít8xô¾›[¬Íæ镈ãcÕñÖjM:¤ˆ÷ïIÿÞ|¿fM£ÇY,–-]ÂcsoóÉm±¥˜=c"³gLà#"”"Ë2ëÖ­åTÎqÞ|þ1Œ^Û·6ñ1QM.n©å­ÕÚtH<ùç»)8“Ëڵ߻uš¨ªªâÓO>fâèALtQ+X¨Œ{=×]6‘>xŸÂBu¼¹ìv;K/¦¤ð4Ÿ¾ù$a¡®áŒm•øØ(ª«ß+®­©V5ø¡µè°" æÃWÿŽ­¦œwßy›mÛ¶qêÔ)²³³ùþû5¼ý̸֛x{èŽÖ6Õkîºé þ|ÿÍ|´p?nÞŒ,Ëä“Òˆ?sc$'ÆQTTŒÓé$??Ÿwßy›Øˆ¼úáþ]­W›øØHêjŸnÔÔÔׇӲ´é9¢#ÃyïåÇÙ¼}‹WmbÇÖM˜Í&úõìÂ_ï{ŠÔ¤øÖ6Q13.Í ¾ÝùÓ?ÿÇsÏ=Khpï¾ô7Ÿ¾«_ï öéÊž³ÙÄcÜÊŒKÇøÙâ–!6:‚mÛw°mûŽF‹‰º©…,j9Ӹ壼_¹Õʸm+1šÆyªªk  h¶ãLMmfÕp4šÇú#:î{ß³3R‡î‰;:!ÁþI1Ô{¹êÑaçÄ šˆ54Ú9šˆ54Ú9šˆ54Ú9šˆ54Ú9šˆ54Ú9šˆ54Ú9šˆ54Ú9šˆ54Ú9šˆ54Ú9šˆ54Ú9šˆ54Ú9šˆ54Ú9-&b§³õJ’´fÛ@«–ciÍßÞÚeh.”gNÕPÄÚÚZ¾üjû¦®ÎBxx“&Œfܘ‘¢ú±«[¶íbÅŠï)++Ç`4лgw®š=P/jì6—¢-ú–'s$‰¸¸.¿l*={¸Zó7v‡ƒeË×°uËNªª« fÄÈÁL2 ƒÂ²¯¾pèpß|³œÂ¢bDQ$=-•«¯žE\¬zu©ÏQYQÅg_,áБ£Ømv"#Ù:uÇT½mY’Y¿a3߯ÝÄÙŠJÌôë×›+/›âUíd_Ñé;Ï™çéÃiœtŽö­2¼ÕjãßO¿ŒÓýÒúÐ3µáalß³‡¼3gè߯—¯6{Å7‹W²~íôLêFßôÞ$Ç$R\\²ïÖ0bø`UsççðÜ ¯M¿ô>d$vA‡žïÖ¯#$4ˆ¤DתþB–d^zå- s‹éÓ¹7½ÓzÅ‘£Ùìܽ—ëü¿eë.>ùäkÒãÒé—Þ›Ô¸j«ëX¼j}úô $D½¼]UUÕüë©— èŸÞ‡î)™‚ؼm555tïî]1u_ùpáçìÞuˆ^©½è“Ö“N‘ äÎgõ†Œ9 Þ·dŒ9%"Ë÷x~ùª6œ^ºl5!¦z¥tÇl4! ÊÐnƒ8xð(YÇN¨Õ4ùElÚ´•¡Ý  F2’º’ÏgŸ/V­m€æN¤ :ǧ`ÐE‘¸ˆ†tÄçŸ/n²*bsØüãª+jÐ¥A?•Ù 21°K_ª*jøqËvÕÚ®«³ðùß2´Û â"bEƒÞ@j| =’2øðCu‹mõõr"ãÉHì‚Ñ`D"C"Úm6m¡  Hµ¶³²søÐQ†vHX`f£‰^©Ý 1±dùwªµ­šˆ>JR´kõ?NG§Èx2g«Õ4YYLjˆÅè¦:brL™™êµm³Ù8SP@bŒkoLXp'NæªÖþÁC™tŠLÀ¥H³ •ÀÁCGUkûdN.¡Aaºö¶‰18_à·²îÈÊ>Ab”ëu7ŒÄEÄ’•¥^•É#™ÙÄGÄ»-i›Ä¡ƒê]wÕD„Ýéþ†9e':çfÁÁAØ%÷‰ã%IRµmƒÞ€^§ÃétŸ›Ìét¢WXµQ ¡¡ÁØ=$Íw:%ô*_w›Ãý=—ÎÕmV±”Á Ç)y¸î²äópÖ‚ƒ‚pxh[’œè êµ­ÚíÛ¯'9…¹üzFmµY9SšÏ€þ=Õjš®]Ò()/£ºÎ5…é±üã ÔWµ¶Q [FNœrù¬¤¢«ÓJZjã%B›CŸ>=É+9íò0;%'9E§2¤ñBáÍ!±S6ÿ¸“ââbb£5r0ök‘¶KJÊX¶| 'sò0 ôèѕɓ'`VQÀçp:œ¬Y·‰ýûSU]MRb'.½t)É®ë3j•}œ5k~   ðð0 ê˘QÛµ¥ÚTÊZ-ï´†F§)kn—íMÄíMÄíMÄíMÄíMÄí­*b Ê"ðÎ:ƒÛÏî¹ØŽIﺋXmmÇu”V $EÊ ëêD§U6ULI¥ÀΓ:j¬Ð%V¦jËoÉj"îÔZáÝuîoåãí˜~õÑî“"-0QZ}^µ=;I¼v»•È`ß<ô.D–íÕóÄjmç¯ãØN^˜cEE÷x´áô†,Ã#70Àá3"Ï.uß›k¸RZ-0ïscl8¢ãƒM-{5_`TV¸7ïÉÑo9rFÄâ!ªrÏÉ–½ŽÚpÈ.ÙpXdK¶ŽkF8¸¸OÇu5’щà.TŒúY‹: 1!ž§Ñ|¦¬ˆ7ѱú€Ž™õ‹;ç¸b¨ûXÜŽ‚Ù·Œu¸Ì¡n§^À~G£[‚Ä„^NÖjZiÒËÜpQË>C¬ˆ_ýÎÀ¡ÓæðñþKm$G:Y¼[OI•@r¤Ì­ã ïÒqG jðÌ 6>Ø gýaUu‘ óÛ‰vº%´l–Í VÄ2¢³‡9™=Lms0éeîšh箉­;‚¹0»" D›ë‰äŸ(¬ˆ •IŒ”]r¾£¢V «@¤°êl&ˆ”é)“)¡bòŽÅ)á<‘3gEªê 2D¦KŒDjLëîéVdŠ”× ÔY!È, Ýã„ùþ½Õ–úÅÆÂŠúßkÐCh€L÷‰NþýÍ•8”§£¨B@d¢‚¡ª“ õóøñ¸à”\ùþݺÆI,ß«ãå•N—Wßæyµ›Ïëp |½CÇW;ôÈ‘=ÜÓ³LŸd‰×o·"õ"¿äß?^ã!kì¼/Œ<ùõyÓb$>¼·þ`»&<é> øgXHw?ºî3ye®o”çn´2¢«ç!m­Màíïõ|¹COYµëuë›,ñø•6•=Ø÷½obwŽk®«‡¦Ù¸²‰…½Òj…›ô¬Ü§'·ÌýÛU!#NâÊaN®bÇÜĶ©$Á–lëëØ’%r²ÄóÛ71RâºN®»ÈáÖí÷Ï7±ë„ëo|pª•ÙÜ”V <¿ÌÀêýz—­"£&õqòàTñážÛ˜ù|gÝÜ——o¶2(­å¦*-*âÊ:ÁíÖ†S‚϶êùÇW't?U"2÷C#Ù…Mw±U³ÎßD¨¬kÚÆ:›À/«i˜÷ÌãwÈžÞ&@Uàö<‡Óó9Ç Eî}ÏH~¹çߺ?WdÎÿL0ÅÎMcì nôÉ‘µ‡t|²ùü9zÌUÃÏ¿)VÐSîš–šá]œ$ÿ"Mocž9jðÅ6½Çëa6Àìaú$9‘e³u,Û­CÍÑ[VÀ["¤.îãdT7'Áf™Â {ÝÛo±Ã?¾2òÑï,n*uŒîîdÖ'CÓ Æj¬ðÊJ#mv}m1(Ú*;W¨±S„ÌìaR£%*kÖÖ±ñˆû†#:Ž ¤Ç¶Íà6!b¨ÙíãÌè "D¦¼ZdÓQ½ÊkêWM€Qæöqv—‡¢s´Ämc%æ\tþ3£¿âüÜñPžHyëÃvå0Sû·Îþ©,ÃÇ?º¿%¡fx÷·–Ž39˜>PÇïß7âpªÓ¿¾Ú€» ¥=¼8Çʘ_eC3ÊÁ ˼¿ÁõwÌÙ©sÉ :¬«“'¯µÑ5ÎýÜ3Ḛ̀±ï”ȼ†÷,³@¤²E#°¡]œü÷Æó¢¼j¸ƒ÷6xa™ûÖ²=z~iÛôhkÃi€¿Ï¶ñûKí¤ÆÈ„š!%Z↋˜ ¸]цúE¨‰iÉp0p¬H䘇9ÿÜ©6·ž@e8™3J—N Övokw0Ô÷ÎL±yìµÖpíížf÷(àsˆ" NwmO’àD±÷q ž¹¾¡€Ïqë;ñîíÞsJ½ÊÍ¥M<æƒÓ$fòü †Ë›eª-®b~n©•ûtÌæ`Ro'a ·[Ú{sÜ¿¬‚Í23{¾>³;Üö|Íe÷I67Í \7Òó"†N„©üo•ë vûñ¦W\)p¬H$¯T ïìOÿ/Èñ°õ¤dMà’¾¢<ÄL Lèå «ÀÕîì‚¶»¸Õ&D<¹oã«ZºŸæ^žWöçŠìÏ5ò¯`bo'×t0ÄÍ[»­“]äþ!í(5º'š¥Ž¯nž‡}àäH‰¨&Ö zvroSa…€,»mÌ.ùx³žµ‡u”T*LÍûãû$7~­<íõ{³=ÙZ´ wõ0„ù%L±³%[GA#ËýN ¾Û¯ã»ý:†vqòäÕoÖ·5*kÝ‹8¡ /%ƒ¾~¸énîÚ<­Ç„6}®'‡S Êr~ë”á¿+ ¼·ÁýÜÛß„51wŽòŽép XB£/ÓÖ¢M̉ƒÌM_˜¨`™î¶28Í»;½ý˜Ž9¯š}[£ÎƒÏ†±‰W­$áÑs­98<\jAhº±ÆŽøe•Ï——xggëu2)Q#º:镨|•‹MØîi«Ó §M ÚHOìm­©„p‰÷~ka[¶È› lÎl|{¥¨RàÙ%žŸ£Ì£ÉëE<‰áטÝ,¶T[¿@嵂*"÷ÐkUx1üOF™€Ÿ¶]ŠnSÙ„˜eîœà`l'c¥Ÿø½·¾ùá£5M\˾¡^t4­E›±R†u•ÖÕJi•ÀŠ}:–ìÖs0ÏýÍ]{¸>¡·í2žo²N¬ŸË¹Li@R”ë§@‘—sãÞ¦”_\£{un_~ÏÞ`ã¢n®k¥ÕÛë ¹¥ß‹½n|ÊÒZ9ؤ1ÚÄpÚW¢Bdnåàãß[xúz÷N3g½RŸmäAEô༓ãa›ãð÷þâîèç~1.«@hÔÝô‹m꼋wvºṵ;ê×ìÏÙî&*I)‡N‹,øÁõ¥ç”`Þ—ž}Ã'ön»"nÃéŠZ‘Ë_01µ¿Äì¡úwvMt¾ó„ÈáÓ®7Ù ‡ø0×1:Ø}[2u<³ØÈÅ}œXpø´ÀíãϯvôJ”Ü:ìϹë#7q*sú¬Èü:ö*È Ù5N¢G‚Ì‘|ׇxoŽŽÿÀÍcìt‰“¨± ¬Ü§ãËíêÞÂßL°sÿ|×¹HI¥Àuÿ5qÃE†¦Kšd *–îÒñÝ÷6èêl\=ÄÍG’êÃAÿo¶•Psý¿7ÕñøgF¿­^?·ÔHVÈ´õî¢9ÅõÂö4%ëÙIòÉÔh"†ú^mñ.‹wé6ËtO‰ –±;àT©Èñ"÷Cg4âÿ‘IDATæKû8ÜÎÝú¥Hn‡|² ~Ðÿü¶î'5ñø^K÷¸·qÇq;Ž7¯·¸e¬?ê~ŸU ð·ÏZÖ\O'cz8ÝúWÔ ¼¶ÚÀk^|O°YæO³.0öJ’Xïæ{¿Û¯cý¡@"eÊküà!Ëðõ½WA‚Nk›î–çh´›X¶Û}@kSmØyBä»ýõäž(óûKÝïLàðÓz;HŽô~‘cj§Û/OLèd|OeC·!^n»ù‚ ÀS×yökö£þu­«+æ¬ANô:÷×Ææ„œbágô0º{óg ‡i”'nmo4qƒÚ”×Ôë°1ñò½:f<È»ëônÝïÚ2 áoÜa%1Òý ‘y`ªò­'£þyõçm’Æ*1o¶/¶Uðïë¬ ëêÝ[߆º[h!f™î±2±—ò‡ .LæÝßZܾ˜#%îóð’ý%¢Ͳz\óPÂo&:×Ú¤sÀM£<~…­Ñ|Pî†â;K¼u§…îR“Öçv¶óÎo,^‰ý×™àµ[-Ìb#ØÃþd€QæŽñõm˜ êo„˜e^¼ÙÊk·[’îl2YB¸ÄÃÓì|û°…~Ì'ogçoWØ<ú¼wŠùß­V¿eæ 0ʼ}—•YƒCjŒÌË7[yì2›Çünj²)Sdö‹&žøÊèÕHX0[®è ÑÕÉ#3›Ž:q‡'ÿÓ 3^UäsJp WG^™ÀÙZ(¯pHÁf™¤‰n ’O1Ÿu¶úùlV@¥EĤ— ”é+18]BçáfK:#²÷¤Ž²šú!_r¤Ä˜Î¡qUÁmúž@£àq8y›¶e‹+Ôq¶V Ô,‘%3º»ôóKM’ ÚÍJ/@ˆÙÕO¹Æê¾„Ùˆ×SŒÊ:ØuBGÞÙú!¯Ý)(,Ñ?E&%ZÙóQkØš-r4_¤Î."Ñ5NfØ/^;ØÜtÜ׈µ;ß6³-ÛõÆýi–íçäîE•›2ë]ye :X¦_ªäuOíé¾™ðøÌ4Æ©‘—WÞ£%Õò®ÙõÉìÿ·Zï63kE¶®›¼D鉾;•_«7Ë–ÛexˆVrj\˜Ìý“mÌè>è\C£½±î°Žg–Ék"sˆ+B¹,KOÙ‚x‘åÓ<øÝ5ñ ¾œÔ€‘+"MFùÿ€{QÚ8$Mâ‘YVz$h½²Fûäx‘À3‹¾øIH2,4ÚÅ?Tož\ÔüÖǯì!ÈÒ À%ç‰"LP-â)©·†F[£¢Vàõ5>Ù¬÷Åcq$ sík§ìõ‡-~ÌšÆ-› ‹@º’óBÍpûxsÆøç«¡Ñœ+rÿò*ï"Œ~E® ˵l˜6ߟ6©3#í½ÈhŠ ½A~ð"ÕøyR¢%îŸlo‹ÉWÎä²zõòNçL¿þ=3z¢Ð2!•YYÇÉÊ:Õf£sjýû÷Fl*†ÏOœ=[Îþ‡),(&.>†¾}{Ö"mK’Äž½ÈÉÉÃd4‘Ñ-Œ®ŠÞéÍj{ÃÆ­ì߈ªê’“:ý{ç]UyæáçÛçšBD’áŽ(Tc¢å&Q+$ÔÎlW]ر«ÚvÄ ÓV»˜Õ:#h¸XW§Óé0t‰]JK‚p$ r‘«Ü…$r!·sßßü‘dhš²Ï9{'çd?žðžïãœýÛ·³ŸïåÑG§“–:0ì÷Þ{ÖÂÊ|[(=²›„àMÎ7(Êî 5`xèz[É5­0-¨ÈåÀ÷Ѹ(_8Ê#ÀÁCGyÿý‘:Œ~ ýðú½”]»Œ#ÞÆË‹ŸÇbÕïp ªüþ?Þãâ…K LˆEQ¨n¨AXþáÇßÓ=Lû÷æƒ7‘Ö?§=·ÏMEÍU<9Ìû»ü^HÔÔÔòÎoþôïÓ ªrµ¶’aÃÒùþ³ßÁŠ£×Ey«‹ß`Hò`65õµœ«8Ï·Ÿú&÷Mé}/\¼µÙÞáRB·A øP­?qö‹! Þ ¹7lËÞš¡Õµ¦h©³(ðDf€»µ¸ÿ·Ôݨ痯¯&ë® \mûr>{”qF3/WÓ¥»&>úóNû “FN@üÕ‘÷ìås¸qó“%Ï#tº-_^^ÁªÕ¿ã»3éwóCkp7²÷Ô~–¼ôƒÒRt[JIÞªÅ)\ŒtóÈ+U•C¥G?a ßœ—£ËØ›ò·qòÈi&޾·ÍëõMõìûò ¯½ú}ûvÒ§¥ê<°®ÈΆÚW¶p@He‘»dænm•Ú1äÜοcæAoɬiZ•Ç  ~nenž6åñÄ©ÓÜ‘”Ü.À£dÿˆÜOèUª—ìeü°»Û`Ôà‘ÔTÕpùJ¹nãïaXÊÐ6èÏðé””ìÑmì²KW¨ª¾Á¨AmO…¢0~øÝ”ìÜ‹Tõ»yyôØI†§o÷z‚+ä¤?yºKïÓªæ¾ÊÒTW<ç)þü# †®;åq×™ÛŸÒHèôHgS,ø}ú­›ðP¥ŠÃÚ~]Äǹ¸q£^·ñ뉳wlž¸œ.jjët»©ÉËáìðôÎis ª*^¿~ëy<¬–Žå´vñ{?p΂_;ùùFÕa*‚ZŠÃÁøE³Îmòå,W„¼S»ܺ÷VÎU ~¸ÎÁ ë·üQ}ôÈáTÖ^Ãhÿ¥•]»Âcô»Éb·ÛIìÛ—š†ö¼ú~ªêjIÓét`øˆ¡T7Twø·êújÒ‡¤é6vúAT×Õâïàs¯©¯%ÎåÄéÐôè½&FAyUE»×}?Õ•Ü9fD§µµ‚Ÿm´ó÷¿spú6msÚ# „Tîòç,b×<ýöÐÐm?æοW¼ðÞÿØG~§PU•{„`HWk/\WظÏFm£`â°`»®ññ.êêøâÄ1] Øí‚Á_U\àâõ2~øƒ…8œúmLI‰ |ºkÉ ý±ÛšÈ¾€Ÿ#çŽ1qâ8îϸ÷6ï:i©w°í‹BÐ7>Aó^òâÕ2*j*X¸p6Û-š(…ÝnãFm='þrš‰ÉX”æÍ«ÞÝÀg0~.i©úíÀFŽFÁömH)Ip% …ºÆ:Žœ;FfæD²2'µ«qûà÷;l,ý£½Ãæ·á°êSÞ’9o.l¸­¨ =ä¡ÇåŠszÖw¥`%Mßrr_Éñó­Ì¶«J)ùl×>¶nÛA}CŠP;v4óŸÌ¥¿¤HÿÚ±{Ï~þû£-Ä;ã°Z¬ÔÔÕ2erórgbµê»fEE%ëÿ°‘šÚZã¸ÑPOÿþI<³p))wè:v à£M[Ù½{ýú&hô¸ùÖ³™üàýºŽ P]SËÿÌ™3¥¨R%¡OfÍÌfÊä¬6—XRÂöãò6Û(¯Õvä•P%¤ø¥7¥îþ4¿Ûsî!!n! åqÜàfåqÒðö—">¯›ÍŠèjÕáóû¹r¥¯ÇGzz.—˰±¥”\»^MeåuRR’IÐ_·;âÑÔÔDYY9§AƒR±ëtôï ©JüþvGûqO\Rx#ßÖiÄ[ЬÚ¬¿à“o܈Ä<#AÏ q ŽéÛÆhU¡yiÖfåÑGšN¦ŠIôb´"h=2Ä­8³·<"U¹&Tåñ{ùoÙCפwЪ¾³ÝF£vOè ŠXâÝ1k³S‹=:Ä€©<š„EÑ) +òm¶aíœE°ªa5'æëÛ''L¢gÓCy¼']ås}Ü“n®*Ò[ø²\°r“ƒ_iþ5bŠ QDOˆ[hVå*šžß3•ÇÞA˜Šà©²Ø·3ç¨SÓ¨ q+-Êãj`”–:—]²pz€g³ý¦òC‚‚öXùÍ'Vêµ/£‹"hQb2Øñ×ÔÝÊ£I÷†"Ø(oé¥Et‡¸…¿RŸEãShŒ ²,7tåѤû¸pMðæf;%¡*‚RyÙ]2³L¹IL„¸[öÖ EU×SµÔ…ª<št­Šà»ŸYñk\BZÀ~!•ÅFFFS!n¥åzù×À0-u‰.Éóxj²?¤þ²&ú¢ª°ù yÛµFW„”?õ”ä¼ "¦îlÆdˆÈÈwÙã-/!^úh)q‡ÊÒ¹~¦Üi^/÷ö—ZXY` Á0Â-„xÛã÷¾Þ†‘Änˆ[ˆ›ññ­][yè® Ks}¤÷©wTQQ+x{›‚C¡H#²@HË‹ž’™_E|b=ˆ˜q+¶i…YB‘k<¨¥Îj‘,x0hvy4·O°¾ÄbA ©.ö”Ì)Ñcn=^âfZ•G±HÕRÙª<>‘ÀÒË>5#‰%EÐ(zçæøØÖx§O}%ÒÊ£Ix¿¤°"†A£è!nÁ1£p´òŸMå±{ [Tå"ßÎÙ'u˜ZTЫCÜŠsúÇK!Ö÷h©‹³Ã·'øÁÃ~\v3ÌZñøá»¬üû{(Šài$K¼%9ë0µ¨Â q+7•Ç_šÖ°1•G턪 ¨Q¥\ Š Q˜›Üß2µ ŸÃbYNˆÊã²¹>& 5¯—;ãÔ…•ùvöEÐ(ÌwB´+GŸb÷®\¯ª"yÀ¦NÉäk_»«ÛæÓA£0C|BUãì’gºIyܸqGŽœddêpâãâit7RZþ÷NÏ‚'s KxŠ ¼($¯E«"hfˆ»B8Êã•g§<ž8yš þ‹©ã¿ŽÅrsï Ùubß}úïw÷XCæ²÷lóuoi/U ±fä'û¤õ5àÇ„ <.ëcLª¾§ØëÖ¿OàF¡)éíþvájŽ$+Ï,\ ëÂQ%l° uicÑœö­L:DßUÌcŒú¢¹×E¶i…P¹˜ÖÕÚÏK-Ì;Ž'2¼ð˜Ÿ~ñú„¹¹ÿqÇG}«bÁ§cª:7¬+C„Eîâœ=æ-gm˜Â]øwÎ:ä-Ι28ßÕºÖ.¹yÎæ.:ÜÄ;vWk+Û5¸’ÀåêrÆñ1ÿ¿‹`^sA¾,¤\è)žõ€»8G¿–1Œy:.a*¯<îcêØÈ¥Y•*yy¿EõÁØÁ£p:âp{Ýœ¹TŠÅK^~EDnß½¿ÔŠgLE°Û0C!âÎ Zÿ¥'(>ŸMÛÙ·ÿ§ÓÁƒY<>çQìöö-WC!lEPˆ»NçÙ™èŒâ"nêö¡AKàWžîü_É,,ö~:»Ô¸™™è‰âÄùPa¶D®¡­òø%È%ÞâÙ[ºk^&ú`†8V™±ÃêP½Ï!ÔEHe­WqüEÙõ0‰þkŠ›Ò±à§IEND®B`‚rstudioapi/man/launcherConfig.Rd0000644000176200001440000000205114560722065016433 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/launcher-functions.R \name{launcherConfig} \alias{launcherConfig} \title{Define a Workbench Launcher Configuration} \usage{ launcherConfig(name, value = NULL) } \arguments{ \item{name}{The name of the launcher configuration.} \item{value}{The configuration value. Must either be an integer, float, or string.} } \description{ Define a Workbench launcher configuration, suitable for use with the \code{config} argument to \code{\link[=launcherSubmitJob]{launcherSubmitJob()}}. } \seealso{ Other job-launcher functionality: \code{\link{launcherAvailable}()}, \code{\link{launcherContainer}()}, \code{\link{launcherControlJob}()}, \code{\link{launcherGetInfo}()}, \code{\link{launcherGetJob}()}, \code{\link{launcherGetJobs}()}, \code{\link{launcherHostMount}()}, \code{\link{launcherNfsMount}()}, \code{\link{launcherPlacementConstraint}()}, \code{\link{launcherResourceLimit}()}, \code{\link{launcherSubmitJob}()}, \code{\link{launcherSubmitR}()} } \concept{job-launcher functionality} rstudioapi/man/sendToConsole.Rd0000644000176200001440000000173114200275737016267 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/stubs.R \name{sendToConsole} \alias{sendToConsole} \title{Send code to the R console} \usage{ sendToConsole(code, execute = TRUE, echo = TRUE, focus = TRUE, animate = FALSE) } \arguments{ \item{code}{The \R code to be executed, as a character vector.} \item{execute}{Boolean; should the code be executed after being submitted to the console? If \code{FALSE}, \code{code} is submitted to the console but is not executed.} \item{echo}{Boolean; echo the code in the console as it is executed?} \item{focus}{Boolean; focus the console after sending code?} \item{animate}{Boolean; should the submitted code be animated, as if someone was typing it?} } \description{ Send code to the R console, and optionally execute it. } \note{ The \code{sendToConsole} function was added in version 0.99.787 of RStudio. } \examples{ \dontrun{ rstudioapi::sendToConsole(".Platform", execute = FALSE, animate = TRUE) } } rstudioapi/man/document_range.Rd0000644000176200001440000000157014147112135016473 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/document-methods.R \name{document_range} \alias{document_range} \alias{is.document_range} \alias{as.document_range} \title{Create a Range} \usage{ document_range(start, end = NULL) is.document_range(x) as.document_range(x) } \arguments{ \item{start}{A \code{\link{document_position}} indicating the start of the range.} \item{end}{A \code{\link{document_position}} indicating the end of the range.} \item{x}{An object coercable to \code{document_range}.} } \value{ An \code{list} with class \code{document_range} and fields: \tabular{ll}{ \code{start:}\tab The start position.\cr \code{end:}\tab The end position.\cr } } \description{ A \code{document_range} is a pair of \code{\link{document_position}} objects, with each position indicating the \code{start} and \code{end} of the range, respectively. } rstudioapi/man/terminalContext.Rd0000644000176200001440000000263314147112135016662 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/terminal.R \name{terminalContext} \alias{terminalContext} \title{Retrieve Information about RStudio Terminals} \usage{ terminalContext(id) } \arguments{ \item{id}{The terminal id. The \code{id} is obtained from \code{\link{terminalList}()}, \code{\link{terminalVisible}()}, \code{\link{terminalCreate}()}, or \code{\link{terminalExecute}()}.} } \value{ A \code{list} with elements: \tabular{ll}{ \code{handle} \tab the internal handle\cr \code{caption} \tab caption\cr \code{title} \tab title set by the shell\cr \code{working_dir} \tab working directory\cr \code{shell} \tab shell type\cr \code{running} \tab is terminal process executing\cr \code{busy} \tab is terminal running a program\cr \code{exit_code} \tab process exit code or NULL\cr \code{connection} \tab websockets or rpc\cr \code{sequence} \tab creation sequence\cr \code{lines} \tab lines of text in terminal buffer\cr \code{cols} \tab columns in terminal\cr \code{rows} \tab rows in terminal\cr \code{pid} \tab process id of terminal shell\cr \code{full_screen} \tab full screen program running\cr } } \description{ Returns information about RStudio terminal instances. } \note{ The \code{terminalContext} function was added in version 1.1.350 of RStudio. } \examples{ \dontrun{ termId <- rstudioapi::terminalCreate("example", show = FALSE) View(rstudioapi::terminalContext(termId)) } } rstudioapi/man/persistent-values.Rd0000644000176200001440000000134414147112135017175 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/stubs.R \name{persistent-values} \alias{persistent-values} \alias{setPersistentValue} \alias{getPersistentValue} \title{Persistent keys and values} \usage{ setPersistentValue(name, value) getPersistentValue(name) } \arguments{ \item{name}{The key name.} \item{value}{The key value.} } \value{ The stored value as a character vector (\code{NULL} if no value of the specified name is available). } \description{ Store persistent keys and values. Storage is per-project; if there is no project currently active, then a global store is used. } \note{ The \code{setPersistentValue} and \code{getPersistentValue} functions were added in version 1.1.57 of RStudio. } rstudioapi/man/isAvailable.Rd0000644000176200001440000000161414703770710015723 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/code.R \name{isAvailable} \alias{isAvailable} \alias{verifyAvailable} \title{Check if RStudio is running} \usage{ isAvailable(version_needed = NULL, child_ok = FALSE) verifyAvailable(version_needed = NULL) } \arguments{ \item{version_needed}{An optional version specification. If supplied, ensures that RStudio is at least that version.} \item{child_ok}{Boolean; check if the current R process is a child process of the main RStudio session? This can be useful for e.g. RStudio Jobs, where you'd like to communicate back with the main R session from a child process through \code{rstudioapi}.} } \value{ \code{isAvailable} a boolean; \code{verifyAvailable} an error message if RStudio is not running } \description{ Check if RStudio is running. } \examples{ rstudioapi::isAvailable() \dontrun{rstudioapi::verifyAvailable()} } rstudioapi/man/executeCommand.Rd0000644000176200001440000000230314502355417016444 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/commands.R \name{executeCommand} \alias{executeCommand} \title{Execute Command} \usage{ executeCommand(commandId, quiet = FALSE) } \arguments{ \item{commandId}{The ID of the command to execute.} \item{quiet}{Whether to show an error if the command does not exist.} } \description{ Executes an arbitrary RStudio command. } \details{ Most menu commands and many buttons in RStudio can be invoked from the API using this method. The \code{quiet} command governs the behavior of the function when the command does not exist. By default, an error is shown if you attempt to invoke a non-existent command. You should set this to \code{TRUE} when invoking a command that may not be available if you don't want your users to see an error. The command is run asynchronously, so no status is returned. See the \href{https://docs.posit.co/ide/server-pro/reference/rstudio_ide_commands.html}{RStudio Server Professional Administration Guide} for a list of supported command IDs. } \note{ The \code{executeCommand} function was introduced in RStudio 1.2.1261. } \seealso{ \code{\link{registerCommandCallback}} to be notified of command executions. } rstudioapi/man/terminalClear.Rd0000644000176200001440000000126614147112135016265 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/terminal.R \name{terminalClear} \alias{terminalClear} \title{Clear Terminal Buffer} \usage{ terminalClear(id) } \arguments{ \item{id}{The terminal id. The \code{id} is obtained from \code{\link{terminalList}()}, \code{\link{terminalVisible}()}, \code{\link{terminalCreate}()}, or \code{\link{terminalExecute}()}.} } \description{ Clears the buffer for specified terminal. } \note{ The \code{terminalClear} function was added in version 1.1.350 of RStudio. } \examples{ \dontrun{ termId <- rstudioapi::terminalCreate() rstudioapi::terminalSend(termId, 'ls -l\n') Sys.sleep(3) rstudioapi::terminalClear(termId) } } rstudioapi/man/getThemes.Rd0000644000176200001440000000051714147112135015426 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/themes.R \name{getThemes} \alias{getThemes} \title{Get Theme List} \usage{ getThemes() } \description{ Retrieves a list of the names of all the editor themes installed for RStudio. } \note{ The \code{getThemes} function was introduced in RStudio 1.2.879. } rstudioapi/man/launcherGetJob.Rd0000644000176200001440000000153414277745603016415 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/launcher-functions.R \name{launcherGetJob} \alias{launcherGetJob} \title{Retrieve Workbench Job Information} \usage{ launcherGetJob(jobId) } \arguments{ \item{jobId}{The id of a Workbench job.} } \description{ Retrieve information on a Workbench job with id \code{jobId}. } \seealso{ Other job-launcher functionality: \code{\link{launcherAvailable}()}, \code{\link{launcherConfig}()}, \code{\link{launcherContainer}()}, \code{\link{launcherControlJob}()}, \code{\link{launcherGetInfo}()}, \code{\link{launcherGetJobs}()}, \code{\link{launcherHostMount}()}, \code{\link{launcherNfsMount}()}, \code{\link{launcherPlacementConstraint}()}, \code{\link{launcherResourceLimit}()}, \code{\link{launcherSubmitJob}()}, \code{\link{launcherSubmitR}()} } \concept{job-launcher functionality} rstudioapi/man/filesPaneNavigate.Rd0000644000176200001440000000064414147112135017067 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/files-pane.R \name{filesPaneNavigate} \alias{filesPaneNavigate} \title{Navigate to a Directory in the Files Pane} \usage{ filesPaneNavigate(path) } \arguments{ \item{path}{The filesystem path to be shown.} } \description{ Navigate to a directory in the Files pane. The contents of that directory will be listed and shown in the Files pane. } rstudioapi/man/previewSql.Rd0000644000176200001440000000124014147112135015634 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/preview.R \name{previewSql} \alias{previewSql} \title{Preview SQL statement} \usage{ previewSql(conn, statement, ...) } \arguments{ \item{conn}{The 'DBI' connection to be used to execute this statement.} \item{statement}{The SQL statement to execute. Either a path to a file containing a SQL statement or the SQL statement itself.} \item{...}{Additional arguments to be used in \code{dbGetQuery()}.} } \description{ Makes use of 'DBI' and \code{dbGetQuery()} to preview a SQL statement for a given 'DBI' connection. } \note{ The \code{previewSql} function was introduced in RStudio 1.2.600 } rstudioapi/man/projects.Rd0000644000176200001440000000220414147112135015325 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/stubs.R \name{projects} \alias{projects} \alias{openProject} \alias{initializeProject} \title{Open a project in RStudio} \usage{ openProject(path = NULL, newSession = FALSE) initializeProject(path = getwd()) } \arguments{ \item{path}{Either the path to an existing \code{.Rproj} file, or a path to a directory in which a new project should be initialized and opened.} \item{newSession}{Boolean; should the project be opened in a new session, or should the current RStudio session switch to that project? Note that \code{TRUE} values are only supported with RStudio Desktop and RStudio Server Pro.} } \description{ Initialize and open RStudio projects. } \details{ Calling \code{openProject()} without arguments effectively re-opens the currently open project in RStudio. When switching projects, users will be prompted to save any unsaved files; alternatively, you can explicitly save any open documents using \code{\link[=documentSaveAll]{documentSaveAll()}}. } \note{ The \code{openProject} and \code{initializeProject} functions were added in version 1.1.287 of RStudio. } rstudioapi/man/jobRemove.Rd0000644000176200001440000000114114561520755015436 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/jobs.R \name{jobRemove} \alias{jobRemove} \title{Remove a Background Job} \usage{ jobRemove(job) } \arguments{ \item{job}{The ID of the job to remove.} } \description{ Remove a background job from RStudio's Background Jobs pane. } \seealso{ Other jobs: \code{\link{jobAdd}()}, \code{\link{jobAddOutput}()}, \code{\link{jobAddProgress}()}, \code{\link{jobGetState}()}, \code{\link{jobList}()}, \code{\link{jobRunScript}()}, \code{\link{jobSetProgress}()}, \code{\link{jobSetState}()}, \code{\link{jobSetStatus}()} } \concept{jobs} rstudioapi/man/terminalCreate.Rd0000644000176200001440000000251114147112135016434 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/terminal.R \name{terminalCreate} \alias{terminalCreate} \title{Create a Terminal} \usage{ terminalCreate(caption = NULL, show = TRUE, shellType = NULL) } \arguments{ \item{caption}{The desired terminal caption. When \code{NULL} or blank, the terminal caption will be chosen by the system.} \item{show}{If \code{FALSE}, terminal won't be brought to front.} \item{shellType}{Shell type for the terminal: NULL or "default" to use the shell selected in Global Options. For Microsoft Windows, alternatives are "win-cmd" for 64-bit Command Prompt, "win-ps" for 64-bit PowerShell, "win-git-bash" for Git Bash, or "win-wsl-bash" for Bash on Windows Subsystem for Linux. On Linux, Mac, and RStudio Server "custom" will use the custom terminal defined in Global Options. If the requested shell type is not available, the default shell will be used, instead.} } \value{ The terminal identifier as a character vector (\code{NULL} if unable to create the terminal or the given terminal caption is already in use). } \description{ Create a new Terminal. } \note{ The \code{terminalCreate} function was added in version 1.1.350 of RStudio and the ability to specify shellType was added in version 1.2.696. } \examples{ \dontrun{ termId <- rstudioapi::terminalCreate('My Terminal') } } rstudioapi/man/jobSetState.Rd0000644000176200001440000000177114561520755015746 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/jobs.R \name{jobSetState} \alias{jobSetState} \title{Set Background Job State} \usage{ jobSetState( job, state = c("idle", "running", "succeeded", "cancelled", "failed") ) } \arguments{ \item{job}{The ID of the job on which to change state.} \item{state}{The new job state.} } \description{ Changes the state of a background job. } \section{States}{ The following states are supported: \describe{ \item{idle}{The job is waiting to run.} \item{running}{The job is actively running.} \item{succeeded}{The job has finished successfully.} \item{cancelled}{The job was cancelled.} \item{failed}{The job finished but did not succeed.} } } \seealso{ Other jobs: \code{\link{jobAdd}()}, \code{\link{jobAddOutput}()}, \code{\link{jobAddProgress}()}, \code{\link{jobGetState}()}, \code{\link{jobList}()}, \code{\link{jobRemove}()}, \code{\link{jobRunScript}()}, \code{\link{jobSetProgress}()}, \code{\link{jobSetStatus}()} } \concept{jobs} rstudioapi/man/primary_selection.Rd0000644000176200001440000000120314147112135017222 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/document-methods.R \name{primary_selection} \alias{primary_selection} \title{Extract the Primary Selection} \usage{ primary_selection(x, ...) } \arguments{ \item{x}{A document context, or a selection.} \item{...}{Optional arguments (currently ignored).} } \description{ By default, functions returning a document context will return a list of selections, including both the 'primary' selection and also 'other' selections (e.g. to handle the case where a user might have multiple cursors active). Use \code{primary_selection()} to extract the primary selection. } rstudioapi/man/rstudio-editors.Rd0000644000176200001440000000243214276505471016653 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/document-api.R \name{rstudio-editors} \alias{rstudio-editors} \alias{getActiveDocumentContext} \alias{getSourceEditorContext} \alias{getConsoleEditorContext} \title{Retrieve Information about an RStudio Editor} \usage{ getActiveDocumentContext() getSourceEditorContext(id = NULL) getConsoleEditorContext() } \arguments{ \item{id}{The ID of a particular document, as retrieved by \code{documentId()} or similar. Supported in RStudio 2022.06.0 or newer.} } \value{ A \code{list} with elements: \tabular{ll}{ \code{id} \tab The document ID.\cr \code{path} \tab The path to the document on disk.\cr \code{contents} \tab The contents of the document.\cr \code{selection} \tab A \code{list} of selections. See \bold{Details} for more information.\cr } } \description{ Returns information about an RStudio editor. } \details{ The \code{selection} field returned is a list of document selection objects. A document selection is just a pairing of a document \code{range}, and the \code{text} within that range. } \note{ The \code{getActiveDocumentContext} function was added with version 0.99.796 of RStudio, while the \code{getSourceEditorContext} and the \code{getConsoleEditorContext} functions were added with version 0.99.1111. } rstudioapi/man/dictionaries.Rd0000644000176200001440000000137414502355251016163 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/dictionaries.R \name{dictionaries} \alias{dictionaries} \alias{dictionariesPath} \alias{userDictionariesPath} \title{Interact with RStudio's Dictionaries} \usage{ dictionariesPath() userDictionariesPath() } \description{ Interact with the \href{https://hunspell.github.io/}{hunspell} dictionaries used by RStudio for spell checking. } \details{ \code{dictionariesPath()} gives a path to the dictionaries installed and distributed with RStudio. \code{userDictionariesPath()} gives the path where users can provide their own custom \code{hunspell} dictionaries. } \note{ The \code{dictionariesPath()} and \code{userDictionariesPath()} functions were introduced with RStudio 1.2.1202. } rstudioapi/man/askForPassword.Rd0000644000176200001440000000131114147112135016442 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/stubs.R \name{askForPassword} \alias{askForPassword} \title{Ask the user for a password interactively} \usage{ askForPassword(prompt = "Please enter your password") } \arguments{ \item{prompt}{The prompt to be shown to the user.} } \description{ Ask the user for a password interactively. } \details{ RStudio also sets the global \code{askpass} option to the \code{rstudioapi::askForPassword} function so that it can be invoked in a front-end independent manner. } \note{ The \code{askForPassword} function was added in version 0.99.853 of RStudio. } \examples{ \dontrun{ rstudioapi::askForPassword("Please enter your password") } } rstudioapi/man/addTheme.Rd0000644000176200001440000000212414147112135015210 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/themes.R \name{addTheme} \alias{addTheme} \title{Add a Custom Editor Theme} \usage{ addTheme(themePath, apply = FALSE, force = FALSE, globally = FALSE) } \arguments{ \item{themePath}{A full or relative path or URL to an \code{rstheme} or \code{tmtheme} to be added.} \item{apply}{Whether to immediately apply the newly added theme. Setting this to \code{TRUE} has the same impact as running \code{{ rstudioapi::addTheme(); rstudioapi::applyTheme() }}.\cr Default: \code{FALSE}.} \item{force}{Whether to force the operation and overwrite an existing file with the same name.\cr Default: \code{FALSE}.} \item{globally}{Whether to install this theme for the current user or all users. If set to \code{TRUE} this will attempt to install the theme for all users, which may require administrator privileges.\cr Default: \code{FALSE}.} } \description{ Adds a custom editor theme to RStudio and returns the name of the newly added theme. } \note{ The \code{addTheme} function was introduced in RStudio 1.2.879. } rstudioapi/man/readPreference.Rd0000644000176200001440000000146414147112135016415 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/prefs.R \name{readPreference} \alias{readPreference} \title{Read Preference} \usage{ readPreference(name, default) } \arguments{ \item{name}{The name of the preference.} \item{default}{The default value to use when the preference is not available.} } \description{ Reads a user preference, useful to remember preferences across different R sessions for the same user. } \details{ User preferences can have arbitrary names and values. You must write the preference with \code{\link{writePreference}} before it can be read (otherwise its default value will be returned). } \note{ The \code{readPreference} function was added in version 1.1.67 of RStudio. } \seealso{ \code{\link{readRStudioPreference}}, which reads RStudio IDE preferences. } rstudioapi/man/hasFun.Rd0000644000176200001440000000152614147112135014726 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/code.R \name{hasFun} \alias{hasFun} \alias{findFun} \title{Exists/get for RStudio functions} \usage{ hasFun(name, version_needed = NULL, ...) findFun(name, version_needed = NULL, ...) } \arguments{ \item{name}{name of object to look for} \item{version_needed}{An optional version specification. If supplied, ensures that RStudio is at least that version. This is useful if function behavior has changed over time.} \item{...}{other arguments passed on to \code{\link[base]{exists}} and \code{\link[base]{get}}} } \description{ These are specialized versions of \code{\link[base]{get}} and \code{\link[base]{exists}} that look in the rstudio package namespace. If RStudio is not running, \code{hasFun} will return \code{FALSE}. } \examples{ rstudioapi::hasFun("viewer") } rstudioapi/man/terminalBuffer.Rd0000644000176200001440000000130114147112135016436 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/terminal.R \name{terminalBuffer} \alias{terminalBuffer} \title{Get Terminal Buffer} \usage{ terminalBuffer(id, stripAnsi = TRUE) } \arguments{ \item{id}{The terminal id. The \code{id} is obtained from \code{\link{terminalList}()}, \code{\link{terminalVisible}()}, \code{\link{terminalCreate}()}, or \code{\link{terminalExecute}()}.} \item{stripAnsi}{If FALSE, don't strip out Ansi escape sequences before returning terminal buffer.} } \value{ The terminal contents, one line per row. } \description{ Returns contents of a terminal buffer. } \note{ The \code{terminalBuffer} function was added in version 1.1.350 of RStudio. } rstudioapi/man/writePreference.Rd0000644000176200001440000000111614147112135016626 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/prefs.R \name{writePreference} \alias{writePreference} \title{Write Preference} \usage{ writePreference(name, value) } \arguments{ \item{name}{The name of the preference.} \item{value}{The value of the preference.} } \description{ Writes a user preference, useful to remember preferences across different R sessions for the same user. } \note{ The \code{writePreference} function was added in version 1.1.67 of RStudio. } \seealso{ \code{\link{writeRStudioPreference}}, which changes RStudio IDE preferences. } rstudioapi/man/translateLocalUrl.Rd0000644000176200001440000000176014147112135017135 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/urls.R \name{translateLocalUrl} \alias{translateLocalUrl} \title{Translate Local URL} \usage{ translateLocalUrl(url, absolute = FALSE) } \arguments{ \item{url}{The fully qualified URL to translate; for example, \code{http://localhost:1234/service/page.html}.} \item{absolute}{Whether to return a relative path URL (the default) or an absolute URL.} } \value{ The translated URL. } \description{ Translates a local URL into an externally accessible URL on RStudio Server. } \details{ On RStudio Server, URLs which refer to the local host network address (such as \code{http://localhost:1234/} and \code{http://127.0.0.1:5678/}) must be translated in order to be externally accessible from a browser. This method performs the required translation, and returns the translated URL, which RStudio Server uses to proxy HTTP requests. Returns an unmodified URL on RStudio Desktop, and when the URL does not refer to a local address. } rstudioapi/man/userIdentity.Rd0000644000176200001440000000037414147112135016172 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/user.R \name{userIdentity} \alias{userIdentity} \title{Get User Identity} \usage{ userIdentity() } \description{ Returns the identity (displayed name) of the current user. } rstudioapi/man/highlightUi.Rd0000644000176200001440000000435014147112135015745 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/highlight-ui.R \name{highlightUi} \alias{highlightUi} \title{Highlight UI Elements within the RStudio IDE} \usage{ highlightUi(queries) } \arguments{ \item{queries}{A list of "query" objects. Each query should be a list with entries \code{"query"} and \code{"parent"}. See \strong{Queries} for more details.} } \description{ This function can be used to highlight UI elements within the RStudio IDE. UI elements can be selected using query selectors; most commonly, one should choose to highlight elements based on their IDs when available. } \details{ The tool at:\preformatted{Help -> Diagnostics -> Show DOM Elements } can be useful for identifying the classes and IDs assigned to the different elements within RStudio. } \note{ The \code{highlightUi} function was introduced in RStudio 1.3.658. } \section{Queries}{ Elements are selected using the same queries as through the web \code{querySelectorAll()} API. See \url{https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll} for more details. For example, to highlight the Save icon within the Source pane, one might use:\preformatted{rstudioapi::highlightUi("#rstudio_tb_savesourcedoc") } In some cases, multiple UI elements need to be highlighted -- e.g. if you want to highlight both a menu button, and a menu item within the menu displayed after the button is pressed. We'll use the Environment Pane's Import Dataset button as an example. To highlight the \verb{From Text (readr)} command, you might use:\preformatted{rstudioapi::highlightUi( list( list(query = "#rstudio_mb_import_dataset", parent = 0L), list(query = "#rstudio_label_from_text_readr_command", parent = 1L) ) ) } } \examples{ \dontrun{rstudioapi::highlightUi("#rstudio_workbench_panel_git")} # clear current highlights \dontrun{rstudioapi::highlightUi("")} # highlight within an RMD \dontrun{rstudioapi::highlightUi(".rstudio_chunk_setup .rstudio_run_chunk")} # Optionally provide a callback adjacent to # the queries that will be executed when the # highlighted element is clicked on. \dontrun{rstudioapi::highlightUi( list( list( query="#rstudio_workbench_panel_git", callback="rstudioapi::highlightUi('')" ) ) )} } rstudioapi/man/jobGetState.Rd0000644000176200001440000000107014561520755015722 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/jobs.R \name{jobGetState} \alias{jobGetState} \title{Get Background Job State} \usage{ jobGetState(job) } \arguments{ \item{job}{The ID of the job.} } \description{ Get Background Job State } \seealso{ Other jobs: \code{\link{jobAdd}()}, \code{\link{jobAddOutput}()}, \code{\link{jobAddProgress}()}, \code{\link{jobList}()}, \code{\link{jobRemove}()}, \code{\link{jobRunScript}()}, \code{\link{jobSetProgress}()}, \code{\link{jobSetState}()}, \code{\link{jobSetStatus}()} } \concept{jobs} rstudioapi/man/selections.Rd0000644000176200001440000000117614147112135015653 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/selections.R \name{selections} \alias{selections} \alias{selectionGet} \alias{selectionSet} \title{Manipulate User Selections in the RStudio IDE} \usage{ selectionGet(id = NULL) selectionSet(value = NULL, id = NULL) } \arguments{ \item{id}{The document ID. When \code{NULL} (the default), the active, or most-recently edited, document will be used.} \item{value}{The text contents to set for the selection.} } \description{ These functions allow users of the \code{rstudioapi} package to read and write the user's current selection within the RStudio IDE. } rstudioapi/man/createProjectTemplate.Rd0000644000176200001440000000316614147112135017772 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/templates.R \name{createProjectTemplate} \alias{createProjectTemplate} \title{Create a Project Template} \usage{ createProjectTemplate( package = ".", binding, title, subtitle = paste("Create a new", title), caption = paste("Create", title), icon = NULL, open_files = NULL, overwrite = FALSE, edit = TRUE ) } \arguments{ \item{package}{The path to an package sources.} \item{binding}{The skeleton function to associate with this project template. This is the name of the function that will be used to initialize the project.} \item{title}{The title to be shown within the \strong{New Project...} wizard.} \item{subtitle}{(optional) The subtitle to be shown within the \strong{New Project...} wizard.} \item{caption}{(optional) The caption to be shown on the landing page for this template.} \item{icon}{(optional) The path to an icon, on disk, to be used in the dialog. Must be an \code{.png} of size less than 64KB.} \item{open_files}{(optional) Files that should be opened by RStudio when the project is generated. Shell-style globs can be used to indicate when multiple files matching some pattern should be opened -- for example, OpenFiles: R/*.R would indicate that RStudio should open all .R files within the R folder of the generated project.} \item{overwrite}{Boolean; overwrite a pre-existing template file if one exists?} \item{edit}{Boolean; open the file for editting after creation?} } \description{ Create a project template. See \url{https://rstudio.github.io/rstudio-extensions/rstudio_project_templates.html} for more information. } rstudioapi/man/getThemeInfo.Rd0000644000176200001440000000166614147112135016065 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/themes.R \name{getThemeInfo} \alias{getThemeInfo} \title{Retrieve Themes} \usage{ getThemeInfo() } \description{ Retrieves a list with information about the current color theme used by RStudio. } \details{ A list is returned with the following elements: \describe{ \item{editor}{The name of the current editor theme, such as \code{Textmate}.} \item{global}{The name of the current global theme. One of \code{Modern}, \code{Classic}, or \code{Sky}.} \item{dark}{\code{TRUE} if the editor theme is dark, \code{FALSE} otherwise.} \item{foreground}{The current editor theme's default text foreground color, formatted as a CSS-compatible color string, such as \code{rgb(1, 22, 39)}. Supported since RStudio 1.2.1214.} \item{background}{The current editor theme's default text background color, formatted as a CSS-compatible color string. Supported since RStudio 1.2.1214.} } } rstudioapi/man/launcherContainer.Rd0000644000176200001440000000226514560722065017157 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/launcher-functions.R \name{launcherContainer} \alias{launcherContainer} \title{Define a Workbench Launcher Container} \usage{ launcherContainer(image, runAsUserId = NULL, runAsGroupId = NULL) } \arguments{ \item{image}{The container image to use.} \item{runAsUserId}{The user id to run as within the container. Defaults to the container-specified user.} \item{runAsGroupId}{The group id to run as within the container. Defaults to the container-specified group.} } \description{ Define a launcher container, suitable for use with the \code{container} argument to \code{\link[=launcherSubmitJob]{launcherSubmitJob()}}. } \seealso{ Other job-launcher functionality: \code{\link{launcherAvailable}()}, \code{\link{launcherConfig}()}, \code{\link{launcherControlJob}()}, \code{\link{launcherGetInfo}()}, \code{\link{launcherGetJob}()}, \code{\link{launcherGetJobs}()}, \code{\link{launcherHostMount}()}, \code{\link{launcherNfsMount}()}, \code{\link{launcherPlacementConstraint}()}, \code{\link{launcherResourceLimit}()}, \code{\link{launcherSubmitJob}()}, \code{\link{launcherSubmitR}()} } \concept{job-launcher functionality} rstudioapi/man/chunk-callbacks.Rd0000644000176200001440000000205414147112135016524 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/chunk.R \name{chunk-callbacks} \alias{chunk-callbacks} \alias{registerChunkCallback} \alias{unregisterChunkCallback} \title{Register and Unregister a Chunk Callback} \usage{ registerChunkCallback(callback) unregisterChunkCallback(id = NULL) } \arguments{ \item{callback}{A callback function. See \strong{Chunk Callbacks} for more details.} \item{id}{A unique identifier.} } \value{ For \code{registerChunkCallback()}, a unique identifier. That identifier can be passed to \code{unreigsterChunkCallback()} to de-register a previously-registered callback. } \description{ Register a callback function to be executed after a chunk within an R Markdown document is run. } \section{Chunk Callbacks}{ The \code{callback} argument should be a function accepting two parameters: \itemize{ \item \code{chunkName}: The chunk label, \item \code{chunkCode}: The code within the chunk. } The function should return an \R list of HTML outputs, to be displayed after that chunk has been executed. } rstudioapi/man/launcherSubmitJob.Rd0000644000176200001440000000676214560722065017141 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/launcher-functions.R \name{launcherSubmitJob} \alias{launcherSubmitJob} \title{Submit a Workbench Job} \usage{ launcherSubmitJob( name, cluster = "Local", tags = NULL, command = NULL, exe = NULL, args = NULL, environment = NULL, stdin = NULL, stdoutFile = NULL, stderrFile = NULL, workingDirectory = NULL, host = NULL, container = NULL, exposedPorts = NULL, mounts = NULL, placementConstraints = NULL, resourceLimits = NULL, queues = NULL, config = NULL, user = Sys.getenv("USER"), applyConfigSettings = TRUE ) } \arguments{ \item{name}{A descriptive name to assign to the job.} \item{cluster}{The name of the cluster this job should be submitted to.} \item{tags}{A set of user-defined tags, used for searching and querying jobs.} \item{command}{The command to run within the job. This is executed via the system shell. Only one of command or exe should be specified.} \item{exe}{The (fully pathed) executable to run within the job. Only one of \code{command} or \code{exe} should be specified.} \item{args}{An array of arguments to pass to the command / executable.} \item{environment}{A list of environment variables to be set for processes launched with this job.} \item{stdin}{Data to be written to stdin when the job process is launched.} \item{stdoutFile}{The file used for the job's generated standard output. Not all launcher plugins support this parameter.} \item{stderrFile}{The file used for the job's generated standard error. Not all launcher plugins support this parameter.} \item{workingDirectory}{The working directory to be used by the command / executable associated with this job.} \item{host}{The host that the job is running on, or the desired host during job submission.} \item{container}{The container to be used for launched jobs.} \item{exposedPorts}{The ports that are exposed by services running on a container. Only applicable to systems that support containers.} \item{mounts}{A list of mount points. See \code{\link[=launcherHostMount]{launcherHostMount()}} and \code{\link[=launcherNfsMount]{launcherNfsMount()}} for more information.} \item{placementConstraints}{A list of placement constraints. See \code{\link[=launcherPlacementConstraint]{launcherPlacementConstraint()}} for more information.} \item{resourceLimits}{A list of resource limits. See \code{\link[=launcherResourceLimit]{launcherResourceLimit()}} for more information.} \item{queues}{A list of available submission queues for the cluster. Only applicable to batch systems like LSF.} \item{config}{A list of cluster-specific configuration options. See \code{\link[=launcherConfig]{launcherConfig()}} for more information.} \item{user}{The user-name of the job owner.} \item{applyConfigSettings}{Apply server-configured mounts, exposedPorts, and environment, in addition to any specified in this call.} } \description{ Submit a Workbench job. See \url{https://docs.posit.co/job-launcher/latest/index.html} for more information. } \seealso{ Other job-launcher functionality: \code{\link{launcherAvailable}()}, \code{\link{launcherConfig}()}, \code{\link{launcherContainer}()}, \code{\link{launcherControlJob}()}, \code{\link{launcherGetInfo}()}, \code{\link{launcherGetJob}()}, \code{\link{launcherGetJobs}()}, \code{\link{launcherHostMount}()}, \code{\link{launcherNfsMount}()}, \code{\link{launcherPlacementConstraint}()}, \code{\link{launcherResourceLimit}()}, \code{\link{launcherSubmitR}()} } \concept{job-launcher functionality} rstudioapi/man/launcherSubmitR.Rd0000644000176200001440000000254614560722065016624 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/launcher-functions.R \name{launcherSubmitR} \alias{launcherSubmitR} \title{Execute an R Script as a Workbench Job} \usage{ launcherSubmitR(script, cluster = "Local", container = NULL) } \arguments{ \item{script}{Fully qualified path of R script. Must be a path that is available in the job container (if using containerized job cluster such as Kubernetes).} \item{cluster}{The name of the cluster this job should be submitted to.} \item{container}{The container to be used for launched jobs.} } \description{ Convenience function for running an R script as a Workbench job using whichever R is found on the path in the Workbench launcher cluster. } \details{ See \code{\link[=launcherSubmitJob]{launcherSubmitJob()}} for running jobs with full control over command, environment, and so forth. } \seealso{ Other job-launcher functionality: \code{\link{launcherAvailable}()}, \code{\link{launcherConfig}()}, \code{\link{launcherContainer}()}, \code{\link{launcherControlJob}()}, \code{\link{launcherGetInfo}()}, \code{\link{launcherGetJob}()}, \code{\link{launcherGetJobs}()}, \code{\link{launcherHostMount}()}, \code{\link{launcherNfsMount}()}, \code{\link{launcherPlacementConstraint}()}, \code{\link{launcherResourceLimit}()}, \code{\link{launcherSubmitJob}()} } \concept{job-launcher functionality} rstudioapi/man/jobList.Rd0000644000176200001440000000101014561520771015105 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/jobs.R \name{jobList} \alias{jobList} \title{List Background Jobs} \usage{ jobList() } \description{ List any registered background jobs. } \seealso{ Other jobs: \code{\link{jobAdd}()}, \code{\link{jobAddOutput}()}, \code{\link{jobAddProgress}()}, \code{\link{jobGetState}()}, \code{\link{jobRemove}()}, \code{\link{jobRunScript}()}, \code{\link{jobSetProgress}()}, \code{\link{jobSetState}()}, \code{\link{jobSetStatus}()} } \concept{jobs} rstudioapi/man/document_position.Rd0000644000176200001440000000120714147112135017240 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/document-methods.R \name{document_position} \alias{document_position} \alias{is.document_position} \alias{as.document_position} \title{Create a Document Position} \usage{ document_position(row, column) is.document_position(x) as.document_position(x) } \arguments{ \item{row}{The row (using 1-based indexing).} \item{column}{The column (using 1-based indexing).} \item{x}{An object coercable to \code{document_position}.} } \description{ Creates a \code{document_position}, which can be used to indicate e.g. the row + column location of the cursor in a document. } rstudioapi/man/showPrompt.Rd0000644000176200001440000000136714703770712015700 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/dialogs.R \name{showPrompt} \alias{showPrompt} \title{Show Prompt Dialog Box} \usage{ showPrompt(title, message, default = NULL, timeout = 60) } \arguments{ \item{title}{The title to display in the dialog box.} \item{message}{A character vector with the contents to display in the main dialog area.} \item{default}{An optional character vector that fills the prompt field with a default value.} \item{timeout}{A timeout (in seconds). When set, if the user takes longer than this timeout to provide a response, the request will be aborted.} } \description{ Shows a dialog box with a prompt field. } \note{ The \code{showPrompt} function was added in version 1.1.67 of RStudio. } rstudioapi/DESCRIPTION0000644000176200001440000000212714706024702014147 0ustar liggesusersPackage: rstudioapi Title: Safely Access the RStudio API Description: Access the RStudio API (if available) and provide informative error messages when it's not. Version: 0.17.1 Authors@R: c( person("Kevin", "Ushey", role = c("aut", "cre"), email = "kevin@rstudio.com"), person("JJ", "Allaire", role = c("aut"), email = "jj@posit.co"), person("Hadley", "Wickham", role = c("aut"), email = "hadley@posit.co"), person("Gary", "Ritchie", role = c("aut"), email = "gary@posit.co"), person(family = "RStudio", role = "cph") ) Maintainer: Kevin Ushey License: MIT + file LICENSE URL: https://rstudio.github.io/rstudioapi/, https://github.com/rstudio/rstudioapi BugReports: https://github.com/rstudio/rstudioapi/issues RoxygenNote: 7.3.2 Suggests: testthat, knitr, rmarkdown, clipr, covr VignetteBuilder: knitr Encoding: UTF-8 NeedsCompilation: no Packaged: 2024-10-22 20:55:52 UTC; kevin Author: Kevin Ushey [aut, cre], JJ Allaire [aut], Hadley Wickham [aut], Gary Ritchie [aut], RStudio [cph] Repository: CRAN Date/Publication: 2024-10-22 22:40:02 UTC