Closed lorenzwalthert closed 2 years ago
Thanks !
I was under the impression it would realign function argument 🤔
Let's say we have this code
call(a = 3,
bre = 3213232
)
Using styler will realign arguments in function call
styler::style_text("call(a = 3,
bre = 3213232
)")
#> call(
#> a = 3,
#> bre = 3213232
#> )
And for example a function definition,
x <- function(a = 3,
bre = 3213232) {
return(TRUE)
}
would be transformed to
styler::style_text("x <- function(a = 3,
bre = 3213232) {
return(TRUE)
}
")
#> x <- function(a = 3,
#> bre = 3213232) {
#> return(TRUE)
#> }
The arguments of the function are re-aligned.
This what we are saying in the book
it can align function arguments
Is that not correct ?
I am fine about changing this, I am just trying to correctly understand what I have missed.
Well it can fix indention and set spacing around =
, which aligns the argument names on the left side. It does not align =
or the arguments after. If you have a look at the styler vignette on alignment, you'll notice that there, we use a definition that has a different focus (and I'd say greater scope).
Yes I have read the vignette. Thanks for the clarification.
I'll accept the change. Thank you !
Unlike the text suggests, {styler} cannot align code, it can only preserve alignment. I also added reference to other tidyverse specific syntax that is explicitly supported.