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
In fact, solving this issue properly also needs #357, because a line break after the opening brace / or before the first unnamed argument also required an up-to-date multi-line attribute for a line break transformer.
Haha ok. Even the example you just created was not indented 😊. However, I think the current behaviour does not reflect the tidyverse style guide. In particular, see tidyverse/style#39.
I mean it's not really a conflict, but in tidyverse/style#39, the idea was to keep the first few unnamed arguments on the same line as the opening parenthesis. Like
map(x, f,
another_arg=3
)
So far so good. However, if the code looks like this
call(
a, b=3
)
styler should probably just leave it as is or move the a one line up, but it adds a line break after a, without removing the one before a.
call(
a,
b=3
)
So here, it's not the case that the first few unnamed arguments are on the same line as the opening brace.
I mean if you think that's fine, we can leave it, but I think the preferred behaviour would be to leave the code unchanged (best option in my eyes) or move the first argument one line up, but not add a line break after a without removing it before it.
I agree with the last example. The first one seems debatable to me. But with current HEAD, we at least don't change
call(a,
b=3
)
Conclusion: Since the tidyverse style guide is not very clear on it and I just looked at it from a different angle than you, I think we can leave it for now.
Activity
lorenzwalthert commentedon Feb 5, 2018
Similarly here, there is no reason to put a line break before the first named argument
Created on 2018-02-05 by the reprex package (v0.1.1.9000).
lorenzwalthert commentedon Feb 5, 2018
Ok, maybe that needs to depend on the
strictoption.lorenzwalthert commentedon Feb 26, 2018
In fact, solving this issue properly also needs #357, because a line break after the opening brace / or before the first unnamed argument also required an up-to-date
multi-lineattribute for a line break transformer.lorenzwalthert commentedon Feb 26, 2018
Reference: #357
krlmlr commentedon Feb 26, 2018
I rather like this particular behavior, even if it was introduced by accident ;-)
Everything seems to work right for single-line argument lists:
lorenzwalthert commentedon Feb 26, 2018
Haha ok. Even the example you just created was not indented 😊. However, I think the current behaviour does not reflect the tidyverse style guide. In particular, see tidyverse/style#39.
krlmlr commentedon Feb 28, 2018
I don't understand, can you please rephrase? I don't see the conflict with the style guide yet.
lorenzwalthert commentedon Feb 28, 2018
I mean it's not really a conflict, but in tidyverse/style#39, the idea was to keep the first few unnamed arguments on the same line as the opening parenthesis. Like
So far so good. However, if the code looks like this
styler should probably just leave it as is or move the a one line up, but it adds a line break after
a,without removing the one beforea.So here, it's not the case that the first few unnamed arguments are on the same line as the opening brace.
lorenzwalthert commentedon Feb 28, 2018
I mean if you think that's fine, we can leave it, but I think the preferred behaviour would be to leave the code unchanged (best option in my eyes) or move the first argument one line up, but not add a line break after a without removing it before it.
lorenzwalthert commentedon Feb 28, 2018
Blocked by #357.
krlmlr commentedon Mar 1, 2018
I thought the preferred styling would be
and we use
only in exceptional situations?
lorenzwalthert commentedon Mar 1, 2018
It depends on the initial formatting.
should be returned unchanged. Also,
So should
But
should be turned into
And
should be left untouched and not turned into
That's my understanding of tidyverse/style#39.
krlmlr commentedon Mar 2, 2018
I don't mind the added newline when styling
because it's consistent with having named arguments on a separate line, similarly for the other example. But I think
needs a line break before the
b.lorenzwalthert commentedon Mar 3, 2018
I agree with the last example. The first one seems debatable to me. But with current
HEAD, we at least don't changeConclusion: Since the tidyverse style guide is not very clear on it and I just looked at it from a different angle than you, I think we can leave it for now.