R/to_upper_addin.R

Defines functions to_upper_addin

Documented in to_upper_addin

#' Transform selected text to uppercase
#'
#' \code{to_upper_addin} uses the rstudioapi to get the selected text
#' then replace it with the uppercase version
#'
#' @importFrom rstudioapi getActiveDocumentContext insertText
#' @export
to_upper_addin <- function() {
  ctx <- rstudioapi::getActiveDocumentContext()
  STR <- toupper(ctx$selection[[1]]$text)
  # ctx$contents
  rstudioapi::insertText(location = ctx$selection[[1]]$range,
                         text = STR)
}
hdrab127/vscodeaddins documentation built on Nov. 4, 2019, 1:30 p.m.