Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow selecting the style used by RStudio addins. #463

Merged
merged 11 commits into from Feb 16, 2019

roxygen doc

  • Loading branch information...
lorenzwalthert committed Feb 5, 2019
commit 3dc9f01e93cc4f801792ef552bcd46294d12900f
@@ -97,9 +97,11 @@ get_rstudio_context <- function() {
rstudioapi::getActiveDocumentContext()
}

# Binding for style-setting addin.
#' Ask the user to supply a style
#'
#' @keywords internal
prompt_style <- function() {
current_style <- get_addins_style()
current_style <- get_addins_style_name()
new_style <-
rstudioapi::showPrompt(
"Select a style",
@@ -112,19 +114,23 @@ prompt_style <- function() {
invisible(current_style)
}

get_addins_style <- function() {
#' Return the style function or name
#'
#' @keywords internal
get_addins_style_name <- function() {
getOption(
"styler.addins.style",
default = "styler::tidyverse_style"
)
}

#' @rdname get_addins_style_name
#' @keywords internal
get_addins_style_fun <- function() {
eval(parse(text = get_addins_style()))
eval(parse(text = get_addins_style_name()))
}

# How the addins communicate the style being used.
communicate_addins_style <- function() {
style_name <- get_addins_style()
style_name <- get_addins_style_name()
cat("Using style `", style_name, "`\n", sep = "")
}

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.