styler
styler copied to clipboard
Alignment in `switch()` statements is not preserved when elements are missing
When no elements missing: alignment preserved
styler::style_text(text = "
switch(
word,
a = 1,
ab = 2,
abc = 3
)")
#>
#> switch(word,
#> a = 1,
#> ab = 2,
#> abc = 3
#> )
When elements missing: alignment not preserved
styler::style_text(text = "
switch(
word,
a = 1,
ab = ,
abc = 3
)")
#>
#> switch(word,
#> a = 1,
#> ab = ,
#> abc = 3
#> )
Created on 2022-10-05 with reprex v2.0.2
Expected
#> switch(word,
#> a = 1,
#> ab = ,
#> abc = 3
#> )
I am not sure I consider
switch(
word,
a = 1,
ab = ,
abc = 3
)
Aligned. I think it had to be
switch(
word,
a = 1,
ab = ,
abc = 3
)
But even then, it does not give the expected result.