yihui/formatR

any way to automatically add braces for single line statement?

fyears opened this issue · 1 comments

Any way to automatically add braces for single line code inside if or something like that?

For the source code like this:

if (TRUE)
  a = 1
b = 2

Current default result for tidy_source():

if (TRUE) a = 1
b = 2

Expected formatted result (of the requested feature):

if (TRUE) {
  a = 1
}
b = 2
yihui commented

Nope, but if you can figure out how to implement it, I'd be glad to take a look at your pull request :)