From cd18c39b610f4457eeb1be6e2a3bf15f6c5ccaeb Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Mon, 1 Feb 2021 00:19:29 +0100 Subject: [PATCH 1/2] don't check option as most likely unset Once env var is removed, we can set it in .onLoad --- R/addins.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/addins.R b/R/addins.R index aa99c112e..85ac7354e 100644 --- a/R/addins.R +++ b/R/addins.R @@ -133,7 +133,7 @@ style_selection <- function() { context$selection[[1]]$range, paste0(c(out, if (context$selection[[1]]$range$end[2] == 1) ""), collapse = "\n"), id = context$id ) - if (getOption("styler.save_after_styling") == TRUE && context$path != "") { + if (save_after_styling_is_active() == TRUE && context$path != "") { invisible(rstudioapi::documentSave(context$id)) } } From 79aa006b9abe4eebe26ab9933e7a81c1c35ef6c3 Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Mon, 1 Feb 2021 00:26:46 +0100 Subject: [PATCH 2/2] add reference to fix --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 02512b296..c0301866e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -35,7 +35,7 @@ the R option `styler.save_after_styling` to control if a file is saved after styling with the RStudio Addin. Note than in RStudio >= 1.3.0, you can auto-save edits in general (Code -> Saving -> Auto-Save), e.g. on idle editor - or focus loss, so this feature becomes less relevant. (#631). + or focus loss, so this feature becomes less relevant (#631, #726). - blank lines in function calls and headers are now removed, for the former only when there are no comments before or after the blank line (#629, #630, #635, #723).