R/rstudio.R

Defines functions RStudioContext RStudioThemeInfo RStudioTabSize

#' @importFrom rstudioapi hasFun readRStudioPreference
#' @noRd
RStudioTabSize <- function(){
  if(hasFun("readRStudioPreference")){
    readRStudioPreference("num_spaces_for_tab", 2)
  }else{
    2
  }
}

#' @importFrom rstudioapi hasFun getThemeInfo
#' @noRd
RStudioThemeInfo <- function(){
  if(hasFun("getThemeInfo")){
    getThemeInfo()
  }else{
    list(editor = "cobalt", dark = TRUE)
  }
}

#' @importFrom rstudioapi hasFun getSourceEditorContext
#' @noRd
RStudioContext <- function(){
  if(hasFun("getSourceEditorContext")){
    getSourceEditorContext()
  }else{
    stop("This version of RStudio is too old!")
  }
}

Try the prettifyAddins package in your browser

Any scripts or data that you put into this service are public.

prettifyAddins documentation built on Sept. 14, 2023, 5:06 p.m.