data-raw/_DEBUGGING_get_active_context.R

getActiveDocumentContext <- function ()
{
    "ąąžž"
    context <- callFun("getActiveDocumentContext")
    context$selection <- as.document_selection(context$selection)
    structure(context, class = "document_context")
}

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fname <- "getActiveDocumentContext"


callFun <- function (fname, ...)
{
    verifyAvailable()
    if (usingTools())
        found <- exists(rstudioapi:::toolsName(fname), envir = rstudioapi:::toolsEnv(),
                        mode = "function")
    else found <- exists(fname, envir = asNamespace("rstudio"),
                         mode = "function")
    if (!found)
        stop("Function ", fname, " not found in RStudio", call. = FALSE)
    f <- findFun(fname, mode = "function")
    f(...)
}
GegznaV/spAddins documentation built on Nov. 20, 2020, 10:42 p.m.