Skip to content

Commit 868cb13

Browse files
authored
Merge pull request #295 from lorenzwalthert/master
- Better error message for styling new files via the RStudio addin (#295).
2 parents 6f49c4b + 923b70b commit 868cb13

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.Rbuildignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
^docs$
1111
^_pkgdown\.yml$
1212
CONTRIBUTING.md
13+
^\.gitsum$
14+
^gitsum$
15+

R/addins.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ try_transform_as_r_file <- function(context, transformer) {
5050
tryCatch(
5151
transformer(context$contents),
5252
error = function(e) stop(
53-
"Cannot style unsaved files other than .R files. Please save the file.", call. = FALSE
53+
paste(
54+
"Styling of unsaved files is only supported for R files with valid code.",
55+
"Please save the file (as .R or .Rmd) and make sure that the R code in it",
56+
"can be parsed. Then, try to style again.",
57+
"The error was \n", e
58+
), call. = FALSE
5459
))
5560
}
5661

0 commit comments

Comments
 (0)