Helper functions for styling via RStudio Addins.

Addins

Auto-Save Option

By default, both of the RStudio Addins will apply styling to the (selected) file contents without saving changes. Automatic saving can be enabled by setting the environment variable save_after_styling to TRUE. Consider setting this in your .Rprofile file if you want to persist this setting across multiple sessions. Untitled files will always need to be saved manually after styling.

Life cycle

The way of specifying the style in the Addin as well as the auto-save option (see below) are experimental. We are currently considering letting the user specify the defaults for other style APIs like styler::style_text(), either via R options, config files or other ways as well. See r-lib/styler#319 for the current status of this.

See also

Other stylers: style_dir(), style_file(), style_pkg(), style_text()

Examples

if (FALSE) { # save after styling when using the Addin Sys.setenv(save_after_styling = TRUE) # only style with scope = "spaces" when using the Addin options( styler.addins_style_transformer = "styler::tidyverse_style(scope = 'spaces')" ) }