You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The rules might need a refinement. In this example, the closing brace } belongs to an argument that is indented already, which is why indenting the closing parenthesis looks wrong:
I haven't found a specification for long function calls in the tidyverse guide. Maybe we could contribute one, that also covers complex function arguments that consists of whole blocks?
No need to hurry though, I'm fine with this limitation for now.
A multi-line argument to a function must start on a new line, unless it's the last argument (like test_that(..., {})and all other arguments fit on one line.
A function call must either fit on one line, or have a line break after the opening ( with the arguments indented. Exceptions are switch() and ifelse()/if_else(), and calls where the only multi-line argument is the last argument.
In the meanwhile, I implemented #149, which does what you wrote, yes. Otherwise, just removing the rule we had (update_indention_ref_fun_dec()) would result in what I wrote.
Activity
[-]keep line break between } and )?[/-][+]{ / } and line breaks[/+]krlmlr commentedon Aug 14, 2017
The rules might need a refinement. In this example, the closing brace
}belongs to an argument that is indented already, which is why indenting the closing parenthesis looks wrong:lorenzwalthert commentedon Aug 14, 2017
I am not sure whether I understand you correctly. Why is
a good example with regard to the second rule cited? Shouldn't it be
or even
Also
is bad, I agree, but I thought
would be correct, so
}is unindented since a)follows.krlmlr commentedon Aug 14, 2017
I haven't found a specification for long function calls in the tidyverse guide. Maybe we could contribute one, that also covers complex function arguments that consists of whole blocks?
No need to hurry though, I'm fine with this limitation for now.
Merge pull request #127 from lorenzwalthert/indent_eq_sub
krlmlr commentedon Aug 17, 2017
Attempt to formulate a line-break rule:
Example: https://github.com/krlmlr/styler/issues/125#issuecomment-322282812
krlmlr commentedon Aug 17, 2017
Another potential exception, perhaps if all arguments are multi-line?
tryCatch({ block }, error = function(e) { handler }, finally = { cleanup })Maybe not for the tidyverse style, but it looks like a valid option for other styles.
revert bad changes
lorenzwalthert commentedon Aug 22, 2017
I suggested a function to add a line break after the opening parenthesis if the expression is a function call, see https://github.com/krlmlr/styler/issues/118#issuecomment-322052062. Should we implement that for the CRAN milestone or not? Otherwise,
Will become just
krlmlr commentedon Aug 22, 2017
Did you mean
?
lorenzwalthert commentedon Aug 22, 2017
In the meanwhile, I implemented #149, which does what you wrote, yes. Otherwise, just removing the rule we had (
update_indention_ref_fun_dec()) would result in what I wrote.[-]{ / } and line breaks[/-][+]{ / } and line breaks in function calls[/+]Merge tag 'v0.0-8'
style with styler (and a few manual tweaks), CC @hadley
lorenzwalthert commentedon Oct 25, 2017
Reference: #254.