formatR icon indicating copy to clipboard operation
formatR copied to clipboard

any way to automatically add braces for single line statement?

Open fyears opened this issue 9 years ago • 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

fyears avatar Aug 15 '16 00:08 fyears

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

yihui avatar Aug 15 '16 03:08 yihui